From 273991a0eb24ceb88293ab2bd41dbb470179f0db Mon Sep 17 00:00:00 2001 From: tsantalis Date: Wed, 1 Jan 2025 19:02:25 -0500 Subject: [PATCH] Fix last failing test --- .../xmi/decomposition/VariableReplacementAnalysis.java | 8 +++++++- .../org/refactoringminer/test/TestAllRefactorings.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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 8ea44c4e7d..ce433c922b 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 e00bd02bdf..329e7c981e 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); } }