-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
review: feature Parameter remove refactoring #1317
review: feature Parameter remove refactoring #1317
Conversation
9c10bb6
to
d9d55c4
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170521.070955-114 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 2. Change 1
Change 2
|
82f4d75
to
a36d248
Compare
CtMethod<?> methodTypeA_method1 = typeA.getMethodsByName("method1").get(0); | ||
CtParameterRemoveRefactoring refactor = new CtParameterRemoveRefactoring().setTarget(methodTypeA_method1.getParameters().get(0)); | ||
refactor.setTarget(methodTypeA_method1.getParameters().get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already done at previous line
@@ -29,36 +29,46 @@ | |||
import java.io.FileNotFoundException; | |||
|
|||
public final class ModelUtils { | |||
|
|||
public static Launcher lastLauncher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stateful :-( do you really need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need it because I do not know how to do it better...
Have a look at testCtParameterRemoveRefactoring
@Test
public void testCtParameterRemoveRefactoring() {
String testPackagePath = "spoon/test/refactoring/parameter/testclasses";
Factory factory = ModelUtils.build(new File("./src/test/java/"+testPackagePath));
Launcher launcher = ModelUtils.getLastLauncher();
CtType<?> typeA = factory.Class().get(TypeA.class);
...
//I need launcher to print model to java. Is there nicer way?
launcher.setSourceOutputDirectory(new File("./target/spooned/"));
launcher.getModelBuilder().generateProcessedSourceFiles(OutputType.CLASSES);
ModelUtils.canBeBuilt("./target/spooned/"+testPackagePath, 8);
Simply use a launcher directly
|
61329d2
to
8206654
Compare
The tests was modified to be compatible with not modified ModelUtils. The change in ModelUtils was rolled back. |
return false; | ||
} | ||
return getTargetInvocations().contains(invocation); | ||
/* CtExecutableReference<?> execRef = invocation.getExecutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code?
Implements a "method parameter remove refactoring function". It expects a CtParameter as input - it is the parameter, which has to be removed by this refactoring.
The refactoring function:
in preparation phase:
in validation phase:
in refactoring phase