Help wanted: compiling mockito with native-image
See original GitHub issueI am trying to compile mockito with mock-maker-proxy with graalvm native image, and I got stuck with the plugin mechanism (At least the stacktrace point to that). (In preparation for having some mockito suppport in spring-native https://github.com/spring-projects-experimental/spring-native/issues/1063)
I know this maybe a little of topic, but having at least “some” mockito when running native tests made me get started with this.
What I’ve got so far is
- some proxy config
- some reflection config
- basic compiler args
When I compile this example https://github.com/eiswind/native-mock-example
I get a NPE at:
Caused by: java.lang.NullPointerException
org.mockito.internal.configuration.plugins.Plugins.getStackTraceCleanerProvider(Plugins.java:26)
org.mockito.internal.exceptions.stacktrace.StackTraceFilter.<clinit>(StackTraceFilter.java:20)
com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
from which I would guess that registry itself is null, but that makes only little sense. I added some --initialize-at-runtime for the plugins package but that didn’t do it.
So for know I can only hope that this is something of interest and I really would appreciate some pointers what to try.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
It works already: https://gist.github.com/raphw/e0f6864ddcad69630d839c2eebaad818
But it requires some prework. As far as I know, the Graal team is working on something to ease this.
I’ve added support for Mockito to the GraalVM reachability metadata and got the
ProxyMockMaker
to work, see here for more details.The reachability metadata repo is a way to get non-compliant libraries to work nonetheless on GraalVM. Feel free to copy the GraalVM metadata files directly in the Mockito codebase (actually I would be very happy about that 😃).
What is the status of the other mock makers (particularly one which allows mocking of classes) on GraalVM?