On Thu, 2 Mar 2023 14:31:06 GMT, Adam Sotona <asot...@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 one additional 
> commit since the last revision:
> 
>   StackMapFrameInfo extracted to top level from StackMapTableAttribute

src/java.base/share/classes/jdk/internal/classfile/CodeBuilder.java line 165:

> 163:      * @return this builder
> 164:      */
> 165:     default CodeBuilder transforming(CodeTransform transform, 
> Consumer<CodeBuilder> handler) {

The functionality of this method, `transforming`, and 
`ClassfileBuilder::transform`, are in effect equivalent in their transforming: 
adding the results of transformed code to the builder. They differ in the 
source of code elements.

The latter's behaviour can be implemented using the former, with a  consumer 
that passes all elements of a code model to the builder e.g. `builder -> 
model.forEach(builder::with)`.

The difference in naming initially confused me. To me this suggests the method 
names should be the same? (perhaps with the transformer being consistently the 
last argument?).

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

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

Reply via email to