RFR: 8315678: Classfile API ConstantPool::entryCount and ConstantPool::entryByIndex methods are confusing [v3]

Adam Sotona asotona at openjdk.org
Fri Sep 8 10:27:28 UTC 2023


> Classfile API `ConstantPool::entryCount` and `ConstantPool::entryByIndex` methods are confusing and unsafe to use without knowledge of constant pool specification.
> This patch renames `ConstantPool::entryCount` to `ConstantPool::size` and adds checks to `ConstantPool::entryByIndex` for invalid or unusable indexes.
> `ConstantPool` newly extends `Iterable<PoolEntry>` for simplified user iteration over all pool entries.
> Range checks for invalid index have been added also to `ConstantPoo::bootstrapMethodEntry` methods and several `@jvms` javadoc tags have been added to pool entries.
> 
> Please review.
> 
> Thanks,
> Adam

Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - fixed javac tests
 - Merge branch 'master' into JDK-8315678-cp-iterable
 - fixed tests
 - 8315678: Classfile API ConstantPool::entryCount and ConstantPool::entryByIndex is confusing

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15567/files
  - new: https://git.openjdk.org/jdk/pull/15567/files/38406b28..583b0315

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15567&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15567&range=01-02

  Stats: 10641 lines in 417 files changed: 5586 ins; 2491 del; 2564 mod
  Patch: https://git.openjdk.org/jdk/pull/15567.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15567/head:pull/15567

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


More information about the core-libs-dev mailing list