JaCoCo plugin fails with class loading error when run with 1.10.0-SNAPSHOT

See original GitHub issue

Describe the bug

I’m trying to upgrade my plugin to work with the 2022.3 EAP. To do this, I first am upgrading my build to use the snapshot of the intellij plugin, 1.10.0-SNAPSHOT as advised on the [website] (https://plugins.jetbrains.com/docs/intellij/configuring-plugin-project.html#target-platform-and-dependencies). Unfortunately, when I do this I get a strange error from the jacoco plugin that is also configured in my build:

OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
CompileCommand: exclude com/intellij/openapi/vfs/impl/FilePartNodeRoot.trieDescend bool exclude = true
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:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.jacoco.agent.rt.internal_f3994fa.core.runtime.InjectedClassRuntime$Lookup.defineClass(InjectedClassRuntime.java:134)
    at org.jacoco.agent.rt.internal_f3994fa.core.runtime.InjectedClassRuntime.startup(InjectedClassRuntime.java:54)
    at org.jacoco.agent.rt.internal_f3994fa.PreMain.premain(PreMain.java:53)
    ... 6 more
Caused by: java.lang.LinkageError: loader 'bootstrap' attempted duplicate class definition for java.lang.$JaCoCo. (java.lang.$JaCoCo is in module java.base of loader 'bootstrap')
    at java.base/java.lang.ClassLoader.defineClass0(Native Method)
    at java.base/java.lang.System$2.defineClass(System.java:2307)
    at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439)
    at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2416)
    at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1843)

 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

AFAIK there is only 1 jacoco dependency being referenced by my gradle build and even if I remove it completely I still get this error.

To Reproduce

Include the IJ plugin version 1.10.0-SNAPSHOT and the jacoco plugin in build.gradle

Run: ./gradlew build

Version of Jacoco used:

jacoco { toolVersion = "0.8.6" }

Expected behavior JaCoCo should produce coverage reports without error.

Environment:

  • OS: linux
  • Gradle IntelliJ Plugin Version: 1.10.0-SNAPSHOT
  • Gradle Version : 7.4.2

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hszcommented, Nov 9, 2022

Please verify this issue with the latest snapshot.

0reactions
jamescattocommented, Nov 10, 2022

@hsz I can confirm I no longer get this error when enabling the plugin, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jacoco maven plugin clogs up console with Exceptions-java ...
io.IOException: Error while instrumenting class. Caused by: java.lang.IllegalStateException: Class <class-name> is already instrumented.
Read more >
JaCoCo plugin fails with no coverage #161 - GitHub
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.2:check (post-unit-test) on project unit-api: Coverage checks have not ...
Read more >
JaCoCo | Jenkins plugin
This plugin integrates JaCoCo code coverage reports to Jenkins.
Read more >
Mvn install fails for integration test - Sample Code
I am trying to run mvn install for my demo project on my local machine, but it fails. It failed, after I have...
Read more >
JUnit 5 User Guide
Another technical reason for making classes and methods public is to simplify testing on the module path when using the Java Module System....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found