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

Is the instance a Move Method or Pull Up Method? #21

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

Is the instance a Move Method or Pull Up Method? #21

osmarleandro opened this issue Jan 30, 2021 · 0 comments

Comments

@osmarleandro
Copy link

Summary

In the source code present in osmarleandro/RefactoringMiner@6c42a27 commit, I applied a single Move Method refactoring to setFinallyClause(CompositeStatementObject) method in TryStatementObject class. The method was moved to CompositeStatementObject superclass of TryStatementObject class.

RefDiff detects a single instance of Move Method refactoring, but is the instance a Pull Up Method?

Code example

Diff fragment between the commit osmarleandro/RefactoringMiner@6c42a27 and their parent.

@@ -531,4 +531,8 @@ public class CompositeStatementObject extends AbstractStatement {
                }
                return null;
        }
+
+       public void setFinallyClause(TryStatementObject tryStatementObject) {
+               tryStatementObject.finallyClause = this;
+       }
 }

@@ -250,7 +250,7 @@ public class OperationBody {
                        Block finallyBlock = tryStatement.getFinally();
                        if(finallyBlock != null) {
                                CompositeStatementObject finallyClauseStatementObject = new CompositeStatementObject(cu, filePath, finallyBlock, parent.getDepth()+1, CodeElementType.FINALLY_BLOCK);
-                               child.setFinallyClause(finallyClauseStatementObject);
+                               finallyClauseStatementObject.setFinallyClause(child);

@@ -10,7 +10,7 @@ import gr.uom.java.xmi.LocationInfo.CodeElementType;
 
 public class TryStatementObject extends CompositeStatementObject {
        private List<CompositeStatementObject> catchClauses;
-       private CompositeStatementObject finallyClause;
+       CompositeStatementObject finallyClause;
 
        public TryStatementObject(CompilationUnit cu, String filePath, Statement statement, int depth) {
                super(cu, filePath, statement, depth, CodeElementType.TRY_STATEMENT);
@@ -25,10 +25,6 @@ public class TryStatementObject extends CompositeStatementObject {
                return catchClauses;
        }
 
-       public void setFinallyClause(CompositeStatementObject finallyClause) {
-               this.finallyClause = finallyClause;
-       }
-

Environment details

RefDiff 2.0

Steps to reproduce

  1. Run RefDiff and give as input the commit osmarleandro/RefactoringMiner@6c42a27.

Actual results

MOVE	{Method setFinallyClause(CompositeStatementObject) at src/gr/uom/java/xmi/decomposition/TryStatementObject.java:28}	{Method setFinallyClause(TryStatementObject) at src/gr/uom/java/xmi/decomposition/CompositeStatementObject.java:535})

Expected results

A single instance of the Pull Up Method refactoring applied to setFinallyClause(CompositeStatementObject) method in TryStatementObject 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