Code coverage error under OpenJDK 11

Answered

Getting the following error running tests with coverage under OpenJDK11:

Tests are JUnit 5.

 

java.lang.ClassFormatError: Nest member class_info_index 18 has bad constant type in class file com/captainduckman/rt/core/Intersection
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3167)
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3192)
at java.base/java.lang.Class.getMethods(Class.java:1905)
at org.junit.platform.commons.util.ReflectionUtils.getDefaultMethods(ReflectionUtils.java:1154)
at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:1127)
at org.junit.platform.commons.util.ReflectionUtils.findAllMethodsInHierarchy(ReflectionUtils.java:1069)
at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:1053)
at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:1039)
at org.junit.vintage.engine.descriptor.VintageTestDescriptor.toMethodSource(VintageTestDescriptor.java:154)
at org.junit.vintage.engine.descriptor.VintageTestDescriptor.toTestSource(VintageTestDescriptor.java:138)
at org.junit.vintage.engine.descriptor.VintageTestDescriptor.<init>(VintageTestDescriptor.java:54)
at org.junit.vintage.engine.discovery.TestClassRequestResolver.addChildrenRecursively(TestClassRequestResolver.java:110)
at org.junit.vintage.engine.discovery.TestClassRequestResolver.createCompleteRunnerTestDescriptor(TestClassRequestResolver.java:93)
at org.junit.vintage.engine.discovery.TestClassRequestResolver.determineRunnerTestDescriptor(TestClassRequestResolver.java:64)
at org.junit.vintage.engine.discovery.TestClassRequestResolver.createRunnerTestDescriptor(TestClassRequestResolver.java:59)
at org.junit.vintage.engine.discovery.VintageDiscoverer.lambda$discover$0(VintageDiscoverer.java:53)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:55)
at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:61)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:168)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:155)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:120)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:52)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

 

 

1
5 comments

Switching the coverage engine to Jacoco brings the following:

 

D:\tools\jdk-11\bin\java.exe -ea --illegal-access=permit -javaagent:C:\Users\Winting\.IntelliJIdea2018.2\system\testAgent\jacocoagent.jar=destfile=C:\Users\Winting\.IntelliJIdea2018.2\system\coverage\raytracer$All_in_core.exec,append=false,includes=,excludes= -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\tools\JetBrains\IntelliJ IDEA 2018.1.6\lib\idea_rt.jar=64616:D:\tools\JetBrains\IntelliJ IDEA 2018.1.6\bin" -Dfile.encoding=UTF-8 -classpath "D:\tools\JetBrains\IntelliJ IDEA 2018.1.6\lib\idea_rt.jar;D:\tools\JetBrains\IntelliJ IDEA 2018.1.6\plugins\junit\lib\junit-rt.jar;D:\tools\JetBrains\IntelliJ IDEA 2018.1.6\plugins\junit\lib\junit5-rt.jar;D:\.m2\org\junit\platform\junit-platform-launcher\1.3.1\junit-platform-launcher-1.3.1.jar;D:\.m2\org\apiguardian\apiguardian-api\1.0.0\apiguardian-api-1.0.0.jar;D:\.m2\org\junit\platform\junit-platform-engine\1.3.1\junit-platform-engine-1.3.1.jar;D:\.m2\org\junit\platform\junit-platform-commons\1.3.1\junit-platform-commons-1.3.1.jar;D:\.m2\org\opentest4j\opentest4j\1.1.1\opentest4j-1.1.1.jar;D:\dev\raytracer\core\target\test-classes;D:\dev\raytracer\core\target\classes;D:\.m2\org\junit\jupiter\junit-jupiter-api\5.3.1\junit-jupiter-api-5.3.1.jar;D:\dev\raytracer\math-core\target\classes;D:\dev\raytracer\math-core\target\test-classes;D:\.m2\org\junit\jupiter\junit-jupiter-engine\5.3.1\junit-jupiter-engine-5.3.1.jar;D:\.m2\org\junit\vintage\junit-vintage-engine\5.3.1\junit-vintage-engine-5.3.1.jar;D:\.m2\junit\junit\4.12\junit-4.12.jar;D:\.m2\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\.m2\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\.m2\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;D:\.m2\log4j\log4j\1.2.17\log4j-1.2.17.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit5 @w@C:\Users\Winting\AppData\Local\Temp\idea_working_dirs_junit1.tmp @C:\Users\Winting\AppData\Local\Temp\idea_junit1.tmp -socket64615
FATAL ERROR in native method: processing of -javaagent failed
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:566)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.
at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140)
at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101)
at org.jacoco.agent.rt.internal_c13123e.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_c13123e.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:2000)
at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
... 9 more

Process finished with exit code 1

0

Please raise an issue at https://youtrack.jetbrains.com/issues

0

I am not the OP, but just to close the loop on this as this is the first result that comes up when googling this problem: https://youtrack.jetbrains.com/issue/TW-57605

0

https://youtrack.jetbrains.com/issue/TW-57605 does not seem to solve this issue.

I am on 2019 Beta 

IC-191.5849.21

and still see this error on TeamCity with JDK11

Any other related issue out there?

0

Hi,

 

the issue in IDEA should have been fixed as well:
https://youtrack.jetbrains.com/issue/IDEA-199696

 

If you are using IDEA, please make sure to report it there. If you are using TeamCity, make sure you are using at least 2018.2.2, where the fix was introduced.

0

Please sign in to leave a comment.