RefDiff
RefDiff copied to clipboard
Change Signature Method in Rename Class refactoring
Summary
In the source code present in osmarleandro/RefactoringMiner@c088784 commit, I applied a single Rename Class refactoring to MoveAttributeRefactoring class. RefDiff detects the Rename Class refactoring, but also Change Signature Method refactoring.
Whereas to apply the Rename Class refactoring it is required to update its references. Therefore, is the instances of the Change Signature Method false positives?
Code example
Diff fragment between the commit osmarleandro/RefactoringMiner@c088784 and their parent.
@@ -11,12 +11,12 @@ import org.refactoringminer.api.RefactoringType;
import gr.uom.java.xmi.UMLAttribute;
-public class MoveAttributeRefactoring implements Refactoring {
+public class MoveAttributeRefactoring_RENAMED implements Refactoring {
protected UMLAttribute originalAttribute;
protected UMLAttribute movedAttribute;
private volatile int hashCode = 0;
@@ -86,7 +86,7 @@ public class MoveOperationRefactoring implements Refactoring {
return movedOperation.codeRange();
}
- public boolean compatibleWith(MoveAttributeRefactoring ref) {
+ public boolean compatibleWith(MoveAttributeRefactoring_RENAMED ref) {
if(ref.getMovedAttribute().getClassName().equals(this.movedOperation.getClassName()) &&
@@ -735,7 +735,7 @@ public class UMLModelDiff {
return false;
}
- private int computeCompatibility(MoveAttributeRefactoring candidate) {
+ private int computeCompatibility(MoveAttributeRefactoring_RENAMED candidate) {
int count = 0;
Environment details
RefDiff 2.0
Steps to reproduce
- Run RefDiff and give as input the commit osmarleandro/RefactoringMiner@c088784.
Actual results
CHANGE_SIGNATURE {Method compatibleWith(MoveAttributeRefactoring) at src/gr/uom/java/xmi/diff/MoveOperationRefactoring.java:89} {Method compatibleWith(MoveAttributeRefactoring_RENAMED) at src/gr/uom/java/xmi/diff/MoveOperationRefactoring.java:89})
CHANGE_SIGNATURE {Method computeCompatibility(MoveAttributeRefactoring) at src/gr/uom/java/xmi/diff/UMLModelDiff.java:738} {Method computeCompatibility(MoveAttributeRefactoring_RENAMED) at src/gr/uom/java/xmi/diff/UMLModelDiff.java:738})
RENAME {Class MoveAttributeRefactoring at src/gr/uom/java/xmi/diff/MoveAttributeRefactoring.java:14} {Class MoveAttributeRefactoring_RENAMED at src/gr/uom/java/xmi/diff/MoveAttributeRefactoring_RENAMED.java:14})
Expected results
A single instance of the Rename Class refactoring applied to MoveAttributeRefactoring class.