-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
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:
- It did not have proper filter for
.presence in descriptor strings. So strings likeLjava.lang.Object;were erroneously accepted. - Invalid descriptors like L; or L/Missing; would result in
TypeNotPresentExceptioninstead ofGenericSignatureFormatErroras before. - Using field type in the NameAndType for
EnclosingMethodattribute would result in a spuriousIllegalArgumentExceptionin method descriptor parsing. This was previouslyGenericSignatureFormatError.
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.
- csr of
-
JDK-8370976 Review the behavioral changes of core reflection descriptor parsing migration
-
- Resolved
-
- relates to
-
JDK-8371589 Migrate descriptor parsing from generics to BytecodeDescriptor
-
- Closed
-