Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 513383

Summary: NullPointerException when calling ITypeBinding.getAnnotations() on annotation type
Product: [Eclipse Project] JDT Reporter: Andreas Sewe <sewe>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug

Description Andreas Sewe CLA 2017-03-09 09:30:51 EST
Hello JDT team,

we recently received an (automated) error report (for a closed source plugin)  with the following stack trace:

java.lang.NullPointerException: null
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getField(BinaryTypeBinding.java:1169)
    at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.buildRetentionAnnotation(AnnotationBinding.java:110)
    at org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.addStandardAnnotations(AnnotationBinding.java:71)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.retrieveAnnotations(BinaryTypeBinding.java:1530)
    at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.getAnnotations(ReferenceBinding.java:974)
    at org.eclipse.jdt.core.dom.TypeBinding.getAnnotations(TypeBinding.java:116)
    at com.codetrails.codesearch.utils.Bindings.a(Bindings.java:873)
    ...

The JDT version in question was 3.12.2.v20161124-1400 (for org.eclipse.jdt) and 3.12.2.v20161117-1814 (for org.eclipse.jdt.core), respectively, from the Neon.2 JEE EPP package.

All I can tell you beyond the above is that our code in Bindings.java calls IBinding.getAnnotations() on a binding that itself belongs to an *annotation* type.

From what I gather from skimming BinaryTypeBinding's code, it looks like BinaryTypeBinding.fields should not be null but rather Binding.NO_FIELDS, so I think this is a bug in JDT -- alas, without exact steps to reproduce. :-(

I hope this still helps you out.
Comment 1 Eclipse Genie CLA 2020-05-14 03:37:32 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.