Skip to content

Commit 8eb0317

Browse files
renovate[bot]DreierFclaude
authored
Update jacoco to v0.8.15 (#921)
* Update jacoco to v0.8.15 * Update dependency jacoco to v0.8.15 * Apply post-upgrade adjustments for JaCoCo 0.8.15 Update the shaded internal package hash in JaCoCoPreMain and LenientCoverageTransformer, port the upstream Analyzer change (synthetic check replaced with package-info check) into OpenAnalyzer, and add a changelog entry for the user-visible Java 26/27 support. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Extend Kotlin string transformer to cover ClassAnalyzer JaCoCo 0.8.15 inlines the Lkotlin/Metadata; descriptor constant from Filters into ClassAnalyzer.visitAnnotation, one package above the filter/ subpackage. The shadow build relocates kotlin to shadow.kotlin, which mangles this literal; without the revert, ClassAnalyzer no longer recognizes the Kotlin metadata annotation, the SMAP is never parsed, and KotlinInlineFilter is silently disabled. Broaden the post-build transformer's path match accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Florian Dreier <dreier@cqse.eu> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c81e458 commit 8eb0317

7 files changed

Lines changed: 23 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We use [semantic versioning](http://semver.org/):
55
- PATCH version when you make backwards compatible bug fixes.
66

77
# Next version
8+
- [feature] _agent_: Added official support for Java 26 and experimental support for Java 27 (via JaCoCo 0.8.15)
89

910
# 36.5.2
1011
- [security fix] _agent_: The Teamscale access token was logged in clear text in DEBUG-level logs (e.g., when `debug=true` was set) and in the WARN-level log emitted when multiple `-javaagent` arguments are present. The token is now obfuscated in those logs as well, matching INFO-level behavior.

agent/src/main/java/com/teamscale/jacoco/agent/JaCoCoPreMain.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313

1414
package com.teamscale.jacoco.agent;
1515

16-
import org.jacoco.agent.rt.internal_29a6edd.Agent;
17-
import org.jacoco.agent.rt.internal_29a6edd.AgentModule;
18-
import org.jacoco.agent.rt.internal_29a6edd.CoverageTransformer;
19-
import org.jacoco.agent.rt.internal_29a6edd.IExceptionLogger;
20-
import org.jacoco.agent.rt.internal_29a6edd.PreMain;
21-
import org.jacoco.agent.rt.internal_29a6edd.core.runtime.AgentOptions;
22-
import org.jacoco.agent.rt.internal_29a6edd.core.runtime.IRuntime;
23-
import org.jacoco.agent.rt.internal_29a6edd.core.runtime.InjectedClassRuntime;
24-
import org.jacoco.agent.rt.internal_29a6edd.core.runtime.ModifiedSystemClassRuntime;
16+
import org.jacoco.agent.rt.internal_bac9136.Agent;
17+
import org.jacoco.agent.rt.internal_bac9136.AgentModule;
18+
import org.jacoco.agent.rt.internal_bac9136.CoverageTransformer;
19+
import org.jacoco.agent.rt.internal_bac9136.IExceptionLogger;
20+
import org.jacoco.agent.rt.internal_bac9136.PreMain;
21+
import org.jacoco.agent.rt.internal_bac9136.core.runtime.AgentOptions;
22+
import org.jacoco.agent.rt.internal_bac9136.core.runtime.IRuntime;
23+
import org.jacoco.agent.rt.internal_bac9136.core.runtime.InjectedClassRuntime;
24+
import org.jacoco.agent.rt.internal_bac9136.core.runtime.ModifiedSystemClassRuntime;
2525
import org.slf4j.Logger;
2626

2727
import java.lang.instrument.Instrumentation;

agent/src/main/kotlin/com/teamscale/jacoco/agent/LenientCoverageTransformer.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package com.teamscale.jacoco.agent
22

3-
import org.jacoco.agent.rt.internal_29a6edd.CoverageTransformer
4-
import org.jacoco.agent.rt.internal_29a6edd.IExceptionLogger
5-
import org.jacoco.agent.rt.internal_29a6edd.core.runtime.AgentOptions
6-
import org.jacoco.agent.rt.internal_29a6edd.core.runtime.IRuntime
3+
import org.jacoco.agent.rt.internal_bac9136.CoverageTransformer
4+
import org.jacoco.agent.rt.internal_bac9136.IExceptionLogger
5+
import org.jacoco.agent.rt.internal_bac9136.core.runtime.AgentOptions
6+
import org.jacoco.agent.rt.internal_bac9136.core.runtime.IRuntime
77
import org.slf4j.Logger
88
import java.lang.instrument.IllegalClassFormatException
99
import java.security.ProtectionDomain
1010

1111
/**
12-
* A class file transformer which delegates to the JaCoCo [org.jacoco.agent.rt.internal_29a6edd.CoverageTransformer] to do the actual instrumentation,
12+
* A class file transformer which delegates to the JaCoCo [org.jacoco.agent.rt.internal_bac9136.CoverageTransformer] to do the actual instrumentation,
1313
* but treats instrumentation errors e.g. due to unsupported class file versions more lenient by only logging them, but
1414
* not bailing out completely. Those unsupported classes will not be instrumented and will therefore not be contained in
1515
* the collected coverage report.

buildSrc/src/main/kotlin/KotlinStringTransformer.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import kotlin.io.path.pathString
99

1010
/**
1111
* Reverts the transformation from "kotlin" to "shadow/kotlin" within strings of
12-
* "org/jacoco/core/internal/analysis/filter" to make JaCoCo correctly process Kotlin class files.
12+
* "org/jacoco/core/internal/analysis" (including the "filter" subpackage) to make JaCoCo correctly
13+
* process Kotlin class files. Since JaCoCo 0.8.15 the kotlin.Metadata descriptor literal is also
14+
* inlined into ClassAnalyzer (in the parent "analysis" package), so the filter subpackage alone is
15+
* not enough.
1316
*/
1417
fun revertKotlinPackageChanges(archiveFile: Provider<RegularFile>) {
1518
val zip = archiveFile.get().asFile.toPath()
@@ -37,7 +40,7 @@ private fun transformClass(file: Path) {
3740
}
3841

3942
private fun shouldTransform(path: String): Boolean {
40-
return path.contains("org/jacoco/core/internal/analysis/filter")
43+
return path.contains("org/jacoco/core/internal/analysis")
4144
}
4245

4346
private class StringReplacerClassVisitor(classNode: ClassVisitor?) : ClassVisitor(Opcodes.ASM9, classNode) {

buildSrc/src/main/kotlin/com.teamscale.coverage.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
jacoco {
7-
toolVersion = "0.8.14"
7+
toolVersion = "0.8.15"
88
}
99

1010
tasks.jacocoTestReport {

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# When upgrading JaCoCo to a newer version, make sure to
33
# check the comment in the OpenAnalyzer.java, JaCoCoPreMain.java and CachingInstructionsBuilder.java
44
# and update the internal_xxxxxx hash included in the imports in LenientCoverageTransformer.java and JaCoCoPreMain.java.
5-
jacoco = "0.8.14"
5+
jacoco = "0.8.15"
66
# We need to stay on the 1.3.x release line as 1.4.x requires Java 11
77
logback = "1.3.16"
88
retrofit = "3.0.0"

report-generator/src/main/java/com/teamscale/report/jacoco/OpenAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected void analyzeClass(final byte[] source) {
113113
if ((reader.getAccess() & Opcodes.ACC_MODULE) != 0) {
114114
return;
115115
}
116-
if ((reader.getAccess() & Opcodes.ACC_SYNTHETIC) != 0) {
116+
if (reader.getClassName().endsWith("/package-info")) {
117117
return;
118118
}
119119
final ClassVisitor visitor = createAnalyzingVisitor(classId,

0 commit comments

Comments
 (0)