Skip to content

Parse module descriptors with the Class File API on Java 24+ - #244

Open
slachiewicz wants to merge 3 commits into
masterfrom
agent/classfile-api-mr-layer
Open

slachiewicz wants to merge 3 commits into
masterfrom
agent/classfile-api-mr-layer

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Adds a src/main/java24 multi-release layer whose BinaryModuleInfoParser reads module-info.class with java.lang.classfile. On a JDK 24+ runtime it is also used when a toolchain jdkHome is set; Java 8 keeps ASM, Java 9–23 keep ModuleDescriptor.read and ASM for toolchains. ClassFile.parse rejects class files newer than the running JDK, so the layer clamps the major version the same way AsmModuleInfoParser does since #239.

One of two alternatives for #165, for comparison with #242, which removes ASM instead. Trade-offs of this one:

  • ASM stays a dependency, because Java 8–23 still need it.
  • Releases must be built on JDK 24+: the plexus-release enforcer rule now requires it, since a build on an older JDK silently omits the versions/24 layer.
  • Main code: +171 lines; the new ITs only run on JDK 24+.

Includes the CI commit from #243 so the JDK 26, 27 and 28-ea legs exercise the layer.

Spotless is skipped on JDK 27+ until palantir-java-format runs there
(palantir/palantir-java-format#1785); drop the profile once it does.
@slachiewicz slachiewicz added the enhancement New feature or request label Sep 26, 2026
Without it a release silently lacks the META-INF/versions/24 layer.
@slachiewicz
slachiewicz marked this pull request as ready for review September 26, 2026 07:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant