-
Notifications
You must be signed in to change notification settings - Fork 194
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 in AnnotationBinding.java #232
Comments
Can you share the source annotation that is being compiled? |
its the same code example as issue #224. Happens randomly throughout the day during compile, not every time, and not always the same object (i have the custom annotation on many domain objects in the application). I can't share any real code because its confidential, so i created the simplified example. |
I've found that simplified examples can get you only so far. Case and point, the original issue has been patched but a more insidious issue is now happening intermittently. You could pull down the code, build the plug-ins and debug from your end. |
Can you retest with the latest snapshot? |
i don't see that exact error anymore, now anytime i change a groovy file with one of these annotations, i immediately get an error with no stacktrace, then if i do a clean then i get a stacktrace. A 2rd clean usually fixes everything. first error - second error after clean - |
Okay, I'm going to roll back one change in GroovyParser that I was unsure about. When the parser is reset, it looked up new class loaders; this may be why you are getting a class loader miss. Should be available for retest in about 30 mins. |
The old error is back now, if you change any groovy file with a custom annotation you get this error until you do a full clean build. Internal compiler error: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.setMethodBindings(AnnotationBinding.java:222) |
Okay, got it. Short-circuit in Annotation.resolveType: // GROOVY edit
boolean isGroovyAlias = isFakeGroovyAnnotation(typeBinding);
// ensure type refers to an annotation type
if (!typeBinding.isAnnotationType() && typeBinding.isValidBinding()) {
if (isGroovyAlias) {
// allow the Groovy annotation to show in Javadoc
// TODO: Does this cause unanticipated side effects?
this.compilerAnnotation = scope.environment().createAnnotation(
(ReferenceBinding) this.resolvedType, computeElementValuePairs());
} else {
scope.problemReporter().notAnnotationType(typeBinding, this.type);
}
return null;
} Under computeElementValuePairs(), an array with a null value is created. I'm trying with no EVPairs for this case... |
Could you recheck? |
looks like its working now, tried a bunch of stuff and don't see any errors anymore, thanks for looking into this. |
I've been getting this exception randomly during compile since issue #224 has been fixed
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.setMethodBindings(AnnotationBinding.java:222)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createAnnotation(LookupEnvironment.java:683)
at org.eclipse.jdt.internal.compiler.ast.Annotation.resolveType(Annotation.java:805)
at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveAnnotations(ASTNode.java:837)
at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveAnnotations(ASTNode.java:705)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.getAnnotationTagBits(SourceTypeBinding.java:992)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.checkAnnotationsInType(SourceTypeBinding.java:857)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:868)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:554)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:913)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
at java.lang.Thread.run(Unknown Source)
The text was updated successfully, but these errors were encountered: