RFR: 8336585: BoundAttribute.readEntryList not type-safe

Chen Liang liach at openjdk.org
Wed Jul 17 20:56:53 UTC 2024


On Wed, 17 Jul 2024 20:51:32 GMT, Chen Liang <liach at openjdk.org> wrote:

> Qualify the reading of entry lists with the anticipated types up-front, so we throw the correct `ConstantPoolException` instead of `ClassCastException` when we encounter malformed attribute lists. (`ClassModel.getInterfaces` already behave correctly, in comparison)

test/jdk/jdk/classfile/BoundAttributeTest.java line 87:

> 85:             ((DirectClassBuilder) clb).writeAttribute(new UnboundAttribute.AdHocAttribute<>(Attributes.nestMembers()) {
> 86:                 @Override
> 87:                 public void writeBody(BufWriter b) {

Suggestion:

                public void writeBody(BufWriterImpl b) {

This is a conflict with #20205, whichever is integrated later should update this part.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20225#discussion_r1681721559


More information about the core-libs-dev mailing list