You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build sources, but JDT Core throws an exception:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2010)
at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1969)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.reportDeprecatedType(TypeReference.java:589)
at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:152)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:526)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:629)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:625)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:2676)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:1551)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:1518)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:1114)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:608)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:897)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1122)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:739)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1049)
For the following test sources (save it to a directory and change the ROOT variable):
1.
Reproduced on master. This happens only when there's a @Deprecated and an unresolved annotation in the mix and the unresolved one precedes the @Deprecated. The unresolved annotation returns null when asked getCompilerAnnotation(). But I think it's okay, looking at ASTNode#copySE8AnnotationsToType(), line number 1160. The simplest fix would be to do a null check inside ProblemReporter.deprecatedSinceValue().
jarthana
changed the title
JDT Core throws NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
JDT Core throws NPE: Cannot invoke "AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
May 10, 2024
jarthana
added a commit
to jarthana/eclipse.jdt.core
that referenced
this issue
May 10, 2024
Hello,
I'm trying to build sources, but JDT Core throws an exception:
For the following test sources (save it to a directory and change the
ROOT
variable):1.
I use the following code to parse it using JDT Core:
The text was updated successfully, but these errors were encountered: