Re: Strange ServiceLoader issue with Surefire and JDK 21 bytecode

2023-10-17 Thread Mark Raynsford
On 2023-10-16T13:59:05 +0200
Romain Manni-Bucau  wrote:

> Yes, this is the one I had in mind, think it comes from plexus transitive
> deps.

For reference:

  

  

  org.apache.maven.plugins
  maven-surefire-plugin
  3.1.2
  

  org.ow2.asm
  asm
  9.6

  

  

  

... does indeed fix the problem. Thanks!

-- 
Mark Raynsford | https://www.io7m.com



pgpIs_MHRxpyT.pgp
Description: OpenPGP digital signature


Re: Strange ServiceLoader issue with Surefire and JDK 21 bytecode

2023-10-16 Thread Romain Manni-Bucau
Yes, this is the one I had in mind, think it comes from plexus transitive
deps.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le lun. 16 oct. 2023 à 12:48, Mark Raynsford 
a écrit :

> On 2023-10-16T08:14:40 +0200
> Romain Manni-Bucau  wrote:
>
> > Hi,
> >
> > Didn't check in details but it can be the bytecode reader version we have
> > today in surefire is too old to read java 21 bytecode so it does not put
> > your module on module path but classpath so then, without
> > META-INF/services/x file it is not detected.
> >
>
> That does sound likely.
>
> Would this be asm? I had a brief look through the surefire sources but
> didn't see it. I've more than once had to temporarily override asm for
> various plugins when targeting a new bytecode version.
>
> --
> Mark Raynsford | https://www.io7m.com
>
>


Re: Strange ServiceLoader issue with Surefire and JDK 21 bytecode

2023-10-16 Thread Mark Raynsford
On 2023-10-16T08:14:40 +0200
Romain Manni-Bucau  wrote:

> Hi,
> 
> Didn't check in details but it can be the bytecode reader version we have
> today in surefire is too old to read java 21 bytecode so it does not put
> your module on module path but classpath so then, without
> META-INF/services/x file it is not detected.
> 

That does sound likely.

Would this be asm? I had a brief look through the surefire sources but
didn't see it. I've more than once had to temporarily override asm for
various plugins when targeting a new bytecode version.

-- 
Mark Raynsford | https://www.io7m.com



pgp5tNf1tsUSV.pgp
Description: OpenPGP digital signature


Re: Strange ServiceLoader issue with Surefire and JDK 21 bytecode

2023-10-16 Thread Romain Manni-Bucau
Hi,

Didn't check in details but it can be the bytecode reader version we have
today in surefire is too old to read java 21 bytecode so it does not put
your module on module path but classpath so then, without
META-INF/services/x file it is not detected.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le dim. 15 oct. 2023 à 22:16, Mark Raynsford
 a écrit :

> Hello!
>
> I'm seeing test failures when javac produces JDK 21 bytecode as opposed
> to JDK 20 bytecode:
>
> https://github.com/io7m/surefire-20231015
>
> You'll need JDK 21.
>
> Essentially, `mvn package` will work, but `mvn
> -Dio7m.java.targetJavaVersion=21 package` will cause a test failure.
>
> The actual root symptom is that ServiceLoader.load() will return no
> implementations, even though three implementations are registered in
> the module descriptor. I don't know why this is a problem when the
> bytecode version is 65, but not a problem when the bytecode version is
> 64.
>
> The same tests work just fine in Intellij IDEA with any bytecode
> version set.
>
> Does anyone know what's going on here?
>
> --
> Mark Raynsford | https://www.io7m.com
>
>


Strange ServiceLoader issue with Surefire and JDK 21 bytecode

2023-10-15 Thread Mark Raynsford
Hello!

I'm seeing test failures when javac produces JDK 21 bytecode as opposed
to JDK 20 bytecode:

https://github.com/io7m/surefire-20231015

You'll need JDK 21.

Essentially, `mvn package` will work, but `mvn
-Dio7m.java.targetJavaVersion=21 package` will cause a test failure.

The actual root symptom is that ServiceLoader.load() will return no
implementations, even though three implementations are registered in
the module descriptor. I don't know why this is a problem when the
bytecode version is 65, but not a problem when the bytecode version is
64.

The same tests work just fine in Intellij IDEA with any bytecode
version set.

Does anyone know what's going on here?

-- 
Mark Raynsford | https://www.io7m.com



pgpbQI0Khleno.pgp
Description: OpenPGP digital signature