Review the behavioral changes of core reflection descriptor parsing migration

XMLWordPrintable

    • Type: CSR
    • Resolution: Approved
    • Priority: P4
    • 26
    • Component/s: core-libs
    • None
    • behavioral
    • minimal
    • The problematic change happened before a feature release, so the impact is minimal.
    • Java API
    • Implementation

      Summary

      Consistently throw GenericSignatureFormatError for invalid descriptor strings and TypeNotPresentException for a missing class or interface in the parsing workload used by Class::getEnclosing... methods and AnnotatedElement retrievals of annotation instances.

      Problem

      The previous migration of method and field descriptor parsing from generic signature parser to descriptor parser in java.lang.invoke had a few significant issues:

      1. It did not have proper filter for . presence in descriptor strings. So strings like Ljava.lang.Object; were erroneously accepted.
      2. Invalid descriptors like L; or L/Missing; would result in TypeNotPresentException instead of GenericSignatureFormatError as before.
      3. Using field type in the NameAndType for EnclosingMethod attribute would result in a spurious IllegalArgumentException in method descriptor parsing. This was previously GenericSignatureFormatError.

      This deviates from our goal for throwing GenericSignatureFormatError for all invalid descriptor strings, and throwing TypeNotPresentException for all missing classes or interfaces.

      Solution

      Correct these mistakes before they accidentally become program dependencies in the next feature release.

      Specification

      None. This is a purely implementation/behavioral change.

      The affects APIs getEnclosing... and AnnotatedElement have other kinds of exceptions arising from other failures other than descriptor string parsing. These behaviors are not affected.

            Assignee:
            Chen Liang
            Reporter:
            Chen Liang
            Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: