Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Signature Method in Rename Class refactoring #20

Open
osmarleandro opened this issue Jan 30, 2021 · 0 comments
Open

Change Signature Method in Rename Class refactoring #20

osmarleandro opened this issue Jan 30, 2021 · 0 comments

Comments

@osmarleandro
Copy link

osmarleandro commented Jan 30, 2021

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

  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant