Integrated: 8315678: Classfile API ConstantPool::entryCount and ConstantPool::entryByIndex methods are confusing

Adam Sotona asotona at openjdk.org
Thu Sep 14 18:32:52 UTC 2023


On Tue, 5 Sep 2023 14:18:08 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: ca747f09
Author:    Adam Sotona <asotona at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ca747f09b67071938fb101ce61742c56305af341
Stats:     140 lines in 40 files changed: 70 ins; 20 del; 50 mod

8315678: Classfile API ConstantPool::entryCount and ConstantPool::entryByIndex methods are confusing

Reviewed-by: briangoetz

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

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


More information about the core-libs-dev mailing list