JDK-8209742 : Release Note: Method Class::getAnnotation Throws a TypeNotPresentException When the Annotation Class Is Not Present
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2018-08-20
  • Updated: 2019-04-09
  • Resolved: 2018-08-22
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 11
11Resolved
Description
When `java.lang.Class::getAnnotation` is called to retrieve an annotation, and the annotation has an array value that references a missing class, attempting to read that value results in a `java.lang.TypeNotPresentException`.

In previous releases the call to `Class::getAnnotation` incorrectly resulted in a `java.lang.ArrayStoreException`. Any programs that explicitly handled that exception should be updated to handle `java.lang.TypeNotPresentException` instead.