Skip to content

Commit 06af548

Browse files
committed
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)
1 parent 7acf122 commit 06af548

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dd-java-agent/instrumentation/jdbc/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ tasks.named("latestDepJava11Test") {
8686
javaLauncher = getJavaLauncherFor(11)
8787
}
8888

89+
tasks.withType(GroovyCompile).configureEach {
90+
configureCompiler(
91+
it,
92+
8,
93+
JavaVersion.VERSION_1_8,
94+
"Connection has new methods with new types introduced in Java 9 that are not available on Java 8."
95+
)
96+
}
97+
8998
tasks.withType(Test).configureEach {
9099
usesService(testcontainersLimit)
91100
}

0 commit comments

Comments
 (0)