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

NullPointerException at JDTAnnotationNode.java:176 with Eclipse Neon (e4.6) #323

Closed
vio-f opened this issue Jul 31, 2017 · 8 comments
Closed

Comments

@vio-f
Copy link

vio-f commented Jul 31, 2017

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:

  • Eclipse IDE for Java Developers
  • Version: Neon.3 Release (4.6.3)
  • Build id: 20170314-1500
  • Java: jdk1.8.0_112

groovy-eclipse

  • Groovy Compiler 2.x
  • Groovy-Eclipse Compilerless 2.9.2.xx-201707291445-e46
  • JDT Core patch for Groovy-Eclipse plugin on Eclipse 4.6 2.9.2.xx-201707291445-e46
@eric-milles
Copy link
Member

eric-milles commented Jul 31, 2017 via email

@vio-f
Copy link
Author

vio-f commented Aug 1, 2017

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:
@SomeAnnotation(....)
Also, I just tried moving the groovy files into their own new project one by one and I still get the error.

@eric-milles
Copy link
Member

eric-milles commented Aug 1, 2017 via email

@vio-f
Copy link
Author

vio-f commented Aug 1, 2017

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.
Could this be something related to missing transitive dependencies?

@eric-milles
Copy link
Member

eric-milles commented Aug 1, 2017 via email

@vio-f
Copy link
Author

vio-f commented Aug 1, 2017

Wow. The issue is fixed by correcting the classpath.
I replaced:

<dependency>
    <groupId>org.jetbrains</groupId>
    <artifactId>annotations</artifactId>
    <version>12.0</version>
</dependency>

with:

<dependency>
    <groupId>com.intellij</groupId>
    <artifactId>annotations</artifactId>
    <version>12.0</version>
</dependency>

They both provide the Nulable annotation, but the issue went away when I switched.
Thank you very much!

@vio-f vio-f closed this as completed Aug 1, 2017
@eric-milles
Copy link
Member

eric-milles commented Aug 1, 2017 via email

@vio-f
Copy link
Author

vio-f commented Aug 3, 2017

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.

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