Test Java 24-ea (#13376)

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
This commit is contained in:
Trask Stalnaker 2025-03-05 07:27:55 -08:00 committed by GitHub
parent fec0af61e2
commit b26b074e75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 3 deletions

View File

@ -233,6 +233,7 @@ jobs:
- 17
- 21
- 23
- 24-ea
vm:
- hotspot
- openj9

View File

@ -11,12 +11,17 @@ import io.opentelemetry.javaagent.bootstrap.executors.ExecutorAdviceHelper;
import java.lang.reflect.Method;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
class VirtualThreadTest {
@Test
void testDisableContextPropagation() throws Exception {
// VirtualThread does not have executeOnCarrierThread method in jdk24
Assumptions.assumeTrue(
Double.parseDouble(System.getProperty("java.specification.version")) < 24);
TestRunnable testRunnable = new TestRunnable();
Thread thread = Thread.ofVirtual().start(testRunnable);
thread.join();

View File

@ -116,9 +116,13 @@ public class InnerClassLambdaMetafactoryInstrumentation implements TypeInstrumen
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
// if current instruction is a call to ASM ClassWriter.toByteArray() insert call to
// our lambda transformer
if (opcode == Opcodes.INVOKEVIRTUAL
&& "toByteArray".equals(name)
&& "()[B".equals(descriptor)) {
if ((opcode == Opcodes.INVOKEVIRTUAL
&& "toByteArray".equals(name)
&& "()[B".equals(descriptor))
// jdk 24
|| (opcode == Opcodes.INVOKEINTERFACE
&& "build".equals(name)
&& descriptor.endsWith(")[B"))) {
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(
Opcodes.GETFIELD, slashClassName, "lambdaClassName", "Ljava/lang/String;");

View File

@ -14,6 +14,11 @@ dependencies {
testInstrumentation(project(":instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-cxf-3.2:javaagent"))
}
otelJava {
// due to security manager deprecation this test does not work on jdk 24 with default configuration
maxJavaVersionForTests.set(JavaVersion.VERSION_23)
}
tasks.withType<Test>().configureEach {
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")

View File

@ -15,6 +15,11 @@ dependencies {
testInstrumentation(project(":instrumentation:jaxws:jaxws-jws-api-1.1:javaagent"))
}
otelJava {
// due to security manager deprecation this test does not work on jdk 24 with default configuration
maxJavaVersionForTests.set(JavaVersion.VERSION_23)
}
tasks.withType<Test>().configureEach {
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")

View File

@ -28,6 +28,11 @@ dependencies {
latestDepTestLibrary("org.springframework.boot:spring-boot:2.+") // documented limitation
}
otelJava {
// due to security manager deprecation this test does not work on jdk 24 with default configuration
maxJavaVersionForTests.set(JavaVersion.VERSION_23)
}
tasks.withType<Test>().configureEach {
jvmArgs("-Djava.rmi.server.hostname=127.0.0.1")
}