Repository: Kotlin/kotlinx-kover

Issue #7: Gradle test task fails when run test with intellij coverage and kover plugin enabled
Created: 2021-09-14T14:37:33Z
Enable kover plugin in build script.
Try to run any test with coverage. Test should be run via gradle - Preferences | Build, Execution, Deployment | Build Tools | Gradle | Run tests using Gradle. Right click on run gutter near a test and select Run test .. with coverage
Test task is failed with:
Error: LinkageError occurred while loading main class worker.org.gradle.process.internal.worker.GradleWorkerMain
	java.lang.ClassFormatError: Duplicate field name "__$lineHits$__" with signature "[I" in class file worker/org/gradle/process/internal/worker/GradleWorkerMain
Class transformation time: 0.00528344s for 211 classes or 2.504E-5s per class
Class transformation time: 0.026119615s for 136 classes or 1.9205599264705882E-4s per class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> Process 'Gradle Test Executor 45' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Disabling kover-plugin solves the problem. Also with setting Preferences | Build, Execution, Deployment | Build Tools | Gradle | Run tests using Intellij IDEA run test with coverage is ok.
Reproduced with: 'org.jetbrains.kover-plugin' version '0.4', intellij-coverage-agent-1.0.596.jar, Kotlin JVM Gradle plugin 1.6.0-RC-303, gradle-7.1

Duplicate issue #47: IntelliJ IDE Coverage fails with the supplied plugin
Created: 2021-11-08T16:46:14Z
After the plugin installation on my Spring Boot application, org.jetbrains.kotlinx.kover 0.4.1, I tried to execute the IDEA Coverage, but a NPE is occurring.
IDEA Version: 2021.2.3 Ultimate
Kotlin: 1.4.21
Gradle: 6.8.1
JDK: openjdk 11.0.11 2021-04-20
I'm posting the following snippet stack trace:
---- IntelliJ IDEA coverage runner ---- 
sampling ...
include patterns:
exclude patterns:
---- IntelliJ IDEA coverage runner ---- 
tracing ...
include patterns:
exclude patterns:
[2021.11.08 13:39:42] (Coverage): Error during class instrumentation: com/intellij/rt/coverage/util/ClassNameUtil: java.lang.ClassCircularityError: com/intellij/rt/coverage/util/ClassNameUtil
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.NullPointerException
	at org.jacoco.agent.rt.internal_f3994fa.PreMain.premain(PreMain.java:48)
	... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at ./src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Process 'Gradle Test Executor 367' finished with non-zero exit value 134
org.gradle.process.internal.ExecException: Process 'Gradle Test Executor 367' finished with non-zero exit value 134
	at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
	at org.gradle.process.internal.worker.DefaultWorkerProcess.onProcessStop(DefaultWorkerProcess.java:141)
	at org.gradle.process.internal.worker.DefaultWorkerProcess.access$000(DefaultWorkerProcess.java:42)
	at org.gradle.process.internal.worker.DefaultWorkerProcess$1.executionFinished(DefaultWorkerProcess.java:94)
	at jdk.internal.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:43)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:245)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:157)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:141)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy93.executionFinished(Unknown Source)
	at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:221)
	at org.gradle.process.internal.DefaultExecHandle.finished(DefaultExecHandle.java:354)
	at org.gradle.process.internal.ExecHandleRunner.completed(ExecHandleRunner.java:110)
	at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:84)
	at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.base/java.lang.Thread.run(Thread.java:829)

> Task :test FAILED

Execution failed for task ':test'.
> Process 'Gradle Test Executor 316' finished with non-zero exit value 134

Closing comment (2021-11-08T18:10:58Z): Duplicates #7