Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Problem with Java 17 #96

@lofidewanto

Description

@lofidewanto

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions