eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.27k stars 719 forks source link

MockitoMockTest doesn't run on jdk23 yet - Java 23 (67) is not supported by the current version of Byte Buddy #19354

Open pshipton opened 4 months ago

pshipton commented 4 months ago

https://openj9-jenkins.osuosl.org/job/Grinder_testList_0/294 amac jdk23 extended.functional testing on

16:24:21  OpenJDK Runtime Environment (build 23-internal-adhoc.jenkins.BuildJDKnextaarch64macOpenJDK)
16:24:21  Eclipse OpenJ9 VM (build master-7f82a7d9d55, JRE 23 Mac OS X aarch64-64-Bit 20240419_304 (JIT enabled, AOT enabled)
16:24:21  OpenJ9   - 7f82a7d9d55
16:24:21  OMR      - 9083c8237ac
16:24:21  JCL      - 835a7f8fa78 based on jdk-23+18)

MockitoMockTest_0

16:51:12  Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [interface java.util.List, class java.lang.Object, interface java.util.Collection, class java.util.ArrayList, interface java.util.SequencedCollection, interface java.util.RandomAccess, class java.util.AbstractCollection, interface java.lang.Iterable, interface java.io.Serializable, interface java.lang.Cloneable, class java.util.AbstractList]
16:51:12    at test.java.MockitoMockTest.main(MockitoMockTest.java:22)
16:51:12  Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all classes [interface java.util.List, class java.lang.Object, interface java.util.Collection, class java.util.ArrayList, interface java.util.SequencedCollection, interface java.util.RandomAccess, class java.util.AbstractCollection, interface java.lang.Iterable, interface java.io.Serializable, interface java.lang.Cloneable, class java.util.AbstractList]
16:51:12    at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
16:51:12    at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
16:51:12    at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
16:51:12    at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
16:51:12    ... 1 more
16:51:12  Caused by: java.lang.IllegalStateException: 
16:51:12  Byte Buddy could not instrument all classes within the mock's type hierarchy
16:51:12  
16:51:12  This problem should never occur for javac-compiled classes. This problem has been observed for classes that are:
16:51:12   - Compiled by older versions of scalac
16:51:12   - Classes that are part of the Android distribution
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:285)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:218)
16:51:12    at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:78)
16:51:12    at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
16:51:12    at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
16:51:12    at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
16:51:12    at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
16:51:12    at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:75)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:414)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:373)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:352)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.createMock(InlineByteBuddyMockMaker.java:56)
16:51:12    at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:99)
16:51:12    at org.mockito.internal.MockitoCore.mock(MockitoCore.java:84)
16:51:12    at org.mockito.Mockito.mock(Mockito.java:2104)
16:51:12    at org.mockito.Mockito.mock(Mockito.java:2019)
16:51:12    ... 1 more
16:51:12  Caused by: java.lang.IllegalArgumentException: Java 23 (67) is not supported by the current version of Byte Buddy which officially supports Java 22 (66) - update Byte Buddy or set net.bytebuddy.experimental as a VM property
16:51:12    at net.bytebuddy.utility.OpenedClassReader.of(OpenedClassReader.java:100)
16:51:12    at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining.create(TypeWriter.java:4011)
16:51:12    at net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:2224)
16:51:12    at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$UsingTypeWriter.make(DynamicType.java:4055)
16:51:12    at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3739)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.transform(InlineBytecodeGenerator.java:402)
16:51:12    at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:242)
16:51:12    at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
16:51:12    at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:610)
16:51:12    at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
16:51:12    at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:225)
16:51:12    at org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:281)
16:51:12    ... 16 more
pshipton commented 4 months ago

Excluding for jdk23+ via https://github.com/adoptium/aqa-tests/pull/5252

babsingh commented 3 months ago

@sophiaxu0424 @LongyuZhang @llxia

llxia commented 3 months ago

We are using byte-buddy-1.14.12.jar https://github.com/adoptium/TKG/blob/master/scripts/getDependencies.pl#L78 We can try with the latest version 1.14.15 (https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy/1.14.15) to see if this version works with JDK23.

sophiaxu0424 commented 3 months ago

Hi @llxia I am checking on using the latest version of byte-buddy for testing mockitoMockTest on JDK 23. wondering if you have a jdk url link that is working, the above Grinder link has expired and not able to find the jdk version. TIA!

llxia commented 3 months ago

wondering if you have a jdk url link that is working,

see CUSTOMIZED_SDK_URL in https://openj9-jenkins.osuosl.org/job/Test_openjdknext_j9_sanity.openjdk_x86-64_linux_Nightly/6/

sophiaxu0424 commented 3 months ago

Tried the latest byte-buddy version, and still mockito test failed,

13:57:05  Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [class java.util.ArrayList, class java.lang.Object, class java.util.AbstractList, interface java.lang.Iterable, interface java.lang.Cloneable, class java.util.AbstractCollection, interface java.io.Serializable, interface java.util.List, interface java.util.Collection, interface java.util.RandomAccess, interface java.util.SequencedCollection]
13:57:05    at test.java.MockitoMockTest.main(MockitoMockTest.java:22)
13:57:05  Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all classes [class java.util.ArrayList, class java.lang.Object, class java.util.AbstractList, interface java.lang.Iterable, interface java.lang.Cloneable, class java.util.AbstractCollection, interface java.io.Serializable, interface java.util.List, interface java.util.Collection, interface java.util.RandomAccess, interface java.util.SequencedCollection]
13:57:05    at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
13:57:05    at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
13:57:05    at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
13:57:05    at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
13:57:05    ... 1 more
13:57:05  Caused by: java.lang.IllegalStateException: 
13:57:05  Byte Buddy could not instrument all classes within the mock's type hierarchy

More error information could be found here in Grinder: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/40765/console

JDK version

13:55:52  =JAVA VERSION OUTPUT BEGIN=
13:55:52  openjdk version "23-internal" 2024-09-17
13:55:52  OpenJDK Runtime Environment (build 23-internal-adhoc.jenkins.BuildJDKnextx86-64linuxPersonal)
13:55:52  Eclipse OpenJ9 VM (build master-6e1e36f06c9, JRE 23 Linux amd64-64-Bit Compressed References 20240502_1486 (JIT enabled, AOT enabled)
13:55:52  OpenJ9   - 6e1e36f06c9
13:55:52  OMR      - acd6f7e0b0c
13:55:52  JCL      - 604bc7a1731 based on jdk-23+20)
tajila commented 4 weeks ago

@sophiaxu0424 Do you know if there has been a recent update to bytebuddy