RFR: 8228988: AnnotationParser throws NullPointerException on incompatible member type

Rafael Winterhalter winterhalter at openjdk.java.net
Fri Feb 5 21:29:59 UTC 2021


When a class is compiled against a version of an annotation that is later loaded in an incompatible manner where an enum-typed member is changed into an annotation or vice versa, the reflection API currently throws a `NullPointerException` upon accessing the member. Instead an `AnnotationTypeMismatchException` should be thrown.

This change adjusts the parsing to trigger the correct exception.

-------------

Commit messages:
 - 8228988: AnnotationParser throws NullPointerException on incompatible member type

Changes: https://git.openjdk.java.net/jdk/pull/2439/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2439&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8228988
  Stats: 182 lines in 3 files changed: 178 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2439.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2439/head:pull/2439

PR: https://git.openjdk.java.net/jdk/pull/2439


More information about the core-libs-dev mailing list