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

Spoon exception about source code level #73

Open
surli opened this issue Mar 14, 2018 · 7 comments
Open

Spoon exception about source code level #73

surli opened this issue Mar 14, 2018 · 7 comments

Comments

@surli
Copy link
Collaborator

surli commented Mar 14, 2018

I got the following exception when running astor on project https://github.com/druid-io/druid:

spoon.compiler.ModelBuildingException: Syntax error, annotations are only available if source level is 1.5 or greater at /root/output_astor/AstorMain-server/src/default/io/druid/server/http/CoordinatorDynamicConfigsResource.java:49
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.report(JDTBasedSpoonCompiler.java:581)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblems(JDTBasedSpoonCompiler.java:562)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:119)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:100)
at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:91)

Is there an option to specify the source code level wanted in Astor? And will it fix automatically the source code level used inside Spoon?

@martinezmatias
Copy link
Collaborator

Hi Simon

Is there an option to specify the source code level wanted in Astor

Yes, the option is 'javacompliancelevel'. For instance, javacompliancelevel=8 corresponds to java 8 (or 1.8).

And will it fix automatically the source code level used inside Spoon?
Yes. it passes that property to Spoon.

If the problem continues, write me and I run the example locally to reproduce the error

@surli
Copy link
Collaborator Author

surli commented Mar 15, 2018

Yes, the option is 'javacompliancelevel'. For instance, javacompliancelevel=8 corresponds to java 8 (or 1.8).

Actually I misreaded my list of arguments yesterday: I'm already using this argument and setting it to 8:

astorArgs.add("-parameters");
astorArgs.add("timezone:Europe/Paris:maxnumbersolutions:3:limitbysuspicious:false:maxmodificationpoints:1000:javacompliancelevel:8:logfilepath:repairnator.astor.log");

@martinezmatias
Copy link
Collaborator

So, That means that using this configuration (that uses javacompliancelevel:8) you have the previous exception?

@surli
Copy link
Collaborator Author

surli commented Mar 15, 2018

That means that using this configuration (that uses javacompliancelevel:8) you have the previous exception?

Exactly

@martinezmatias
Copy link
Collaborator

Okey, I am almost sure where is the problem.
Astor tries to generate the spoon model using javacompliancelevel (in your case 8). if the compilation fails, Astor tries to compile again using a lower compliance, indicated in property alternativecompliancelevel (by default 4). This is an old feature, that we use it then we executed astor on an old dataset with some subject that required to be compiled in java 1.4.
However, in cases like yours, the first compilation could be produced due to a wrong configuration of the source folder or a missing dependency.
Could you send me the complete log and the command? There is probably a clue there.

@surli
Copy link
Collaborator Author

surli commented Mar 15, 2018

Could you send me the complete log and the command? There is probably a clue there.

Actually I don't have right now the logs, as my process fails. I'll try to reproduce the error myself before giving this to you.

However I got the following information: Nopol next tries to repair the same bug ang got an error with Spoon:

spoon.compiler.ModelBuildingException: The method makeRequestMetrics(GenericQueryMetricsFactory, QueryToolChest<T,Query>, Query, String) in the type DruidMetrics is not applicable for the arguments (GenericQueryMetricsFactory, QueryToolChest, Query, String) at /root/workspace/druid-io/druid/352360271/server/src/main/java/io/druid/server/AsyncQueryForwardingServlet.java:500

Did you catch those exception in Astor for your fallback mechanism you talked about?

@martinezmatias
Copy link
Collaborator

martinezmatias commented Mar 15, 2018

Did you catch those exception in Astor for your fallback mechanism you talked about?

I have just commited a change in the mechanism I explained before: we compile only once using 'javacompliancelevel' , if the compilation fails we throws an exception

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

2 participants