-
Type:
CSR
-
Resolution: Unresolved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
behavioral
-
low
-
-
Java API
-
Implementation
Summary
Migrate the field and method descriptor parsing from the generic signature parser to the descriptor parser used by java.lang.invoke package.
Problem
The existing generic signature parser is currently in minimal maintenance, and will likely retire when new signature format is introduced.
The generic parser is also unaware of the difference between descriptor strings and generic signatures:
Ljava/util/Optional<*>;is the class or interfacejava.util.Optionalwith a wildcard type argument in generics; it is a class or interface with the simple nameOptional<?>in descriptors.TT;is a type variable namedTin generics; this is not a valid descriptor string.L<Stuff>;is not valid in generics; this is a class or interface named<Stuff>in descriptors.
Solution
Migrate to the descriptor parser used by java.lang.invoke, which is widely tested and maintained and largely behaviorally compatible, and is better for dedicated descriptor parsing.
They both throw TypeNotPresentException for valid class or interface names that are not present; the IllegalArgumentException thrown by the descriptor parser can be converted back to a GenericSignatureFormatError as thrown by the existing generic parser.
Specification
None. This is purely behavioral.
There are some significant behavioral changes:
- Some valid generic signature strings like
TT;that causedClassCastExceptionare now rejected with aGenericSignatureFormatError; - Some valid generic signature strings like
Ljava/util/Optional<*>;that causedClassCastExceptionare now accepted but may causeTypeNotPresentException; - Some invalid generic signature stirngs like
L<Stuff>;that causedGenericSignatureFormatErrorare now accepted but may causeTypeNotPresentException; - Some valid generic signature strings like
Ljava/lang/Object<*>;that causedMalformedParameterizedTypeExceptionare now accepted but may causeTypeNotPresentException.
- csr of
-
JDK-8356022 Migrate descriptor parsing from generics to BytecodeDescriptor
-
- Resolved
-
- relates to
-
JDK-8368980 Review the behavioral changes of core reflection descriptor parsing migration
-
- Proposed
-