title: Gradle Error while instrumenting class
body: <p>I’m working on a POC with Jacoco and gradle for GigaProject and am getting this error when it gets to jacoco during "test" task aka instrumenting test source code. Any ideas? Thanks.</p>
  
  <pre><code>java.lang.instrument.IllegalClassFormatException: Error while instrumenting class org/gradle/internal/service/UnknownServiceException.
          at org.jacoco.agent.rt.internal_5d10cad.CoverageTransformer.transform(CoverageTransformer.java:91)
          at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
          at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
          at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
          at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
          at org.gradle.process.internal.child.ImplementationClassLoaderWorker.createLoggingManager(ImplementationClassLoaderWorker.java:85)
          at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:53)
          at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:37)
          at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:43)
          at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:32)
          at org.gradle.process.internal.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:46)
          at org.gradle.process.internal.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:32)
          at jarjar.org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorkerMain.java:32)
          at jarjar.org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWorkerMain.java:37)
  Caused by: java.io.FileNotFoundException: build\jacoco\UT\classpathdumps\org\gradle\internal\service\UnknownServiceException.class (The requested oper
  ation cannot be performed on a file with a user-mapped section open)
          at java.io.FileOutputStream.open(Native Method)
          at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:194)
          at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:145)
          at org.jacoco.agent.rt.internal_5d10cad.ClassFileDumper.dump(ClassFileDumper.java:66)
          at org.jacoco.agent.rt.internal_5d10cad.CoverageTransformer.transform(CoverageTransformer.java:83)
          ... 22 more
  java.lang.instrument.IllegalClassFormatException: Error while instrumenting class org/gradle/logging/internal/DefaultStandardOutputRedirector$WriteAct
  ion.
          at org.jacoco.agent.rt.internal_5d10cad.CoverageTransformer.transform(CoverageTransformer.java:91)
          at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
          at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
          at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
          at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
          at org.gradle.util.FilteringClassLoader.loadClass(FilteringClassLoader.java:60)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
          at org.gradle.util.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:52)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
          at org.gradle.logging.internal.DefaultStandardOutputRedirector.&lt;init&gt;(DefaultStandardOutputRedirector.java:30)
          at org.gradle.api.internal.tasks.testing.junit.JULRedirector.&lt;init&gt;(JULRedirector.java:29)
          at org.gradle.api.internal.tasks.testing.junit.JUnitTestFramework$TestClassProcessorFactoryImpl.create(JUnitTestFramework.java:96)
          at org.gradle.api.internal.tasks.testing.worker.TestWorker.startReceivingTests(TestWorker.java:81)
          at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:64)
          at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:44)
          at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:78)
          at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:35)
          at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:81)
          at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:37)
          at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:43)
          at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:32)
          at org.gradle.process.internal.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:46)
          at org.gradle.process.internal.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:32)
          at jarjar.org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorkerMain.java:32)
          at jarjar.org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWorkerMain.java:37)
  Caused by: java.io.FileNotFoundException: build\jacoco\UT\classpathdumps\org\gradle\logging\internal\DefaultStandardOutputRedirector$WriteAction.class
  (The requested operation cannot be performed on a file with a user-mapped section open)
          at java.io.FileOutputStream.open(Native Method)
          at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:194)
          at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:145)
          at org.jacoco.agent.rt.internal_5d10cad.ClassFileDumper.dump(ClassFileDumper.java:66)
          at org.jacoco.agent.rt.internal_5d10cad.CoverageTransformer.transform(CoverageTransformer.java:83)
          ... 34 more
  </code></pre>