Jacoco plugin does not work with Java 9 in 3.0 M2


(Horcrux7) #1

I have try 3.0M2 with JDK 9 and receive the follow error:

java.lang.reflect.InvocationTargetException
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:533)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(java.instrument@9-ea/InstrumentationImpl.java:396)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(java.instrument@9-ea/InstrumentationImpl.java:408)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
    at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
    at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
    at org.jacoco.agent.rt.internal_b0d6a23.PreMain.createRuntime(PreMain.java:55)
    at org.jacoco.agent.rt.internal_b0d6a23.PreMain.premain(PreMain.java:47)
    ... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
FATAL ERROR in native method: processing of -javaagent failed
    at java.lang.Class.getField(java.base@9-ea/Class.java:1881)
    at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
    ... 9 more
Exception in thread "main" Could not write standard input into: Gradle Test Executor 1.
java.io.IOException: Die Pipe wird gerade geschlossen
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(FileOutputStream.java:326)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:56)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

(Horcrux7) #2

With the follow line it work:

jacoco.toolVersion = “0.7.7.201606060606”

You should do it to default or better use ever the news version.

Before it run with version 0.7.6.201602180812.


(Sterling Greene) #3

Thanks @Horcrux7!

I was about to suggest the same thing.

I’ve added an issue to our Java9 checklist to update the external tool integrations to versions that support Java9.


(Stefan Wolf) #4

Thank you very much for reporting!

With Gradle 3.0 we update the default Jacoco version to 0.7.7.201606060606.


(Horcrux7) #5

FYI: If available then you should switch to version 0.7.8. The 0.7.7 has also some JDK 9 bugs. We are work with 0.7.8-SNAPSHOT currently.


(Stefan Wolf) #6

As soon as there is a release available, we are happy to upgrade to 0.7.8. Currently only a snapshot build is available.