0

I use GWT 2.9 and JUnit 4, but i'm looking into going up to 5 using the junit-vintage-engine.

However, gwt 2.9 has a requirement on ASM 7 but with Junit 4 this is not an issue. So i tried changing my jUnit dependency to

<groupId>org.junit.vintage</groupId
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.1</version>

Now, after trying to start Jetty in Intellij i get:

Java.lang.RuntimeException: Error scanning entry module-info.class from jar file:junit-vintage-engine-5.7.1.jar Caused by: java.lang.UnsupportedOperationException: This feature requires ASM6

I can't see where junit vintage has a dependency on ASM6, so i'm not sure what's wrong. Is there a way for me to sort this out? Pointers appreciated.

Frant
  • 5,382
  • 1
  • 16
  • 22
Mathias
  • 3,879
  • 5
  • 36
  • 48
  • 1
    It doesn’t say that junit vintage had a dependency do ASM6. It says that junit vintage has a module-info.class entry that *some other code* tries to parse using ASM. That other code doesn’t have a dependency to ASM6 but is trying to use an older API. – Holger Apr 20 '21 at 14:33
  • I understand that, but when i have junit 4 in my maven it works, when i have the vintage-engine, it stops working. It's the same jetty server, so i don't get it – Mathias Apr 21 '21 at 07:45
  • 1
    The most likely reason is that junit 4 doesn’t have a `module-info.class` entry that the other code can stumble over. – Holger Apr 21 '21 at 07:47
  • Aaah ok. I just don't get why it requires ASM6 when i have ASM7 on the path – Mathias Apr 21 '21 at 09:22
  • 1
    I explained it in [this answer](https://stackoverflow.com/a/63408495/2711488); some constructors of ASM’s classes require a constant telling which ASM version the subclass was developed against, to spot compatibility issues regarding new features. This is precisely what has been spotted here, the code using the ASM library has been developed with a version older than ASM6 (or not updated since then) hence doesn’t understand Java modules, but tries to parse a module-info. So you have to update the library which uses ASM to a newer version that understands modules (and tells ASM that it does). – Holger Apr 21 '21 at 09:33

1 Answers1

0

Disclaimer: I have never used Jetty or GWT before, just looked around a bit because I was curious about your question.

GWT-Dev 2.9.0 has a Jetty 9.2.14 dependency.

According to this source, upgrading to Jetty 9.4.8+ seems to help with JDK 9+ problems when trying to scan module-info classes in multi-release JARs for annotations:

When looking at the parent POM, ...

<properties>
  <jetty.version>9.2.14.v20151106</jetty.version>
  <asm.version>7.1</asm.version>
</properties>

... maybe it would be enough to just override the jetty.version property in your POM. If that is not enough, you might still try to dependency-manage the Jetty artifacts to 9.4.40.v20210413, 10.0.2, 11.0.2 or whatever seems appropriate to you and is API-compatible with GWT.

kriegaex
  • 63,017
  • 15
  • 111
  • 202