-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
package statements are missing #2944
Comments
Not sure to understand the issue here. So in a nutshell there's nothing wrong here. |
I'm writing a program to format java code(variable renaming,function renaming,class renaming). the second screenshot is the input code to format, while the first screen is the output. you can see that the input contains package import statement. I want to remain those statement in the output code. Because I am just doing renaming. How can I remain those package statements ? |
The problem is that your original input contains several classes: by default, Spoon process the file to display only one class by compilation unit.
|
Thanks for replying! I tried your method just now. but how can I get the output codes. |
See #2945 |
I'm writing a program to format java code(variable renaming,function renaming,class renaming). the second screenshot is the input code to format, while the first screen is the output. you can see that the input contains package import statement. I want to remain those statement in the output code. Because I am just doing renaming. How can I remain those package statements ?
`
Launcher launcher = new Launcher();
launcher.addInputResource(projectPath);
launcher.getEnvironment().setAutoImports(true);
CtModel model = launcher.buildModel();
model.processWith(new FieldProcessor());
model.processWith(new FieldAccessProcessor(table));
model.processWith(new VariableProcessor());
model.processWith(new ParamProcessor());
Collection<CtType<?>> types = model.getAllTypes();
The same problem in other issue
The text was updated successfully, but these errors were encountered: