JDK-8228988 : AnnotationParser throws NullPointerException on incompatible member type
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-08-01
  • Updated: 2025-01-24
  • Resolved: 2021-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b19Fixed
Related Reports
CSR :  
Relates :  
Description
The AnnotationParser throws a NullPointerException upon parsing an annotation member that is itself an annotation value where the annotation type is itself not defined as an annotation type during runtime. This should yield an IncompatibleClassChangeError. The exception occurs due to "parseAnnotation2" returning null upon encountering an incompatible value. The calling code does however not check for this condition and attempts the generation of a proxy for the incompatible annotation of the value's result by calling result.getClass() what yields that exception.

The null pointer indicates that the value itself cannot be described as an annotation value such that the proxy should be built on the annotation property type.

Comments
Changeset: f47faf28 Author: Rafael Winterhalter <winterhalter@openjdk.org> Committer: Joe Darcy <darcy@openjdk.org> Date: 2021-04-20 21:33:19 +0000 URL: https://git.openjdk.java.net/jdk/commit/f47faf28
20-04-2021

Review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2019-August/061651.html
06-08-2019