Skip to content

Commit b26b074

Browse files
trasklaurit
andauthored
Test Java 24-ea (#13376)
Co-authored-by: Lauri Tulmin <[email protected]>
1 parent fec0af6 commit b26b074

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

.github/workflows/build-common.yml

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ jobs:
233233
- 17
234234
- 21
235235
- 23
236+
- 24-ea
236237
vm:
237238
- hotspot
238239
- openj9

instrumentation/executors/jdk21-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/executors/VirtualThreadTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@
1111
import java.lang.reflect.Method;
1212
import java.util.concurrent.Callable;
1313
import java.util.concurrent.atomic.AtomicBoolean;
14+
import org.junit.jupiter.api.Assumptions;
1415
import org.junit.jupiter.api.Test;
1516

1617
class VirtualThreadTest {
1718

1819
@Test
1920
void testDisableContextPropagation() throws Exception {
21+
// VirtualThread does not have executeOnCarrierThread method in jdk24
22+
Assumptions.assumeTrue(
23+
Double.parseDouble(System.getProperty("java.specification.version")) < 24);
24+
2025
TestRunnable testRunnable = new TestRunnable();
2126
Thread thread = Thread.ofVirtual().start(testRunnable);
2227
thread.join();

instrumentation/internal/internal-lambda/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/lambda/InnerClassLambdaMetafactoryInstrumentation.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,13 @@ public void visitMethodInsn(
116116
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
117117
// if current instruction is a call to ASM ClassWriter.toByteArray() insert call to
118118
// our lambda transformer
119-
if (opcode == Opcodes.INVOKEVIRTUAL
120-
&& "toByteArray".equals(name)
121-
&& "()[B".equals(descriptor)) {
119+
if ((opcode == Opcodes.INVOKEVIRTUAL
120+
&& "toByteArray".equals(name)
121+
&& "()[B".equals(descriptor))
122+
// jdk 24
123+
|| (opcode == Opcodes.INVOKEINTERFACE
124+
&& "build".equals(name)
125+
&& descriptor.endsWith(")[B"))) {
122126
mv.visitVarInsn(Opcodes.ALOAD, 0);
123127
mv.visitFieldInsn(
124128
Opcodes.GETFIELD, slashClassName, "lambdaClassName", "Ljava/lang/String;");

instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/build.gradle.kts

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ dependencies {
1414
testInstrumentation(project(":instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-cxf-3.2:javaagent"))
1515
}
1616

17+
otelJava {
18+
// due to security manager deprecation this test does not work on jdk 24 with default configuration
19+
maxJavaVersionForTests.set(JavaVersion.VERSION_23)
20+
}
21+
1722
tasks.withType<Test>().configureEach {
1823
// required on jdk17
1924
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")

instrumentation/jaxws/jaxws-2.0-tomee-testing/build.gradle.kts

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ dependencies {
1515
testInstrumentation(project(":instrumentation:jaxws:jaxws-jws-api-1.1:javaagent"))
1616
}
1717

18+
otelJava {
19+
// due to security manager deprecation this test does not work on jdk 24 with default configuration
20+
maxJavaVersionForTests.set(JavaVersion.VERSION_23)
21+
}
22+
1823
tasks.withType<Test>().configureEach {
1924
// required on jdk17
2025
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")

instrumentation/spring/spring-rmi-4.0/javaagent/build.gradle.kts

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ dependencies {
2828
latestDepTestLibrary("org.springframework.boot:spring-boot:2.+") // documented limitation
2929
}
3030

31+
otelJava {
32+
// due to security manager deprecation this test does not work on jdk 24 with default configuration
33+
maxJavaVersionForTests.set(JavaVersion.VERSION_23)
34+
}
35+
3136
tasks.withType<Test>().configureEach {
3237
jvmArgs("-Djava.rmi.server.hostname=127.0.0.1")
3338
}

0 commit comments

Comments
 (0)