Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Java 17 #96

Open
lofidewanto opened this issue Sep 7, 2022 · 0 comments
Open

Problem with Java 17 #96

lofidewanto opened this issue Sep 7, 2022 · 0 comments

Comments

@lofidewanto
Copy link

Hi,

in this test class: https://github.com/gwtboot/gwt-boot-samples/blob/master/gwt-boot-sample-collection/src/test/java/com/github/gwtboot/sample/collection/client/ui/HelloWorldViewTest.java

... I'm using gwtmockito and with Java 11 everything works fine.

With Java 17 I get following error:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.github.gwtboot.sample.collection.client.ui.HelloWorldViewTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.174 sec <<< FAILURE!
com.github.gwtboot.sample.collection.client.ui.HelloWorldViewTest  Time elapsed: 0.174 sec  <<< ERROR!
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.google.gwtmockito.GwtMockitoTestRunner.withBefores(GwtMockitoTestRunner.java:398)
        at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:276)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at com.google.gwtmockito.GwtMockitoTestRunner.run(GwtMockitoTestRunner.java:376)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.google.gwtmockito.GwtMockitoTestRunner.withBefores(GwtMockitoTestRunner.java:396)
        ... 22 more
Caused by: java.lang.ExceptionInInitializerError
        at org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
        at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
        at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
        at org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
        at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
        at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
        at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
        at org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
        at org.mockito.internal.creation.cglib.ClassImposterizer.createProxyClass(ClassImposterizer.java:95)
        at org.mockito.internal.creation.cglib.ClassImposterizer.imposterise(ClassImposterizer.java:57)
        at org.mockito.internal.creation.cglib.ClassImposterizer.imposterise(ClassImposterizer.java:49)
        at org.mockito.internal.creation.cglib.CglibMockMaker.createMock(CglibMockMaker.java:24)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:33)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:59)
        at org.mockito.Mockito.mock(Mockito.java:1285)
        at org.mockito.Mockito.mock(Mockito.java:1163)
        at com.google.gwtmockito.GwtMockito.registerGwtMocks(GwtMockito.java:203)
        at com.google.gwtmockito.GwtMockito.initMocks(GwtMockito.java:133)
        ... 27 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @a803f94
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
        at org.mockito.cglib.core.ReflectUtils$2.run(ReflectUtils.java:57)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at org.mockito.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:47)
        ... 45 more


Results :

Tests in error: 
  com.github.gwtboot.sample.collection.client.ui.HelloWorldViewTest: java.lang.reflect.InvocationTargetException

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

Any helps are appreciated, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant