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

Extract and Move Method in Rename Method refactoring #19

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

Extract and Move Method in Rename Method refactoring #19

osmarleandro opened this issue Jan 28, 2021 · 0 comments

Comments

@osmarleandro
Copy link

Summary

In the source code present in osmarleandro/RefactoringMiner@38b41e6 commit, I applied a single Rename Method refactoring to isParameter() method in the VariableDeclaration class. RefDiff yields four instances of Extract and Move Method refactoring.

Code example

Diff fragment between the commit osmarleandro/RefactoringMiner@38b41e6 and their parent.

@@ -115,7 +115,7 @@ public class VariableDeclaration implements LocationInfoProvider, VariableDeclar
                return scope;
        }
 
-       public boolean isParameter() {
+       public boolean isParameter_RENAMED() {
                return isParameter;
        }

@@ -40,7 +40,7 @@ public class ChangeVariableTypeRefactoring implements Refactoring {
        }
 
        public RefactoringType getRefactoringType() {
-               if(originalVariable.isParameter() && changedTypeVariable.isParameter())
+               if(originalVariable.isParameter_RENAMED() && changedTypeVariable.isParameter_RENAMED())

@@ -51,11 +51,11 @@ public class MergeVariableRefactoring implements Refactoring {
 
        private boolean allVariablesAreParameters() {
                for(VariableDeclaration declaration : mergedVariables) {
-                       if(!declaration.isParameter()) {
+                       if(!declaration.isParameter_RENAMED()) {
                                return false;
                        }
                }
-               return newVariable.isParameter();
+               return newVariable.isParameter_RENAMED();

@@ -34,9 +34,9 @@ public class RenameVariableRefactoring implements Refactoring {
        }
 
        public RefactoringType getRefactoringType() {
-               if(originalVariable.isParameter() && renamedVariable.isParameter())
+               if(originalVariable.isParameter_RENAMED() && renamedVariable.isParameter_RENAMED())
                        return RefactoringType.RENAME_PARAMETER;
-               if(!originalVariable.isParameter() && renamedVariable.isParameter())
+               if(!originalVariable.isParameter_RENAMED() && renamedVariable.isParameter_RENAMED())

@@ -51,11 +51,11 @@ public class SplitVariableRefactoring implements Refactoring {
 
        private boolean allVariablesAreParameters() {
                for(VariableDeclaration declaration : splitVariables) {
-                       if(!declaration.isParameter()) {
+                       if(!declaration.isParameter_RENAMED()) {
                                return false;
                        }
                }
-               return oldVariable.isParameter();
+               return oldVariable.isParameter_RENAMED();
        }

Environment details

RefDiff 2.0

Steps to reproduce

  1. Run RefDiff and give as input the commit osmarleandro/RefactoringMiner@38b41e6.

Actual results

EXTRACT_MOVE	{Method allVariablesAreParameters() at src/gr/uom/java/xmi/diff/SplitVariableRefactoring.java:52}	{Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
EXTRACT_MOVE	{Method getRefactoringType() at src/gr/uom/java/xmi/diff/RenameVariableRefactoring.java:36}	{Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
EXTRACT_MOVE	{Method allVariablesAreParameters() at src/gr/uom/java/xmi/diff/MergeVariableRefactoring.java:52}	{Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})
EXTRACT_MOVE	{Method getRefactoringType() at src/gr/uom/java/xmi/diff/ChangeVariableTypeRefactoring.java:42}	{Method isParameter_RENAMED() at src/gr/uom/java/xmi/decomposition/VariableDeclaration.java:118})

Expected results

A single instance of the Rename Method refactoring applied to isParameter() method in the VariableDeclaration 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