Skip to content

Commit 3520bce

Browse files
[mq] [skip ddci] working branch - merge 7b10bf3 on top of master at 229cd9e
{"baseBranch":"master","baseCommit":"229cd9ef514f7110cb9a5920cebff49d8b2e1a84","createdAt":"2026-09-24T16:41:47.423843Z","headSha":"7b10bf3597195d67b66ef8fcb42a4852e47b3578","id":"af13863a-f758-46d1-97ed-c1bc90b7f1e1","priority":"200","pullRequestNumber":"12305","queuedAt":"2026-09-24T16:41:47.423064Z","status":"STATUS_QUEUED"}
2 parents 811ba7e + 7b10bf3 commit 3520bce

102 files changed

Lines changed: 298 additions & 394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package datadog.gradle
2+
3+
import groovy.lang.Closure
4+
import org.gradle.api.JavaVersion
5+
import org.gradle.api.tasks.compile.AbstractCompile
6+
import org.gradle.kotlin.dsl.extra
7+
8+
fun AbstractCompile.configureCompiler(
9+
targetVersion: JavaVersion,
10+
unsetReleaseFlagReason: String = "",
11+
) {
12+
(project.extra["configureCompiler"] as Closure<*>).call(this, targetVersion, unsetReleaseFlagReason)
13+
}
14+
15+
fun AbstractCompile.configureCompiler(
16+
toolchainVersion: Int,
17+
targetVersion: JavaVersion,
18+
unsetReleaseFlagReason: String = "",
19+
) {
20+
(project.extra["configureCompiler"] as Closure<*>).call(
21+
this,
22+
toolchainVersion,
23+
targetVersion,
24+
unsetReleaseFlagReason,
25+
)
26+
}

‎dd-java-agent/agent-bootstrap/build.gradle‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ sourceSets {
4343
}
4444

4545
tasks.named("compileMain_java11Java", JavaCompile) {
46-
configureCompiler(it, 11, JavaVersion.VERSION_1_8)
46+
// Do not lift this offset: these JFR bootstrap classes run on Java 8 JFR backports.
47+
configureCompiler(it, JavaVersion.VERSION_1_8, "Uses jdk.jfr module (Java 11+) at Java 8 bytecode")
4748
}
4849

