JDK-8331744 : java.lang.classfile.TypeKind improvements
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang.classfile
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-05-06
  • Updated: 2024-05-16
  • Resolved: 2024-05-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b23Fixed
Related Reports
CSR :  
Description
java.lang.classfile.TypeKind has a few problems:
1. inconsistent method names newarraycode() and fromNewArrayCode(int)
2. fromDescriptor(String) can throw IndexOutOfBoundsException instead of always throwing IllegalArgumentException
3. from(TypeDescriptor.OfField) is slow for Class objects for reference types.

Proposed improvements:
1. Rename the methods to newarrayCode and fromNewarrayCode, `newarray` is a bytecode name and is a word like `invokestatic`.
2. Change fromDescriptor to throw IAE for 0-length input Strings
3. Update implementation to speed up from() when provided a Class object
Comments
Changeset: 784b8fce Author: Chen Liang <liach@openjdk.org> Committer: Claes Redestad <redestad@openjdk.org> Date: 2024-05-10 10:50:51 +0000 URL: https://git.openjdk.org/jdk/commit/784b8fce7a1b05209a8db168c8d2f86484a1a817
10-05-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19109 Date: 2024-05-06 20:48:05 +0000
06-05-2024