aserg-ufmg / RefDiff

A tool to mine refactorings in the commit history of git repositories.
MIT License
148 stars 44 forks source link

Extract and Move Method in Rename Method instance #23

Open osmarleandro opened 3 years ago

osmarleandro commented 3 years ago

Summary

In the source code present in osmarleandro/RefactoringMiner@00d45e1 commit, I applied a single Rename Method to isFinal() method in UMLAttribute class, but RefDiff yields Extract and Move Method instance.

Code example

Diff fragment between the commit osmarleandro/RefactoringMiner@00d45e1 and their parent.

@@ -45,7 +45,7 @@ public class UMLAttribute implements Comparable<UMLAttribute>, Serializable, Loc
                this.visibility = visibility;
        }

-       public boolean isFinal() {
+       public boolean isFinal_RENAMED() {
                return isFinal;
        }

@@ -42,7 +42,7 @@ public class UMLAttributeDiff {
                        qualifiedTypeChanged = true;
                if(removedAttribute.isStatic() != addedAttribute.isStatic())
                        staticChanged = true;
-               if(removedAttribute.isFinal() != addedAttribute.isFinal())
+               if(removedAttribute.isFinal_RENAMED() != addedAttribute.isFinal_RENAMED())

@@ -89,8 +89,8 @@ public class UMLAttributeDiff {
                        sb.append("\t").append("modifier changed from " + (removedAttribute.isStatic() ? "static" : "non-static") + " to " +
                                        (addedAttribute.isStatic() ? "static" : "non-static")).append("\n");
                if(finalChanged)
-                       sb.append("\t").append("modifier changed from " + (removedAttribute.isFinal() ? "final" : "non-final") + " to " +
-                                       (addedAttribute.isFinal() ? "final" : "non-final")).append("\n");
+                       sb.append("\t").append("modifier changed from " + (removedAttribute.isFinal_RENAMED() ? "final" : "non-final") + " to " +
+                                       (addedAttribute.isFinal_RENAMED() ? "final" : "non-final")).append("\n");

Environment details

RefDiff 2.0

Steps to reproduce

  1. Run RefDiff and give as input the commit osmarleandro/RefactoringMiner@00d45e1.

Actual results

EXTRACT_MOVE    {Method toString() at src/gr/uom/java/xmi/diff/UMLAttributeDiff.java:78}    {Method isFinal_RENAMED() at src/gr/uom/java/xmi/UMLAttribute.java:48})

Expected results

A single instance of the Rename Method refactoring applied to isFinal() method in UMLAttribute class.