4950
dependencies {

‎dd-java-agent/agent-debugger/debugger-test-scala/build.gradle‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ dependencies {
88
}
99

1010
tasks.withType(ScalaCompile).configureEach {
11-
// Despite the compatibility matrix, scala compiler doesn't properly
12-
// get the right compiler flags with JDK11 toolchain. Using 8 works.
11+
// Scala compilers here can't run on modern JDKs; pinned to JDK 8.
1312
// * https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
14-
// * https://github.com/gradle/gradle/issues/19456
15-
configureCompiler(it, 8)
13+
configureCompiler(it, 8, JavaVersion.VERSION_1_8, "Scala compilers here do not run on modern JDKs")
1614
}

‎dd-java-agent/agent-iast/build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ plugins {
1010
id 'dd-trace-java.module.product-subsystem'
1111
}
1212

13-
tasks.withType(AbstractCompile).configureEach {
14-
configureCompiler(it, 11, JavaVersion.VERSION_1_8, "Ensure no APIs beyond JDK8 are used")
13+
tasks.named("compileJava", JavaCompile) {
14+
configureCompiler(it, 11, JavaVersion.VERSION_1_8, "Error Prone 2.23.0 / NullAway 0.10.15 are incompatible with JDK 25 javac")
1515
}
1616

1717
// First version with Mac M1 support

‎dd-java-agent/agent-installer/build.gradle‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ dependencies {
3434
}
3535

3636
tasks.named("compileMain_java11Java", JavaCompile) {
37-
configureCompiler(it, 11, JavaVersion.VERSION_1_8,
38-
"Java 11 sourceset for JPMS-aware ClassFileTransformer, compiled with Java 11 but targeting Java 8 bytecode.")
37+
// Loaded reflectively only on Java 9+, so this can target Java 9 and restore --release.
38+
configureCompiler(it, JavaVersion.VERSION_1_8, "Uses the ClassFileTransformer Module overload (Java 9+) at Java 8 bytecode")
3939
}
4040

4141
tasks.named("compileMain_java25Java", JavaCompile) {
42-
configureCompiler(it, 25, JavaVersion.VERSION_1_8,
43-
"Java 25 sourceset for Foreign Function & Memory API, compiled with Java 25 but targeting Java 8 bytecode.")
42+
// Loaded reflectively only on Java 22+, so this can target Java 22 and restore --release
43+
// after confirming the implementation uses only the Java 22 FFM surface.
44+
configureCompiler(it, JavaVersion.VERSION_1_8, "Uses Foreign Function & Memory API (java.lang.foreign, Java 22+) at Java 8 bytecode")
4445
}
4546

4647
dependencies {

‎dd-java-agent/agent-profiling/profiling-controller-ddprof/build.gradle‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ dependencies {
3737
testImplementation project(':dd-java-agent:agent-profiling')
3838
}
3939

40-
/*
41-
Setup here is as following:
42-
* We compile with Java11 compiler to get JFR definitions.
43-
* We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible.
44-
* We force IDEA to treat this as Java11 project with 'idea' plugin below.
45-
*/
4640
tasks.withType(AbstractCompile).configureEach {
47-
configureCompiler(it, 11, JavaVersion.VERSION_1_8)
4841
// Disable '-processing' because some annotations are not claimed.
4942
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
5043
// Disable '-path' because we do not have some of the paths seem to be missing.

‎dd-java-agent/agent-profiling/profiling-controller-jfr/build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ excludedClassesCoverage += ['com.datadog.profiling.controller.jfr.JdkTypeIDs']
3131

3232
// Shared JFR implementation. The earliest Java version JFR is working on is Java 8
3333
tasks.named("compileTestJava", JavaCompile) {
34-
// tests should be compiled in Java 8 compatible way
35-
configureCompiler(it, 11, JavaVersion.VERSION_1_8)
34+
// These tests run only on Java 11+, so this can target Java 11 and restore --release.
35+
configureCompiler(it, JavaVersion.VERSION_1_8, "Uses jdk.jfr API (Java 11+) at Java 8 bytecode")
3636
// Disable '-processing' because some annotations are not claimed.
3737
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
3838
// Disable '-path' because we do not have some of the paths seem to be missing.

‎dd-java-agent/agent-profiling/profiling-controller-jfr/implementation/build.gradle‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ sourceSets {
1616
}
1717

1818
tasks.named("compileJava", JavaCompile) {
19-
configureCompiler(it, 11, JavaVersion.VERSION_1_8, "Need access to jdk.jfr.internal.*")
19+
// Do not lift this offset: this adapter runs on Java 8 JFR backports and needs JDK 11 internals.
20+
configureCompiler(it, 11, JavaVersion.VERSION_1_8, "Needs JDK-11 jdk.jfr.internal API removed in later JDKs")
2021
}
2122

2223
tasks.named("compileMain_java11Java", JavaCompile) {
23-
configureCompiler(it, 11, JavaVersion.VERSION_1_9)
24+
// Do not lift this to Java 11 while JFR-capable Java 9/10 distributions remain supported;
25+
// --release 9 cannot expose the public JFR API introduced in Java 11.
26+
configureCompiler(it, JavaVersion.VERSION_1_9, "Uses public jdk.jfr APIs (Java 11+) at Java 9 bytecode")
2427
}
2528

2629
dependencies {

‎dd-java-agent/agent-profiling/profiling-controller-openjdk/build.gradle‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ dependencies {
3636

3737
/*
3838
Setup here is as following:
39-
* We compile with Java11 compiler to get JFR definitions.
39+
* We compile with Java25 compiler to get JFR definitions.
4040
* We specify source/target as Java8 to get code that is loadable on Java8 - JFR defs are Java8 compatible.
4141
* We force IDEA to treat this as Java11 project with 'idea' plugin below.
4242
*/
4343
[JavaCompile, GroovyCompile].each {
4444
tasks.withType(it).configureEach {
45-
configureCompiler(it, 11, JavaVersion.VERSION_1_8, "Need access to jdk.jfr package")
45+
// Do not lift this offset: this controller runs on Java 8 distributions that backport JFR.
46+
configureCompiler(it, JavaVersion.VERSION_1_8, "Uses public jdk.jfr APIs (Java 11+) at Java 8 bytecode")
4647
// Disable '-processing' because some annotations are not claimed.
4748
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
4849
// Disable '-path' because we do not have some of the paths seem to be missing.

‎dd-java-agent/agent-profiling/profiling-ddprof/build.gradle‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ configurations.configureEach {
6262

6363
[JavaCompile, GroovyCompile].each {
6464
tasks.withType(it).configureEach {
65-
configureCompiler(it, 11, JavaVersion.VERSION_1_8)
6665
// Disable '-processing' because some annotations are not claimed.
6766
// Disable '-options' because we are compiling for java8 without specifying bootstrap - intentionally.
6867
// Disable '-path' because we do not have some of the paths seem to be missing.

0 commit comments

Comments
 (0)