[
https://issues.apache.org/jira/browse/FELIX-6215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17021152#comment-17021152
]
Mat Booth commented on FELIX-6215:
----------------------------------
I submitted the following pull request: https://github.com/apache/felix/pull/220
> Cannot run scr unit tests on Java 11
> ------------------------------------
>
> Key: FELIX-6215
> URL: https://issues.apache.org/jira/browse/FELIX-6215
> Project: Felix
> Issue Type: Improvement
> Components: Declarative Services (SCR)
> Affects Versions: scr-2.1.16
> Reporter: Mat Booth
> Priority: Major
>
> When trying to run unit tests for Felix SCR on a Java 11 VM, it fails with
> this sort of error:
>
> {code:java}
> [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)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)