-
Type:
CSR
-
Resolution: Unresolved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
behavioral
-
minimal
-
The problematic change happened before a release, so the impact is minimal.
-
Java API
-
Implementation
Summary
Correct some mishandling of method and field descriptor parsing from the last migration from generic parser to descriptor parser of java.lang.invoke.
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. (this would be aClassFormatErrorin hotspot) - Using field type in the NameAndType for
EnclosingMethodattribute would result in a spuriousIllegalArgumentExceptionin method descriptor parsing. (Hotspot validates NameAndType so all type strings must be valid field or method descriptor strings) This was previouslyGenericSignatureFormatError.
Solution
Fix these 3 omissions from the last migration. They now all cause GenericSignatureFormatError as before the migration.
In summary, the exceptions were thrown at the creation of annotation instances in AnnotatedElement methods, and Class::getEnclosingMethod, Class::getEnclosingConstructor, and Class::getEnclosingClass.
Annotation class value parsing exceptions currently include:
GenericSignatureFormatErrorcaused byIllegalArgumentException- for all descriptor format errorsTypeNotPresentException- for if the class cannot be found
Enclosing exceptions include: (hotspot verification ensures the descriptor is a field or method descriptor, otherwise class loading fails and no Class instance is available)
- class resolution error as in JVMS 5.4.3.1 if the enclosing class cannot be resolved
GenericSignatureFormatErrorcaused byIllegalArgumentException- if the descriptor is a field descriptorTypeNotPresentException- for if a class in the descriptor cannot be foundInternalError- if the nominal information indicates method/constructor as the reflective API (null otherwise), but the nominal info does not point to an existent method/constructor
There is no scenario in which the old parsing succeeds but the new parsing fail.
Specification
None. This is a purely implementation/behavioral change.
- csr of
-
JDK-8370976 Review the behavioral changes of core reflection descriptor parsing migration
-
- In Progress
-
- relates to
-
JDK-8371589 Migrate descriptor parsing from generics to BytecodeDescriptor
-
- Closed
-