-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
None
ConstantPool.entryByIndex and ClassReader.readEntryOrNull are frequently used with their results casted, meaning that only a specific type of entry is expected; these code will throw ClassCastException instead of IllegalArgumentException as mandated by ClassFile API. We should add type-specific versions of these API like ClassReader.readEntry, so that they can throw the right type of exceptions and users can avoid ugly casts.
In addition, ClassReader.utf8EntryByIndex can be replaced by this type-checked entryByIndex in ConstantPool.
The API addition patch will migrate existing code that's benefitted by the new APIs.
In addition, ClassReader.utf8EntryByIndex can be replaced by this type-checked entryByIndex in ConstantPool.
The API addition patch will migrate existing code that's benefitted by the new APIs.
- csr for
-
JDK-8332616 Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull
-
- Closed
-
- links to
-
Commit openjdk/jdk/f608918d
-
Review(master) openjdk/jdk/19330