RFR: 8294982: Implementation of Classfile API [v31]

Paul Sandoz psandoz at openjdk.org
Wed Mar 1 23:02:38 UTC 2023


On Wed, 1 Mar 2023 15:00:41 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> This is root pull request with Classfile API implementation, tests and benchmarks initial drop into JDK.
>> 
>> Following pull requests consolidating JDK class files parsing, generating, and transforming ([JDK-8294957](https://bugs.openjdk.org/browse/JDK-8294957)) will chain to this one.
>> 
>> Classfile API development is tracked at:
>> https://github.com/openjdk/jdk-sandbox/tree/classfile-api-branch
>> 
>> Development branch of consolidated JDK class files parsing, generating, and transforming is at:
>> https://github.com/openjdk/jdk-sandbox/tree/classfile-api-dev-branch
>> 
>> Classfile API [JEP](https://bugs.openjdk.org/browse/JDK-8280389) and [online API documentation](https://htmlpreview.github.io/?https://raw.githubusercontent.com/openjdk/jdk-sandbox/classfile-api-javadoc-branch/doc/classfile-api/javadoc/java.base/jdk/internal/classfile/package-summary.html) is also available.
>> 
>> Please take you time to review this non-trivial JDK addition.
>> 
>> Thank you,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with four additional commits since the last revision:
> 
>  - renamed all remaining ConcreteXyzEntry to XyzEntryImpl
>  - abstract implementations of RefEntry, RefsEntry and NamedEntry renamed to AbstractRefEntry, AbstractRefsEntry and AbstractNamedEntry
>  - renamed ConcreteBootstrapMethodEntry to BootstrapMethodEntryImpl
>  - ConcreteEntry renamed to AbstractPoolEntry

src/java.base/share/classes/jdk/internal/classfile/ClassReader.java line 270:

> 268:                     int classReaderOffset,
> 269:                     int length);
> 270:     }

Suggestion:

}

src/java.base/share/classes/jdk/internal/classfile/impl/ClassReaderImpl.java line 90:

> 88:     private BootstrapMethodsAttribute bootstrapMethodsAttribute;
> 89: 
> 90:     @SuppressWarnings("unchecked")

Is this needed?

src/java.base/share/classes/jdk/internal/classfile/impl/ClassReaderImpl.java line 115:

> 113: 
> 114:                 // 4
> 115:                 case TAG_CONSTANTDYNAMIC, TAG_FIELDREF, TAG_FLOAT, TAG_INTEGER, TAG_INTERFACEMETHODREF, TAG_INVOKEDYNAMIC, TAG_METHODREF, TAG_NAMEANDTYPE -> p += 4;

Break the line

src/java.base/share/classes/jdk/internal/classfile/impl/ClassReaderImpl.java line 132:

> 130:         this.cp = new PoolEntry[constantPoolCount];
> 131: 
> 132:         p = metadataStart;

Redundant assignment (see line 127).

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

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



More information about the build-dev mailing list