diff --git a/src/main/java/gr/uom/java/xmi/decomposition/VariableReplacementAnalysis.java b/src/main/java/gr/uom/java/xmi/decomposition/VariableReplacementAnalysis.java index 8ea44c4e7..ce433c922 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/VariableReplacementAnalysis.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/VariableReplacementAnalysis.java @@ -1793,7 +1793,13 @@ else if(!PrefixSuffixUtils.normalize(replacement.getBefore()).equals(PrefixSuffi candidate.setRenamedVariableDeclaration(v2.getKey()); ExtractVariableRefactoring conflictingExtractVariableRefactoring = existsConflictingExtractVariableRefactoring(candidate); if(conflictingExtractVariableRefactoring == null) { - this.candidateAttributeRenames.add(candidate); + boolean skip = false; + if(v1 != null && v2 == null && v1.getValue().isConstructor()) { + skip = true; + } + if(!skip) { + this.candidateAttributeRenames.add(candidate); + } } else { for(LeafMapping mapping : conflictingExtractVariableRefactoring.getSubExpressionMappings()) { diff --git a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java index e00bd02bd..329e7c981 100644 --- a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java +++ b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java @@ -17,6 +17,6 @@ public void testAllRefactorings() throws Exception { GitHistoryRefactoringMinerImpl detector = new GitHistoryRefactoringMinerImpl(); TestBuilder test = new TestBuilder(detector, REPOS, Refactorings.All.getValue()); RefactoringPopulator.feedRefactoringsInstances(Refactorings.All.getValue(), Systems.FSE.getValue(), test); - test.assertExpectationsWithGitHubAPI(12403, 21, 226); + test.assertExpectationsWithGitHubAPI(12403, 20, 226); } }