google / gwtmockito

Better GWT unit testing
https://google.github.io/gwtmockito
Apache License 2.0
157 stars 51 forks source link

Make jdk.internal.reflect package being loaded by the standard classloader #73

Closed benoitf closed 6 years ago

benoitf commented 6 years ago

It avoids error like

Caused by: java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by com/google/gwtmockito/GwtMockitoTestRunner$GwtMockitoClassLoader cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:868)
    at javassist.Loader.findClass(Loader.java:377)
    at com.google.gwtmockito.GwtMockitoTestRunner$GwtMockitoClassLoader.findClass(GwtMockitoTestRunner.java:421)

when you're using Java9

With that patch, I'm able to successfully build gwtmockito with Oracle Java9

java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

It would be nice to have this as part of the project instead of having to override getPackagesToLoadViaStandardClassloader() method in custom runnner or to use

@WithPackagesToLoadViaStandardClassLoader(value = "jdk.internal.reflect")

I've tested and build is working with Java8 and Java9

It could be related to issue https://github.com/google/gwtmockito/issues/72

googlebot commented 6 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


googlebot commented 6 years ago

CLAs look good, thanks!

benoitf commented 6 years ago

@ekuefler do you have ETA for 1.1.8 release ?

ekuefler commented 6 years ago

Not yet, you just barely missed 1.1.7. We're doing some investigation around Java 9 in Google. If everything works for us after applying this patch I'll probably cut 1.1.8.

benoitf commented 6 years ago

hello @ekuefler, have you made any progress on the tests with java9 ? Because I'm interested in having a release integrating thix PR's fix. Thanks

ekuefler commented 6 years ago

Sorry for the delay. 1.1.8 is in maven central now with this change: http://repo1.maven.org/maven2/com/google/gwt/gwtmockito/gwtmockito/1.1.8/. I'm still doing some verifications before I update the readme, but you should be able to use it now.