-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
The type javax.annotation.Nullable cannot be resolved. It is indirectly referenced from required .class files #925
Comments
Which version of spoon do toi use? |
5.4.0 from Maven Central. |
strange. #820 fixes the issue for me... It does not seam possible to disable the JDT exception. Sorry |
Can you try to replace the line: https://github.com/INRIA/spoon/blob/master/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java#L122 CommentRecorderParser parser =
new CommentRecorderParser(
new ProblemReporter(
DefaultErrorHandlingPolicies.ignoreAllProblems(), // changed arg
compilerOptions,
new DefaultProblemFactory(Locale.getDefault())),
false); |
It doesn't make any difference; I still get the same error. |
One hardcore "solution" is to overwrite the method handle of ProblemReporter to bypass the JDT exception. |
in noclasspath, it makes perfectly sense. |
@monperrus, @tdurieux: Since I have no experience with JDT related exception, I would be delighted I one of you could fix this issue. |
Hello, environment, getHandlingPolicy(), compilerOptions, to environment, DefaultErrorHandlingPolicies.ignoreAllProblems(), compilerOptions, |
Applying your patch yields to another error (I'm using the most recent version of Spoon 801d1cd): java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.analyseCode(AllocationExpression.java:94)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.analyseCode(LocalDeclaration.java:89)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:125)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:739)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:263)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:118)
at spoon.support.compiler.jdt.TreeBuilderCompiler.buildUnits(TreeBuilderCompiler.java:70)
at spoon.support.compiler.jdt.JDTBatchCompiler.getUnits(JDTBatchCompiler.java:120)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:372)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:115)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:98)
at spoon.Launcher.buildModel(Launcher.java:699) In the following you can see the output of diff --git a/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java b/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java
index 90c163e..4954dcb 100644
--- a/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java
+++ b/src/main/java/spoon/support/compiler/jdt/JDTBatchCompiler.java
@@ -109,7 +109,7 @@ public class JDTBatchCompiler extends org.eclipse.jdt.internal.compiler.batch.Ma
CompilerOptions compilerOptions = new CompilerOptions(this.options);
compilerOptions.parseLiteralExpressionsAsConstants = false;
TreeBuilderCompiler treeBuilderCompiler = new TreeBuilderCompiler(
- environment, getHandlingPolicy(), compilerOptions,
+ environment, DefaultErrorHandlingPolicies.ignoreAllProblems(), compilerOptions,
this.jdtCompiler.requestor, getProblemFactory(), this.out,
null);
if (jdtCompiler.getEnvironment().getNoClasspath()) { |
Thank you. I will investigate. This time I will reproduce the bug ... |
Any progress here? |
Sorry I did not have the time to work on it. |
@ReTuXx I just try to reproduce your bug with a very very simple testcase:
Just tried with the version of Guava you mentioned, with both last version of spoon and the version from commit you reference: all is passing here... Could you give me more info to reproduce the bug here? |
@ReTuXx any news here? |
Working on it. You'll get an update tomorrow. |
It looks like the error occurs only when using our incremental Spoon model update approach because the error doesn't show up when spooning the revision by its own. I'll close this issue because it is not Spoon related. |
I get the following error when running Spoon in noclasspath mode on
Guava
(commit:221de73a17f4c5f2b913c5b0c640d54aa1000f94
):Shouldn't noclasspath mode ignore missing dependencies?
The text was updated successfully, but these errors were encountered: