-
Notifications
You must be signed in to change notification settings - Fork 193
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
NullPointerException at JDTAnnotationNode.java:176 with Eclipse Neon (e4.6) #323
Comments
@viorelflorian This error comes when trying to represent one of your Groovy annotations in the Java model of JDT. I understand you have quite a large project -- would it be possible to narrow down which file is the source of the issue? If you open them in groups by package, the error should show again. That would indicate the problem class is contained or referenced within. I'm looking for an annotation that has a member value initialized by something other than a class literal, string literal or constant like a number.
|
Eclipse shows me the file that generates the error, and when I remove the file another one pops up. None of them have any annotations, unless I am misunderstanding what you mean by "annotations". If you mean something like the one below, then I can safely say that I use none: |
The annotation may be in a parent class or interface. Or in a class that is a parameter or return type. But yes, annotations as in @something(member=value). It is the value part that must be different in some way.
|
OK. I inspected the hierarchy I found only the org.jetbrains.annotations.Nullable annotation in a parent class 2 layers up in a class file provided by a 3rd party. |
It could be. Do you have the dependency for that annotation? And is it retained in the class file, that is, is its RetentionPolicy wither CLASS or RUNTIME?
Could you describe the skeletal structure from your class to the one with the annotation? For example:
class Mine implements Parent
interface Parent implements SomethingHigher
interface SomethingHigher {
void method(@nullable param)
}
I just need to understand the link to the annotated class. It may be through extends, implements, or field/method signatures.
|
Wow. The issue is fixed by correcting the classpath.
with:
They both provide the Nulable annotation, but the issue went away when I switched. |
Looking at jcenter or maven central, I can see com.intellij:annotations-12.0 and org.jetbrains:annotations-13.0. Looks like the org was changed starting with release 13. Did maven ever give a warning for a missing dependency?
|
Not for this dependency. But I looked up the jar file that is provided in the application that runs these groovy files and I saw that it was the "com.intellij" version so I used that and it all started working. Again thank you for proving it was an obscure user error. |
Whenever I open a large Groovy Project in Eclipse, with a lot of groovy files, it throws the following exception:
!ENTRY org.eclipse.core.resources 4 2 2017-07-31 11:06:35.428 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". !STACK 0 java.lang.NullPointerException at org.codehaus.jdt.groovy.internal.compiler.ast.JDTAnnotationNode.createExpressionFor(JDTAnnotationNode.java:176) at org.codehaus.jdt.groovy.internal.compiler.ast.JDTAnnotationNode.createExpressionFor(JDTAnnotationNode.java:168) at org.codehaus.jdt.groovy.internal.compiler.ast.JDTAnnotationNode.ensureMembersInitialized(JDTAnnotationNode.java:153) at org.codehaus.jdt.groovy.internal.compiler.ast.JDTAnnotationNode.getMember(JDTAnnotationNode.java:70) at org.codehaus.groovy.vmplugin.v5.Java5.configureAnnotationFromDefinition(Java5.java:246) at org.codehaus.groovy.vmplugin.v5.Java5.configureAnnotation(Java5.java:266) at org.codehaus.groovy.classgen.AnnotationVisitor.visit(AnnotationVisitor.java:81) at org.codehaus.groovy.classgen.ExtendedVerifier.visitAnnotation(ExtendedVerifier.java:240) at org.codehaus.groovy.classgen.ExtendedVerifier.visitAnnotations(ExtendedVerifier.java:127) at org.codehaus.groovy.classgen.ExtendedVerifier.visitConstructorOrMethod(ExtendedVerifier.java:91) at org.codehaus.groovy.classgen.ExtendedVerifier.visitMethod(ExtendedVerifier.java:84) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1186) at org.codehaus.groovy.classgen.ExtendedVerifier.visitClass(ExtendedVerifier.java:72) at org.codehaus.groovy.control.CompilationUnit$6.call(CompilationUnit.java:789) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1099) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:588) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:566) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:543) at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:217) at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.generateCode(GroovyCompilationUnitDeclaration.java:321) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:891) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141) at java.lang.Thread.run(Thread.java:745)
Eclipse:
groovy-eclipse
The text was updated successfully, but these errors were encountered: