RFR: 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull

Chen Liang liach at openjdk.org
Tue May 21 14:38:08 UTC 2024


I propose to add type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull taking an extra Class parameter, which throws ConstantPoolException instead of ClassCastException on type mismatch, which can happen to malformed ClassFiles.

Requesting a review from @asotona. Thanks!

Proposal on mailing list: https://mail.openjdk.org/pipermail/classfile-api-dev/2024-May/000512.html

-------------

Commit messages:
 - 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull

Changes: https://git.openjdk.org/jdk/pull/19330/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19330&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8332614
  Stats: 183 lines in 14 files changed: 103 ins; 30 del; 50 mod
  Patch: https://git.openjdk.org/jdk/pull/19330.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19330/head:pull/19330

PR: https://git.openjdk.org/jdk/pull/19330


More information about the core-libs-dev mailing list