Robert Munteanu created SLING-12720:
---------------------------------------
Summary: Build fails on Java 21:Byte Buddy could not instrument
all classes within the mock's type hierarchy
Key: SLING-12720
URL: https://issues.apache.org/jira/browse/SLING-12720
Project: Sling
Issue Type: Improvement
Components: Testing
Reporter: Robert Munteanu
Assignee: Robert Munteanu
Fix For: JUnit Core 1.1.8
Sample:
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.052 s
<<< FAILURE! - in
org.apache.sling.junit.impl.servlet.junit5.RunListenerAdapterTest
[ERROR]
org.apache.sling.junit.impl.servlet.junit5.RunListenerAdapterTest.testLifecycle
Time elapsed: 0.049 s <<< ERROR!
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class org.junit.runner.notification.RunListener.
If you're not sure why you're getting this error, please report to the mailing
list.
Java : 21
JVM vendor name : Oracle Corporation
JVM vendor version : 21.0.6+7-suse-1.3-x8664
JVM name : OpenJDK 64-Bit Server VM
JVM version : 21.0.6+7-suse-1.3-x8664
JVM info : mixed mode, sharing
OS name : Linux
OS version : 6.13.7-1-default
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.junit.runner.notification.RunListener, class
java.lang.Object]
at
org.apache.sling.junit.impl.servlet.junit5.RunListenerAdapterTest.testLifecycle(RunListenerAdapterTest.java:50)
Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all
classes [class org.junit.runner.notification.RunListener, class
java.lang.Object]
at
org.apache.sling.junit.impl.servlet.junit5.RunListenerAdapterTest.testLifecycle(RunListenerAdapterTest.java:50)
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.apache.sling.junit.impl.servlet.junit5.RunListenerAdapterTest.testLifecycle(RunListenerAdapterTest.java:50)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major
version 65
at
org.apache.sling.junit.impl.servlet.junit5.RunListenerAdapterTest.testLifecycle(RunListenerAdapterTest.java:50)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)