Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
scr-2.1.16
-
None
-
Patch
Description
When trying to run unit tests for Felix SCR on a Java 11 VM, it fails with this sort of error:
[ERROR] test_packageT1SSI(org.apache.felix.scr.impl.inject.BindMethodTest) Time elapsed: 0.009 s <<< ERROR! org.mockito.exceptions.base.MockitoException: Mockito cannot mock this class: interface org.osgi.framework.ServiceReference.Mockito can only mock non-private & non-final classes. If you're not sure why you're getting this error, please report to the mailing list. Java : 11 JVM vendor name : Oracle Corporation JVM vendor version : 11.0.6+10 JVM name : OpenJDK 64-Bit Server VM JVM version : 11.0.6+10 JVM info : mixed mode OS name : Linux OS version : 5.4.12-100.fc30.x86_64 Underlying exception : java.lang.UnsupportedOperationException: Cannot define class using reflection at org.apache.felix.scr.impl.inject.BindMethodTest.setUp(BindMethodTest.java:59) Caused by: java.lang.UnsupportedOperationException: Cannot define class using reflection at org.apache.felix.scr.impl.inject.BindMethodTest.setUp(BindMethodTest.java:59) Caused by: java.lang.IllegalStateException: Could not find sun.misc.Unsafe at org.apache.felix.scr.impl.inject.BindMethodTest.setUp(BindMethodTest.java:59) Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain) at org.apache.felix.scr.impl.inject.BindMethodTest.setUp(BindMethodTest.java:59)