New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easymock is not compatible with JDK 22 #547
Comments
Blocks apache/shiro#1381 |
@henri-tremblay Any ideas please? |
Get the same error testing EasyMock 5.2.0 with JDK 22 or 22.0.1.
It is similar to raphw/byte-buddy#1609. Tried to use the latest byte-buddy/byte-buddy-agent 1.14.14 and unfortunately it doesn't work for EasyMock. <version.bytebuddy>1.14.14</version.bytebuddy>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${version.bytebuddy}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>${version.bytebuddy}</version>
<scope>test</scope>
</dependency> It seems that EasyMock is copy bytebuddy codes into the EasyMock bundle?
public static ClassFileVersion latest() {
return ClassFileVersion.JAVA_V21;
}
public static ClassReader of(byte[] binaryRepresentation) {
ClassFileVersion classFileVersion = ClassFileVersion.ofClassFile(binaryRepresentation), latest = ClassFileVersion.latest();
if (classFileVersion.isGreaterThan(latest)) {
if (EXPERIMENTAL) {
binaryRepresentation[6] = (byte) (latest.getMajorVersion() >>> 8);
binaryRepresentation[7] = (byte) latest.getMajorVersion();
ClassReader classReader = new ClassReader(binaryRepresentation);
binaryRepresentation[6] = (byte) (classFileVersion.getMajorVersion() >>> 8);
binaryRepresentation[7] = (byte) classFileVersion.getMajorVersion();
return classReader;
} else {
throw new IllegalArgumentException(classFileVersion
+ " is not supported by the current version of Byte Buddy which officially supports " + latest
+ " - update Byte Buddy or set " + EXPERIMENTAL_PROPERTY + " as a VM property");
}
} else {
return new ClassReader(binaryRepresentation);
}
} From my view, there is no workaround except set the system property org.easymock.bytebuddy.experimental=true. But it looks not very good. |
I will ASAP. I am shading ByteBuddy and ASM because previously, not shading Cglib and ASM was causing a lot of headaches from people using the wrong version. But these frameworks are quite stable now so I probably can remove the shading. |
Hi,
Just want to let you know that EasyMock tests are not working with JDK 22.
Most likely, the shaded bytebuddy (and asm?) needs to be upgraded.
Thank you
The text was updated successfully, but these errors were encountered: