[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-5039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dávid Paksy updated ZOOKEEPER-5039:
-----------------------------------
    Description: 
As per the discussion on dev list:

Make JDK 17 the minimum runtime and compile versions for the master branch.

Make sure build, tests, spotbugs, checkstyle, etc works with both JDK 17 and 
JDK 25.

 

 

 

With the current 4.9.0 Mockito version tests are failing when JDK25 is used:
{noformat}
[ERROR] testACLDigestHashHiding_NoAuth_WorldCanRead  Time elapsed: 0.702 s  <<< 
ERROR!
org.mockito.exceptions.base.MockitoException: 

Mockito cannot mock this class: class org.apache.zookeeper.server.ZKDatabase.

If you're not sure why you're getting this error, please open an issue on 
GitHub.


Java               : 25
JVM vendor name    : Eclipse Adoptium
JVM vendor version : 25.0.2+10-LTS
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 25.0.2+10-LTS
JVM info           : mixed mode, sharing
OS name            : Linux
OS version         : 6.17.0-22-generic


You are seeing this disclaimer because Mockito is configured to create inlined 
mocks.
You can learn about inline mocks and their limitations under item #39 of the 
Mockito class javadoc.

Underlying exception : org.mockito.exceptions.base.MockitoException: Could not 
modify all classes [class org.apache.zookeeper.server.ZKDatabase, class 
java.lang.Object]
        at 
org.apache.zookeeper.server.FinalRequestProcessorTest.setUp(FinalRequestProcessorTest.java:67)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:565)
        at 
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)

...
Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all 
classes [class org.apache.zookeeper.server.ZKDatabase, class java.lang.Object]
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
        ... 68 more
Caused by: java.lang.IllegalStateException: 
Byte Buddy could not instrument all classes within the mock's type hierarchy

This problem should never occur for javac-compiled classes. This problem has 
been observed for classes that are:
 - Compiled by older versions of scalac
 - Classes that are part of the Android distribution
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:284)
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:217)
        at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:47)
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
        at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:40)
        at 
org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:396)
        at 
org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:355)
        at 
org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:334)
        at 
org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.createMock(InlineByteBuddyMockMaker.java:56)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:99)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:88)
        at org.mockito.Mockito.mock(Mockito.java:1998)
        at org.mockito.Mockito.mock(Mockito.java:1913)
        ... 68 more
Caused by: java.lang.IllegalArgumentException: Java 25 (69) is not supported by 
the current version of Byte Buddy which officially supports Java 19 (63) - 
update Byte Buddy or set net.bytebuddy.experimental as a VM property
        at net.bytebuddy.utility.OpenedClassReader.of(OpenedClassReader.java:96)
        at 
net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining.create(TypeWriter.java:4011)
        at 
net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:2224)
        at 
net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$UsingTypeWriter.make(DynamicType.java:4050)
        at 
net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3734)
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.transform(InlineBytecodeGenerator.java:401)
        at 
java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:257)
        at 
java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at 
java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:594)
        at 
java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native 
Method)
        at 
java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:221)
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:280)
        ... 83 more

{noformat}

  was:
With the current 4.9.0 Mockito version tests are failing when JDK25 is used

{noformat}

[ERROR] testACLDigestHashHiding_NoAuth_WorldCanRead  Time elapsed: 0.702 s  <<< 
ERROR!
org.mockito.exceptions.base.MockitoException: 

Mockito cannot mock this class: class org.apache.zookeeper.server.ZKDatabase.

If you're not sure why you're getting this error, please open an issue on 
GitHub.


Java               : 25
JVM vendor name    : Eclipse Adoptium
JVM vendor version : 25.0.2+10-LTS
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 25.0.2+10-LTS
JVM info           : mixed mode, sharing
OS name            : Linux
OS version         : 6.17.0-22-generic


You are seeing this disclaimer because Mockito is configured to create inlined 
mocks.
You can learn about inline mocks and their limitations under item #39 of the 
Mockito class javadoc.

Underlying exception : org.mockito.exceptions.base.MockitoException: Could not 
modify all classes [class org.apache.zookeeper.server.ZKDatabase, class 
java.lang.Object]
        at 
org.apache.zookeeper.server.FinalRequestProcessorTest.setUp(FinalRequestProcessorTest.java:67)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:565)
        at 
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)

...
Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all 
classes [class org.apache.zookeeper.server.ZKDatabase, class java.lang.Object]
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
        ... 68 more
Caused by: java.lang.IllegalStateException: 
Byte Buddy could not instrument all classes within the mock's type hierarchy

This problem should never occur for javac-compiled classes. This problem has 
been observed for classes that are:
 - Compiled by older versions of scalac
 - Classes that are part of the Android distribution
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:284)
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:217)
        at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:47)
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
        at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
        at 
net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
        at 
org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:40)
        at 
org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:396)
        at 
org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:355)
        at 
org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:334)
        at 
org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.createMock(InlineByteBuddyMockMaker.java:56)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:99)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:88)
        at org.mockito.Mockito.mock(Mockito.java:1998)
        at org.mockito.Mockito.mock(Mockito.java:1913)
        ... 68 more
Caused by: java.lang.IllegalArgumentException: Java 25 (69) is not supported by 
the current version of Byte Buddy which officially supports Java 19 (63) - 
update Byte Buddy or set net.bytebuddy.experimental as a VM property
        at net.bytebuddy.utility.OpenedClassReader.of(OpenedClassReader.java:96)
        at 
net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining.create(TypeWriter.java:4011)
        at 
net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:2224)
        at 
net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$UsingTypeWriter.make(DynamicType.java:4050)
        at 
net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3734)
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.transform(InlineBytecodeGenerator.java:401)
        at 
java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:257)
        at 
java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at 
java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:594)
        at 
java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native 
Method)
        at 
java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:221)
        at 
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:280)
        ... 83 more

{noformat}


> Raise to min JDK 17, also build, test with JDK25
> ------------------------------------------------
>
>                 Key: ZOOKEEPER-5039
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5039
>             Project: ZooKeeper
>          Issue Type: Task
>            Reporter: Dávid Paksy
>            Assignee: Dávid Paksy
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> As per the discussion on dev list:
> Make JDK 17 the minimum runtime and compile versions for the master branch.
> Make sure build, tests, spotbugs, checkstyle, etc works with both JDK 17 and 
> JDK 25.
>  
>  
>  
> With the current 4.9.0 Mockito version tests are failing when JDK25 is used:
> {noformat}
> [ERROR] testACLDigestHashHiding_NoAuth_WorldCanRead  Time elapsed: 0.702 s  
> <<< ERROR!
> org.mockito.exceptions.base.MockitoException: 
> Mockito cannot mock this class: class org.apache.zookeeper.server.ZKDatabase.
> If you're not sure why you're getting this error, please open an issue on 
> GitHub.
> Java               : 25
> JVM vendor name    : Eclipse Adoptium
> JVM vendor version : 25.0.2+10-LTS
> JVM name           : OpenJDK 64-Bit Server VM
> JVM version        : 25.0.2+10-LTS
> JVM info           : mixed mode, sharing
> OS name            : Linux
> OS version         : 6.17.0-22-generic
> You are seeing this disclaimer because Mockito is configured to create 
> inlined mocks.
> You can learn about inline mocks and their limitations under item #39 of the 
> Mockito class javadoc.
> Underlying exception : org.mockito.exceptions.base.MockitoException: Could 
> not modify all classes [class org.apache.zookeeper.server.ZKDatabase, class 
> java.lang.Object]
>       at 
> org.apache.zookeeper.server.FinalRequestProcessorTest.setUp(FinalRequestProcessorTest.java:67)
>       at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:565)
>       at 
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
> ...
> Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all 
> classes [class org.apache.zookeeper.server.ZKDatabase, class java.lang.Object]
>       at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
>       at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
>       at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
>       at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
>       ... 68 more
> Caused by: java.lang.IllegalStateException: 
> Byte Buddy could not instrument all classes within the mock's type hierarchy
> This problem should never occur for javac-compiled classes. This problem has 
> been observed for classes that are:
>  - Compiled by older versions of scalac
>  - Classes that are part of the Android distribution
>       at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:284)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:217)
>       at 
> org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:47)
>       at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
>       at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
>       at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
>       at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
>       at 
> org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:40)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:396)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:355)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:334)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.createMock(InlineByteBuddyMockMaker.java:56)
>       at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:99)
>       at org.mockito.internal.MockitoCore.mock(MockitoCore.java:88)
>       at org.mockito.Mockito.mock(Mockito.java:1998)
>       at org.mockito.Mockito.mock(Mockito.java:1913)
>       ... 68 more
> Caused by: java.lang.IllegalArgumentException: Java 25 (69) is not supported 
> by the current version of Byte Buddy which officially supports Java 19 (63) - 
> update Byte Buddy or set net.bytebuddy.experimental as a VM property
>       at net.bytebuddy.utility.OpenedClassReader.of(OpenedClassReader.java:96)
>       at 
> net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining.create(TypeWriter.java:4011)
>       at 
> net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:2224)
>       at 
> net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$UsingTypeWriter.make(DynamicType.java:4050)
>       at 
> net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3734)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.transform(InlineBytecodeGenerator.java:401)
>       at 
> java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:257)
>       at 
> java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
>       at 
> java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:594)
>       at 
> java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native 
> Method)
>       at 
> java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:221)
>       at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:280)
>       ... 83 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to