You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See https://bugs.openjdk.org/browse/JDK-8308754 , which means that as of that version this should be the preferred way to parse class files over ASM, i.e. introduce a src/main/java22 with the required code.
The text was updated successfully, but these errors were encountered:
The issue is that preview features require running with --enable-preview, so it should not be the preferred way until it's GA.
The bad news is that if you introduce src/main/java22, the classes will need to be compiled with --enable-preview (which is perfectly possible), but then every single run on Java 22 would require using --enable-preview at runtime and that might not be desirable (or might not be even possible on some scenarios), also using MRJAR, would mean that Java 23+ will break when you compile code that targets Java 22 (with --enable-preview) code with 22's compiler and try to run it with 23 you get an UnsupportedClassVersionError (preview features are not intended to be in production code).
Yet, there is some good news to actually start adopting the Class File API before its GA, but it requires introducing a dependency: https://github.com/Glavo/classfile, with this dependency is possible to use the Class File API even in Java 17, so one idea should be to actually introduce the dependency in src/main/java17 to use and test the Class File API (using org.glavo.classfile), and when the Class File API is finished introduce something like src/main/java25 and it will be just a swap of org.glavo.classfile to the new java.lang.classfile.
I agree that it should not be added as long as it's a preview feature, for the reasons you mention. Currently upgrading ASM is sufficient to support the latest Java version to read the module descriptor, so there's no real rush to implement this.
See https://bugs.openjdk.org/browse/JDK-8308754 , which means that as of that version this should be the preferred way to parse class files over ASM, i.e. introduce a
src/main/java22
with the required code.The text was updated successfully, but these errors were encountered: