RFR: 8313422: test/langtools/tools/javac 147 test classes uses com.sun.tools.classfile library
Qing Xiao
duke at openjdk.org
Wed Sep 6 15:44:44 UTC 2023
On Wed, 9 Aug 2023 09:30:22 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> There are 147 tests to convert to the new Class-File API.
>
> test/langtools/tools/javac/modules/OpenModulesTest.java line 257:
>
>> 255: }
>> 256: classBuilder.with(newModule);
>> 257: });
>
> FYI: this pattern can replaced with:
>
> Classfile.of().transform(miClass, ClassTransform.dropping(ce -> ce instanceof ModuleAttribute).andThen(ClassTransform.endHandler(classBuilder -> classBuilder.with(newModule))));
>
> Positive impact is re-used constant pool from the original classfile and so other attributes are not expanded. However we are missing `Classfile::transformTo` method in the API.
You are right. Will update in the next commit.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15112#discussion_r1290240010
More information about the compiler-dev
mailing list