On Tue, 6 Sept 2022 at 04:42, Laird Nelson <[email protected]> wrote:
> On Mon, Sep 5, 2022 at 12:12 AM Benjamin Marwell <[email protected]> > wrote: > > > After discussing this with the maven team on slack, it does not really > > sound like you should have encountered. > > Can you give us a small reproducer project and/or post the > > exceptions/errors you see? > > > Sure; it should be very easy to reproduce, but I can tell you here exactly > what the error is and the root cause. > > If a module-info.class file is written with a class file version of 63 (JDK > 19) for any reason by any means, then when Plexus Java's LocationManager > goes to parse it using a BinaryModuleInfoParser ( > > https://github.com/codehaus-plexus/plexus-languages/blob/plexus-languages-1.1.1/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/BinaryModuleInfoParser.java > ), > the BinaryModuleInfoParser will use ASM 9.2 which does not support JDK 19. > It throws an unsupported class file major version exception. That happens > here: > > https://github.com/apache/maven-surefire/blob/surefire-3.0.0-M7/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1421 > > The exception is caught by the "catch Exception" block here: > > https://github.com/apache/maven-surefire/blob/surefire-3.0.0-M7/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1425-L1428 > > Instead of reporting the exception, this catch block swallows it and > constructs a ResolvePathResultWrapper with no (null) module descriptor. > From this point on, the whole apparatus thinks that the project is > non-modular. > > Updating the version of ASM to 9.3 means that JDK 19 is supported and > everything works fine. > sure ASM version need to be updated because they have some constants for new jdk version. I guess we were a bit surprised by this sentence " Sure; I'm using --add-exports jdk.compiler/com.sun.tools.javac.code=com.foo.mymodule and my module reads jdk.compiler. All of that is incompatible with --release. " we were thinking it was the cause of your problem > > Best, > Laird >
