You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
}
The text was updated successfully, but these errors were encountered:
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);
}
}
The text was updated successfully, but these errors were encountered: