You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With JDK 10, `./gradlew allTest` fails to run tests, instead spewing out
the following errors on the console:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:510)
FATAL ERROR in native method: processing of -javaagent failed
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:522)
Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.
at org.jacoco.agent.rt.internal_290345e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
at org.jacoco.agent.rt.internal_290345e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
at org.jacoco.agent.rt.internal_290345e.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_290345e.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:1958)
at org.jacoco.agent.rt.internal_290345e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
... 9 more
... and so forth
According to a PR[1] on the JaCoCo's issue tracker, this occurs because
"Classes of JDK 10 EA b35 use a new classfile version number and so
JaCoCo Agent 0.7.9 as well as agent from current build of master branch
fail to start". This has been fixed as of JaCoCo 0.8.1, which also
happens to be the latest release.
We do not explicitly specify the version JaCoCo to use in our
build.gradle file, and so the `jacoco` gradle plugin just uses its
default, which happens to be 0.8.0[2] on Gradle 4.6 (the version we are
using). This version of JaCoCo still has this bug, and so we get these
errors.
Fix this by upgrading to the latest version of Gradle (4.8.1). Since
Gradle 4.7[3] the default JaCoCo plugin has been upgraded to version
0.8.1, and so upgrading to the latest version of Gradle will fix this
problem and allow us to run tests on JDK 10.
The Gradle wrapper upgrade was performed by running the command:
./gradlew wrapper --gradle-version 4.8.1
and then converting the line endings of gradlew.bat to unix to satisfy
our travis line ending checks.
Also, update any references to the Gradle version we are using in the
code base to 4.8.1.
[1] jacoco/jacoco#629
[2] gradle/gradle@8a09484
[3] https://docs.gradle.org/4.7/release-notes.html#default-jacoco-version-upgraded-to-0.8.1
0 commit comments