On Thu, 14 Sep 2023 16:38:36 GMT, Brian Goetz <briango...@openjdk.org> wrote:
>> Adam Sotona has updated the pull request incrementally with one additional >> commit since the last revision: >> >> applied suggested changes from review > > src/java.base/share/classes/jdk/internal/classfile/ClassReader.java line 184: > >> 182: */ >> 183: ConstantValueEntry readConstantValueEntry(int offset); >> 184: > > I'm not sure that all this additional API surface carries its weight in > ClassReader, when each of these methods just called readEntry() and casts to > the desired type? I can see two alternate ways here: > > - Ordinary casts at the use site (worse error handling, but ultimately the > same result), or > - A single method > > <T extends ConstantPoolEntry> T readEntry(int pos, Class<T> t) We need at least `<T extends PoolEntry> T readEntry(int pos, Class<T> t)` to throw `ConstantPoolException` instead of `ClassCastException` from broken entries. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/11411#discussion_r1326453583