RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v21]

Chen Liang liach at openjdk.org
Wed Jun 21 08:10:17 UTC 2023


On Thu, 15 Jun 2023 17:22:32 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html
>> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   ClassfileBenchmark::transformWithNewMaps changed to transformWithAddedNOP

src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 57:

> 55: 
> 56:     /**
> 57:      * {@return a new context with default options}

Suggestion:

     * {@return a context with default options}

src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 272:

> 270:     /**
> 271:      * Build a classfile into a file using the provided constant pool
> 272:      * builder (which encapsulates classfile processing options.)

The CP is now simply a data holder; it no longer holds the processing options. Same update is needed for the other few build methods taking a CP instance.
Suggestion:

     * builder.

src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 340:

> 338:      *
> 339:      * @implNote
> 340:      * <p>This method behaves as if:

Suggestion:

     * This method behaves as if:

Redundant break

src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 343:

> 341:      * {@snippet lang=java :
> 342:      *     Classfile.of().build(thisClass(), ConstantPoolBuilder.of(this),
> 343:      *                     b -> b.transform(this, transform));

Suggestion:

     *     this.build(model.thisClass(), ConstantPoolBuilder.of(model),
     *                     b -> b.transform(model, transform));

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1236575941
PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1236572387
PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1236548304
PR Review Comment: https://git.openjdk.org/jdk/pull/14180#discussion_r1236570476


More information about the core-libs-dev mailing list