Jacoco seems to break Kotlin/Gradle build

Example project: GitHub - nsragow/BrokenJacocoGradleKotlin
Java 11
Kotlin 1.6.21
Gradle 7.4.2

build.gradle.kt

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    testImplementation(kotlin("test"))
}

plugins {
    id("idea")
    kotlin("jvm") version "1.6.21"
    jacoco
}

repositories {
    mavenCentral()
}


tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "11"
}

Command:

./gradlew test

Output:

> Task :test FAILED

test.LibraryExtTest > pageAllAsync FAILED
    java.lang.VerifyError at LibraryExtTest.kt:17

1 test completed, 1 failed

FAILURE: Build failed with an exception.

Expected test to pass.

More stderr output:

Bad local variable type
Exception Details:
  Location:
    test/LibraryExtTestKt.ddU$default(Ljava/lang/String;ILjava/lang/Object;)V @36: aload_3
  Reason:
    Type long_2nd (current frame, locals[3]) is not assignable to reference type
  Current Frame:
    bci: @36
    flags: { }
    locals: { 'java/lang/String', integer, long, long_2nd }
    stack: { }
  Bytecode:
    0000000: 1238 c000 3a4e 1b04 7e9a 000a 2d05 0454
    0000010: a700 0a12 1a4b 2d06 0454 2a12 0bb8 0011
    0000020: 033c 0941 2d07 0454 b1                 
  Stackmap Table:
    append_frame(@19,Object[#58])
    same_frame(@26)

java.lang.VerifyError: Bad local variable type
Exception Details:
  Location:
    test/LibraryExtTestKt.ddU$default(Ljava/lang/String;ILjava/lang/Object;)V @36: aload_3
  Reason:
    Type long_2nd (current frame, locals[3]) is not assignable to reference type
  Current Frame:
    bci: @36
    flags: { }
    locals: { 'java/lang/String', integer, long, long_2nd }
    stack: { }
  Bytecode:
    0000000: 1238 c000 3a4e 1b04 7e9a 000a 2d05 0454
    0000010: a700 0a12 1a4b 2d06 0454 2a12 0bb8 0011
    0000020: 033c 0941 2d07 0454 b1                 
  Stackmap Table:
    append_frame(@19,Object[#58])
    same_frame(@26)

	at test.LibraryExtTest.pageAllAsync(LibraryExtTest.kt:17)
	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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	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.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy2/jdk.proxy2.$Proxy5.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

I messed around with different java versions (17, 21) and different kotlin versions (1.8, 1.9) and gradle 8.4. Same issue.
Seems similar to
https://youtrack.jetbrains.com/issue/KT-29582/Jacoco-VerifyError-Bad-local-variable-type-with-inline-function-call-inside-inline-function-with-default-parameter

But in which way do you think this is Gradle related?
If this is JaCoCo destroying the Kotlin-produced bytecode, you should complain to JaCoCo as also mentioned in the YouTrack issue you linked.

I figured because it was a bundled plugin it was under gradle but happy to bring it up with Jacoco. Switched to Kover anyways so not personally relevant anymore.

The plugin just applies, configures, and calls JaCoCo.
But the JaCoCo code is not built-in.
There is a default version that is used but you can change that and it downloads the necessary JaCoCo artifact, so yes, please bring it up with JaCoCo directly if there is no issue for it yet.