diff --git a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java index 2a8f3deff2..6b4dcee41c 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java @@ -776,6 +776,14 @@ private boolean conflictingMoveOfTopLevelClass(UMLClass removedClass, UMLClass a if(!removedClass.isTopLevel() && !addedClass.isTopLevel()) { //check if classMoveDiffList contains already a move for the outer class to a different target for(UMLClassMoveDiff diff : classMoveDiffList) { + if(!diff.getOriginalClass().isTopLevel() && !diff.getMovedClass().isTopLevel()) { + String prefix1 = diff.getOriginalClassName().substring(0, diff.getOriginalClassName().lastIndexOf(".")); + String prefix2 = diff.getNextClassName().substring(0, diff.getNextClassName().lastIndexOf(".")); + UMLClass outerRemovedClass = getRemovedClass(prefix1); + UMLClass outerAddedClass = getAddedClass(prefix2); + if(outerRemovedClass == null || outerAddedClass == null) + continue; + } if((diff.getOriginalClass().getName().startsWith(removedClass.getPackageName() + ".") && !diff.getMovedClass().getName().startsWith(addedClass.getPackageName() + ".")) || (!diff.getOriginalClass().getName().startsWith(removedClass.getPackageName() + ".") && diff --git a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java index 1fa061095a..452d6c810c 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(12349, 20, 232); + test.assertExpectationsWithGitHubAPI(12351, 20, 232); } } diff --git a/src/test/resources/oracle/data.json b/src/test/resources/oracle/data.json index c0e3804106..5a6c5f5031 100644 --- a/src/test/resources/oracle/data.json +++ b/src/test/resources/oracle/data.json @@ -885,8 +885,8 @@ "type": "Move Method", "description": "Move Method public onType(typeDescription TypeDescription) : TypeVariableProxy from class net.bytebuddy.dynamic.TargetType.TypeVariableProxy.Extractor to public onType(typeDescription TypeDescription) : TypeVariableProxy from class net.bytebuddy.description.type.generic.GenericTypeDescription.Visitor.Substitutor.ForRawType", "comment": "Second Opinion, Seems FP since the Extractor is removerd and ForRawType is a new class. Moreover the method is the same since both class implement the same extends the same class | Davood: If you accept moving from a class which no longer exists to a new class, this is TP. Otherwise FP. However, I would mark the entire thing as a rename class. All the methods/attributes of the removed class is being repeated (with small modifications) in the new class. Matin, Davood: FP, condidate move and rename class", - "validation": "TP", - "detectionTools": "RefactoringMiner, RefDiff, RD-1x, RD-2x", + "validation": "FP", + "detectionTools": "RefDiff, RD-1x, RD-2x", "validators": "Matin, Davood, Nikos" }, { "type": "Move Method", @@ -1330,15 +1330,36 @@ "detectionTools": "RefactoringMiner", "validators": null }, { - "type": "Move And Rename Method", - "description": "Move And Rename Method public Extractor(substitute TypeDescription, substitutionMatcher ElementMatcher) from class net.bytebuddy.dynamic.TargetType.TypeVariableProxy.Extractor to protected ForRawType(substitute TypeDescription, substitutionMatcher ElementMatcher) from class net.bytebuddy.description.type.generic.GenericTypeDescription.Visitor.Substitutor.ForRawType", + "type": "Extract Attribute", + "description": "Extract Attribute public ARRAY_INTERFACES : GenericTypeList in class net.bytebuddy.description.type.TypeDescription", "comment": null, "validation": "TP", "detectionTools": "RefactoringMiner", "validators": null }, { - "type": "Extract Attribute", - "description": "Extract Attribute public ARRAY_INTERFACES : GenericTypeList in class net.bytebuddy.description.type.TypeDescription", + "type": "Move And Rename Class", + "description": "Move And Rename Class net.bytebuddy.dynamic.TargetType.TypeVariableProxy.Extractor moved and renamed to net.bytebuddy.description.type.generic.GenericTypeDescription.Visitor.Substitutor.ForRawType", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Add Class Modifier", + "description": "Add Class Modifier static in class net.bytebuddy.description.type.generic.GenericTypeDescription.Visitor.Substitutor.ForRawType", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Change Class Access Modifier", + "description": "Change Class Access Modifier package to public in class net.bytebuddy.description.type.generic.GenericTypeDescription.Visitor.Substitutor.ForRawType", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Add Method Annotation", + "description": "Add Method Annotation @SuppressWarnings(\"unchecked\") in method public onMethod(methodDescription MethodDescription) : TypeVariableProxy from class net.bytebuddy.description.type.generic.GenericTypeDescription.Visitor.Substitutor.ForRawType", "comment": null, "validation": "TP", "detectionTools": "RefactoringMiner", diff --git a/src/test/resources/oracle/expected.txt b/src/test/resources/oracle/expected.txt index eb8b1818f7..51ebe90a23 100644 --- a/src/test/resources/oracle/expected.txt +++ b/src/test/resources/oracle/expected.txt @@ -128,7 +128,7 @@ d9a2c69a9d1db6072e1d7b7ea4fcbd5c15d20b5d, 3, 0, 0 becced5f0b7bac8200df7a5706b568687b517b90, 11, 0, 1 20d39f7af2165c67d5221f556f58820c992d2cc6, 7, 0, 0 3514aaedf9624222c985cb3abb12df2d9b514b12, 13, 0, 0 -372f4ae6cebcd664e3b43cade356d1df233f6467, 58, 0, 1 +372f4ae6cebcd664e3b43cade356d1df233f6467, 60, 0, 1 cb98ee25ff52bf97faebe3f45cdef0ced9b4416e, 28, 0, 0 1cfc6f64f64353bc5530a8ce8cdacfc3eba3e7b2, 3, 0, 0 b47634176fa48ad925f79886c6aaca225cb9af64, 3, 0, 0