Commit c9c3e60
Decouple Gradle JDK from JDK8 (#9514)
* Set default java toolchain to 8
* Set toolchain early
* Set JAVA_HOME for smoke test builds
* Do not set compiler release by default (remove skipSettingCompilerRelease)
# Conflicts:
# internal-api/build.gradle was converted to internal-api/build.gradle.kts
# Conflicts:
# dd-java-agent/instrumentation/java-concurrent/java-completablefuture/build.gradle
* build: Run instrument plugin with toolchain
# Conflicts:
# buildSrc/src/main/groovy/MuzzlePlugin.groovy
# Conflicts:
# buildSrc/src/main/kotlin/datadog/gradle/plugin/muzzle/MuzzleTask.kt
* build: Check version in CI
* fix: call-instrumentation-site test due to the appearance of SequenceCollection::getFirst in JDK 21
* chore: Explicit setup of the compiler
# Conflicts:
# dd-java-agent/instrumentation/kafka/kafka-clients-3.8/build.gradle
# Conflicts:
# dd-java-agent/agent-profiling/profiling-controller-jfr/build.gradle
# dd-java-agent/instrumentation/play/play-2.6/build.gradle
# dd-java-agent/instrumentation/wildfly-9.0/build.gradle
# dd-smoke-tests/concurrent/java-25/build.gradle
# utils/socket-utils/build.gradle.kts
# Conflicts:
# dd-java-agent/agent-bootstrap/build.gradle
# dd-java-agent/agent-builder/build.gradle
# dd-java-agent/agent-profiling/profiling-controller-jfr/build.gradle
# dd-java-agent/instrumentation/akka/akka-http/akka-http-10.6/build.gradle
# dd-java-agent/instrumentation/exception-profiling/build.gradle
# dd-java-agent/instrumentation/graal/native-image/build.gradle
# dd-java-agent/instrumentation/jetty/jetty-server/jetty-server-12.0/build.gradle
# dd-java-agent/instrumentation/kafka/kafka-clients-3.8/build.gradle
# dd-java-agent/instrumentation/liberty-20/build.gradle
# dd-java-agent/instrumentation/micronaut/http-server-netty-4.0/build.gradle
# dd-java-agent/instrumentation/play/play-2.6/build.gradle
# dd-java-agent/instrumentation/spring/spring-scheduling-3.1/build.gradle
# dd-java-agent/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/build.gradle
# dd-java-agent/instrumentation/vertx/vertx-web/vertx-web-4.0/build.gradle
# dd-java-agent/instrumentation/websocket/jetty-websocket/jetty-websocket-10/build.gradle
# dd-java-agent/instrumentation/wildfly-9.0/build.gradle
* refactor: setJavaVersion becomes configureCompiler, handles release/source/target
# Conflicts:
# dd-java-agent/agent-tooling/build.gradle
* fix: project.afterEvaluate messing with setting up "testJvm"
* fix: duplicated task config
* fix: Failing :dd-java-agent:agent-tooling tests
When Groovy compiles this code against JDK 21 **but targeting Java 8**,
```
URLClassLoader loader = new URLClassLoader(classpath, null, null) {
@OverRide
Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
...
}
}
```
Groovy will generate super class synthetic accessor methods like
* `super$2$loadClass(Ljava/lang/String;)Ljava/lang/Class;`
* `super$2$loadClass(Ljava/lang/String;Z)Ljava/lang/Class;`
* `super$2$loadClass(Ljava/lang/Module;Ljava/lang/String;)Ljava/lang/Class;`
`java.lang.Module` being missing from Java 8 won't run.
java.lang.NoClassDefFoundError: java/lang/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2729)
at java.lang.Class.privateGetPublicMethods(Class.java:2930)
at java.lang.Class.getMethods(Class.java:1643)
at groovy.lang.MetaClassImpl.inheritInterfaceNewMetaMethods(MetaClassImpl.java:628)
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:368)
at groovy.lang.MetaClassImpl.reinitialize(MetaClassImpl.java:3381)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3376)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:273)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:315)
at datadog.trace.agent.test.BaseExceptionHandlerTest$1.$getStaticMetaClass(BaseExceptionHandlerTest.groovy)
at datadog.trace.agent.test.BaseExceptionHandlerTest$1.<init>(BaseExceptionHandlerTest.groovy)
at datadog.trace.agent.test.BaseExceptionHandlerTest.$spock_feature_1_1(BaseExceptionHandlerTest.groovy:131)
...
Caused by: java.lang.ClassNotFoundException: java.lang.Module
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
...
* fix: Failing :dd-java-agent:agent-ci-visibility
When Groovy compiles this code against JDK 21 **but targeting Java 8**,
```
private static final class MisbehavingClassLoader extends ClassLoader { ... }
```
Groovy will generate super class synthetic accessor methods like
* `super$2$loadClass(Ljava/lang/String;)Ljava/lang/Class;`
* `super$2$loadClass(Ljava/lang/String;Z)Ljava/lang/Class;`
* `super$2$loadClass(Ljava/lang/Module;Ljava/lang/String;)Ljava/lang/Class;`
`java.lang.Module` being missing from Java 8 won't run.
java.lang.NoClassDefFoundError: java/lang/Module
at java.lang.Class.privateGetDeclaredMethods(Class.java:2729)
at java.lang.Class.privateGetPublicMethods(Class.java:2930)
at java.lang.Class.getMethods(Class.java:1643)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1336)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1197)
at java.beans.Introspector.getBeanInfo(Introspector.java:426)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at datadog.trace.civisibility.source.ByteCodeLinesResolverTest.test returns empty method lines when class cannot be loaded(ByteCodeLinesResolverTest.groovy:45)
Caused by: java.lang.ClassNotFoundException: java.lang.Module
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 8 more
* fix: Fix Groovy delegation that was adding interfaces to object delegation.
There was a `NoClassDefFoundError` of `java.lang.constant.Constable` when run on JDK8, this happened
because the `Delegate` annotation makes Groovy adds the interfaces of the delegated object to the
enclosing class. Since JDK12 types like `Integer`, `String` implement `Constable` this fails
when the class is loaded on JDK8 or 11.
See groovy/groovy-eclipse#1436
java.lang.NoClassDefFoundError: java/lang/constant/Constable
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at com.datadog.appsec.event.data.ObjectIntrospectionSpecification.conversion of an element throws(ObjectIntrospectionSpecification.groovy:305)
Caused by: java.lang.ClassNotFoundException: java.lang.constant.Constable
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 11 more
* fix: Fix muzzle detected that compiler generated an invokeinterface for getClass on HttpRequest
Instead, the byte code is now an invokevirtual on Object as the javac in JDK8 does
* fix: Fix jdbc tests because `java.sql.Connection` introduced methods with new types in JDK9
E.g. methods with `java.sql.ShardingKey`, while these methods are default, Groovy still
implements them (implementation actually invokes the interface default method).
org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for Gradle Test Executor 66.
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:65)
...
Caused by: org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:165)
...
Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'foo.bar.IastInstrumentedConnection', classLoader = sun.misc.Launcher$AppClassLoader@73d16e93] resolution failed
at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:103)
at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
...
Caused by: java.lang.NoClassDefFoundError: java/sql/ShardingKey
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2729)
at java.lang.Class.privateGetPublicMethods(Class.java:2930)
* fix: dd-smoke-tests needs to use Java 8
ProcessManager uses the `CharBuffer.flip` method, which is
coming from the super class in JDK 8 so its signature is
`()Ljava.nio.Buffer`, but since JDK9 `CharBuffer` overrides
it, in the bytecode the signatures becomes `()Ljava.nio.CharBuffer`.
This code fails when running with testJvm=8.
* chore: Make spotless happy
* fix: iast-agent was not using configureCompiler
* fix: Make resilience4j modules use configureCompiler
* fix: Replace Groovy's getProperty by Project.findProperty
* fix: vertx-web-5.0 now uses configureCompiler
* fix: smoke appsec/springboot-graphql needs to compile to Java 1.8
* chore: fail early when testJvm is blank
* fix: Enforce ByteCode 1.8 on some jetty projects
* style: Typo
* Revert "fix: Fix muzzle detected that compiler generated an invokeinterface for getClass on HttpRequest"
This reverts commit bc1b15c because muzzle now handles
https://bugs.openjdk.org/browse/JDK-8272715 since #9649
---------
Co-authored-by: Santiago Mola <[email protected]>1 parent 0d75905 commit c9c3e60
File tree
111 files changed
+796
-583
lines changed- buildSrc
- call-site-instrumentation-plugin/src/test/groovy/datadog/trace/plugin/csi/impl/assertion
- src/main
- groovy
- kotlin/datadog/gradle/plugin/muzzle/tasks
- dd-java-agent
- agent-bootstrap
- agent-builder
- agent-ci-visibility
- agent-debugger/debugger-test-scala
- agent-iast
- agent-profiling
- profiling-controller-ddprof
- profiling-controller-jfr
- implementation
- profiling-controller-openjdk
- profiling-controller-oracle
- profiling-ddprof
- agent-tooling
- appsec/src/test/groovy/com/datadog/appsec/event/data
- benchmark-integration/play-perftest
- instrumentation
- akka/akka-http/akka-http-10.6
- axis2-1.3
- cxf-2.1
- exception-profiling
- graal/native-image
- graphql-java/graphql-java-20.0
- jakarta-rs-annotations-3
- java
- java-concurrent
- java-concurrent-1.8
- java-concurrent-21.0
- java-lang
- java-lang-11.0
- java-lang-15.0
- java-lang-17.0
- java-lang-9.0
- java-net/java-net-11.0
- java-nio-1.8
- jdbc
- scalikejdbc
- jersey
- jetty
- jetty-client
- jetty-client-10.0
- jetty-client-12.0
- jetty-server
- jetty-server-11.0
- jetty-server-12.0
- jetty-server-9.0
- junit
- junit-4.10/munit-junit-4
- junit-5.3
- junit-5.8
- kafka/kafka-clients-3.8
- karate
- liberty-20
- liberty-23
- micronaut/http-server-netty-4.0
- mule-4.5
- play/play-2.6
- quartz-2.0
- redisson
- redisson-2.3.0
- redisson-3.10.3
- resilience4j
- resilience4j-2.0
- resilience4j-reactor-2.0
- rmi
- scala-promise
- scala-promise-2.10
- scala-promise-2.13
- scalatest
- scala
- selenium
- spring
- spring-cloud-zuul-2.0
- spring-scheduling-3.1
- spring-security/spring-security-6.0
- spring-webflux/spring-webflux-6.0
- spring-webmvc/spring-webmvc-6.0
- tomcat/tomcat-5.5
- vertx/vertx-web
- vertx-web-4.0
- vertx-web-5.0
- websocket/jetty-websocket/jetty-websocket-10
- wildfly-9.0
- zio/zio-2.0
- testing
- dd-smoke-tests
- appsec
- springboot-graphql
- springboot-security
- concurrent
- java-21
- java-25
- iast-propagation
- iast-util
- iast-util-11
- iast-util-17
- java9-modules
- kafka-3/application/src/main/java/datadog/smoketest/kafka/iast
- play-2.4
- play-2.5
- play-2.6
- play-2.7
- play-2.8-otel
- play-2.8-split-routes
- play-2.8
- quarkus
- rum
- tomcat-10
- tomcat-11
- spring-boot-2.7-webflux
- springboot-java-11
- springboot-java-17
- springboot-jpa
- springboot-openliberty-20
- springboot-openliberty-23
- vertx-3.4
- vertx-3.9-resteasy
- vertx-3.9
- vertx-4.2
- wildfly
- gradle
- internal-api
- internal-api-9
- utils/socket-utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
111 files changed
+796
-583
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
259 | 260 | | |
260 | 261 | | |
261 | 262 | | |
| |||
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
| 300 | + | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
| |||
362 | 364 | | |
363 | 365 | | |
364 | 366 | | |
365 | | - | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
| 386 | + | |
384 | 387 | | |
385 | 388 | | |
386 | 389 | | |
| |||
401 | 404 | | |
402 | 405 | | |
403 | 406 | | |
| 407 | + | |
404 | 408 | | |
405 | 409 | | |
406 | 410 | | |
| |||
461 | 465 | | |
462 | 466 | | |
463 | 467 | | |
| 468 | + | |
464 | 469 | | |
465 | 470 | | |
466 | 471 | | |
| |||
482 | 487 | | |
483 | 488 | | |
484 | 489 | | |
| 490 | + | |
485 | 491 | | |
486 | 492 | | |
487 | 493 | | |
| |||
541 | 547 | | |
542 | 548 | | |
543 | 549 | | |
| 550 | + | |
544 | 551 | | |
545 | 552 | | |
546 | 553 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
163 | 164 | | |
164 | | - | |
165 | | - | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| 105 | + | |
| 106 | + | |
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | 9 | | |
13 | 10 | | |
14 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
76 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 14 | | |
23 | | - | |
24 | | - | |
| 15 | + | |
25 | 16 | | |
26 | 17 | | |
27 | 18 | | |
| |||
Lines changed: 6 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
52 | 46 | | |
53 | 47 | | |
54 | 48 | | |
| |||
0 commit comments