Test Java 24-ea (#13376)
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
This commit is contained in:
parent
fec0af61e2
commit
b26b074e75
|
@ -233,6 +233,7 @@ jobs:
|
||||||
- 17
|
- 17
|
||||||
- 21
|
- 21
|
||||||
- 23
|
- 23
|
||||||
|
- 24-ea
|
||||||
vm:
|
vm:
|
||||||
- hotspot
|
- hotspot
|
||||||
- openj9
|
- openj9
|
||||||
|
|
|
@ -11,12 +11,17 @@ import io.opentelemetry.javaagent.bootstrap.executors.ExecutorAdviceHelper;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import org.junit.jupiter.api.Assumptions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class VirtualThreadTest {
|
class VirtualThreadTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDisableContextPropagation() throws Exception {
|
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();
|
TestRunnable testRunnable = new TestRunnable();
|
||||||
Thread thread = Thread.ofVirtual().start(testRunnable);
|
Thread thread = Thread.ofVirtual().start(testRunnable);
|
||||||
thread.join();
|
thread.join();
|
||||||
|
|
|
@ -116,9 +116,13 @@ public class InnerClassLambdaMetafactoryInstrumentation implements TypeInstrumen
|
||||||
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
|
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
|
||||||
// if current instruction is a call to ASM ClassWriter.toByteArray() insert call to
|
// if current instruction is a call to ASM ClassWriter.toByteArray() insert call to
|
||||||
// our lambda transformer
|
// our lambda transformer
|
||||||
if (opcode == Opcodes.INVOKEVIRTUAL
|
if ((opcode == Opcodes.INVOKEVIRTUAL
|
||||||
&& "toByteArray".equals(name)
|
&& "toByteArray".equals(name)
|
||||||
&& "()[B".equals(descriptor)) {
|
&& "()[B".equals(descriptor))
|
||||||
|
// jdk 24
|
||||||
|
|| (opcode == Opcodes.INVOKEINTERFACE
|
||||||
|
&& "build".equals(name)
|
||||||
|
&& descriptor.endsWith(")[B"))) {
|
||||||
mv.visitVarInsn(Opcodes.ALOAD, 0);
|
mv.visitVarInsn(Opcodes.ALOAD, 0);
|
||||||
mv.visitFieldInsn(
|
mv.visitFieldInsn(
|
||||||
Opcodes.GETFIELD, slashClassName, "lambdaClassName", "Ljava/lang/String;");
|
Opcodes.GETFIELD, slashClassName, "lambdaClassName", "Ljava/lang/String;");
|
||||||
|
|
|
@ -14,6 +14,11 @@ dependencies {
|
||||||
testInstrumentation(project(":instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-cxf-3.2:javaagent"))
|
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 {
|
tasks.withType<Test>().configureEach {
|
||||||
// required on jdk17
|
// required on jdk17
|
||||||
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
|
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
|
||||||
|
|
|
@ -15,6 +15,11 @@ dependencies {
|
||||||
testInstrumentation(project(":instrumentation:jaxws:jaxws-jws-api-1.1:javaagent"))
|
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 {
|
tasks.withType<Test>().configureEach {
|
||||||
// required on jdk17
|
// required on jdk17
|
||||||
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
|
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
|
||||||
|
|
|
@ -28,6 +28,11 @@ dependencies {
|
||||||
latestDepTestLibrary("org.springframework.boot:spring-boot:2.+") // documented limitation
|
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 {
|
tasks.withType<Test>().configureEach {
|
||||||
jvmArgs("-Djava.rmi.server.hostname=127.0.0.1")
|
jvmArgs("-Djava.rmi.server.hostname=127.0.0.1")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue