maven-compiler-plugin icon indicating copy to clipboard operation
maven-compiler-plugin copied to clipboard

Migrate from ASM to ClassFile API (JEP 484)

Open cowwoc opened this issue 3 months ago • 1 comments

New feature, improvement proposal

JDK 24+ includes JEP 484 which won't break (as ASM does) with every JDK release.

Consider using this API when JDK 24+ is used to avoid having to update ASM every time a new JDK version is released.

cowwoc avatar Sep 19 '25 16:09 cowwoc

Yes, we already thought about that, but it cannot be applied to the issues described in #960 and #961. The code using ASM is trying to fix an issue that exists only when a project is compiled with a Java version older than 22, and the ClassFile API was not available in those versions. Therefore, the module-info.class file can only be patched with ASM. In Java versions where the ClassFile API is available, there is currently nothing to patch.

However, the Maven 3.x compiler should detect when the Java version is 22 or older, and not try to patch module-info.class in such case. This is my understanding of #968.

desruisseaux avatar Sep 19 '25 22:09 desruisseaux