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

Fragment mode (-f) does not change code after Spoon Version 1.5 #158

Closed
giphon opened this issue Feb 23, 2015 · 1 comment
Closed

Fragment mode (-f) does not change code after Spoon Version 1.5 #158

giphon opened this issue Feb 23, 2015 · 1 comment

Comments

@giphon
Copy link

giphon commented Feb 23, 2015

I am using the -f (fragment) mode of Spoon.

The processor is the same to that in the guide in http://spoon.gforge.inria.fr/Doc/FAQ/, (the part of "How to preserve the transformed source code formatting and one-line comments").

I found that only Spoon-1.5 can change the source code with the processor. But all the other spoon versions cannot make any change.
Is there any further steps to active the -f mode?

The commands that I used are as follows.
java -cp target/classes:spoon-core-3.1-jar-with-dependencies.jar spoon.Launcher -i src/test/java/com/mine/TempExample.java -p com.mine.TempExprProcessor -v --compliance 6 -f
java -cp target/classes:spoon-core-1.5-jar-with-dependencies.jar spoon.Launcher -i src/test/java/com/mine/TempExample.java -p com.mine.TempExprProcessor -v --compliance 6 -f

The processor is as follows.
public class TempExprProcessor extends AbstractProcessor{
public void process(CtExpression e) {
CompilationUnit cu=e.getPosition().getCompilationUnit();
SourceCodeFragment fragment = new SourceCodeFragment();
fragment.position = e.getPosition().getSourceStart();
fragment.replacementLength =
e.getPosition().getSourceEnd() - e.getPosition().getSourceStart();
fragment.code="...";
cu.addSourceCodeFragment(fragment);
}
}

@GerardPaligot
Copy link
Contributor

This issue can be closed for a new issue #188.

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

3 participants