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.

Best,
Laird

Reply via email to