-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Test Code isn't human readable because enums and static values are fully qualified #162
Comments
You can generate your source code with the option |
This doesn't seem to work. Tried passing this option to the Launcher ctor:
|
You seems to use directly a compiler and not the launcher. Test something like this: private static SpoonCompiler createSpoonCompiler(final Factory factory) {
Launcher launcher = new Launcher() {
@Override
public Factory createFactory() {
return factory;
}
};
factory.getEnvironment().setAutoImports(true);
return launcher.createCompiler();
} |
Yes, this doesn't work either. Actually creating the factory and the launcher like:
|
@ocean7 In the next snapshot (or release), you can print any elements with imports. |
We're using spoon to generate some documentation. As part of this effort we're actually including some of the Java code in a generated website. We use CtMethod.getBody().toString() to get the code associated with a special annotated method. The string returned from this method has enums and other static variables fully qualified. Can this be disabled? The actual code itself (that's parsed by spoon) doesn't use fully qualified names to refer to enums (it relies on Java import mechanism). Could spoon by default return a faithful copy of the actual code?
The text was updated successfully, but these errors were encountered: