Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7183985 (ann) Class.getAnnotation() throws an ArrayStoreException when the annotation class not present
  3. JDK-8209742

Release Note: Method Class::getAnnotation Throws a TypeNotPresentException When the Annotation Class Is Not Present

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P3
    • Resolution: Delivered
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: core-libs
    • Subcomponent:
    • Verification:
      Verified

      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.

        Attachments

          Activity

            People

            • Assignee:
              cushon Liam Miller-Cushon
              Reporter:
              cushon Liam Miller-Cushon
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: