3

Java/Maven novice here, I'm trying to integrate EqualsVerifier into my code but am getting the following error

java.lang.AssertionError: EqualsVerifier found a problem in class com.me.MyClass.
-> Unsupported class file major version 61

As I understand it this means that I'm trying to load a JAR built for a different JDK than what I'm building with (17). How can I pull (or build) the JDK17 version of this dependency? My pom contains the following:

            <dependency>
                <groupId>nl.jqno.equalsverifier</groupId>
                <artifactId>equalsverifier</artifactId>
                <version>3.10.1</version>
                <scope>test</scope>
            </dependency>
Madden
  • 1,024
  • 1
  • 9
  • 27
  • EqualsVerifier appears to look at the byte code and does not support Java 17. Does it work if you use Java 11 or set the source level to 11 in the Pom? – Thorbjørn Ravn Andersen Sep 02 '22 at 18:43
  • Can you please show the full code of your test and the pom file because I'm running projects with JDK18 as well as EqualsVerifier (same version) which works fine... https://github.com/khmarbaise/kata-fraction ??? – khmarbaise Sep 02 '22 at 18:55
  • Creator of EqualsVerifier here. Class file version 61 refers to JDK 17, and EqualsVerifier 3.10.1 is actually built with JDK 17 (though it supports back to JDK 8). Is it possible that a different, older version of EqualsVerifier is also on the classpath? You can check this by running `mvn dependency:tree` on the command line. – jqno Sep 03 '22 at 07:28
  • 1
    @jqno That's exactly my assumption... – khmarbaise Sep 03 '22 at 11:40

1 Answers1

2

For me, it ended up being Redisson having forced an old version of byte-buddy to be loaded. Overriding with the proper one (which I found in https://mvnrepository.com/artifact/nl.jqno.equalsverifier/equalsverifier/3.12.3) fixed this.