Hi,
Since JDK21 just entered RampDown Phase One and we want to switch to JDK21 ASAP after release, I tried building our project with OpenJDK 21 EA and ran into some failing EasyMock-based unit tests (tests were mocking classes).
The exact Java version I'm using (on Linux) is
openjdk version "21-ea" 2023-09-19
OpenJDK Runtime Environment (build 21-ea+26-2328)
OpenJDK 64-Bit Server VM (build 21-ea+26-2328, mixed mode, sharing)
The exception I got during test execution was something along the lines of
Caused by: java.lang.IllegalArgumentException: com.ourpackage.SomeClass$$$EasyMock$2 must be defined in the same package as org.easymock.internal.ClassProxyFactory
at org.easymock.bytebuddy.dynamic.loading.ClassInjector$UsingLookup.injectRaw(ClassInjector.java:1635)
at org.easymock.bytebuddy.dynamic.loading.ClassInjector$AbstractBase.inject(ClassInjector.java:118)
at org.easymock.bytebuddy.dynamic.loading.ClassLoadingStrategy$UsingLookup.load(ClassLoadingStrategy.java:519)
at org.easymock.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:101)
at org.easymock.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:6317)
at org.easymock.internal.ClassProxyFactory.lambda$createProxy$0(ClassProxyFactory.java:146)
at org.easymock.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
... 75 more
Checking the 'easymock-5.1.0' tag on the GitHub bytebuddy repo I saw that easymock includes a shaded version of bytebuddy 1.12.20 while the latest available release of bytebuddy is 1.14.5.
I then checked out master/HEAD of EasyMock (which is using the latest bytebuddy version 1.14.5. ) and tried to build the project using OpenJDK 21 EA but unfortunately unit test execution fails on ./test-nodeps/src/test/java/org/itests/NoDepsTest.java with the following error
Caused by: java.lang.IncompatibleClassChangeError: class org.easymock.mocks.CharBuffer$$$EasyMock$1 cannot inherit from sealed class java.nio.CharBuffer
at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method)
at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1330)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.easymock.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$Enabled.defineClass(ClassInjector.java:2049)
... 54 more
Hi,
Since JDK21 just entered RampDown Phase One and we want to switch to JDK21 ASAP after release, I tried building our project with OpenJDK 21 EA and ran into some failing EasyMock-based unit tests (tests were mocking classes).
The exact Java version I'm using (on Linux) is
The exception I got during test execution was something along the lines of
Checking the 'easymock-5.1.0' tag on the GitHub bytebuddy repo I saw that easymock includes a shaded version of bytebuddy 1.12.20 while the latest available release of bytebuddy is 1.14.5.
I then checked out master/HEAD of EasyMock (which is using the latest bytebuddy version 1.14.5. ) and tried to build the project using OpenJDK 21 EA but unfortunately unit test execution fails on ./test-nodeps/src/test/java/org/itests/NoDepsTest.java with the following error