From 3235f3a3fb84bf4bb3b0b9679d126aeb03499756 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:01:29 +0100 Subject: [PATCH] do not use module opener for java < 9 --- .../instrumentation/InstrumentationModuleInstaller.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/instrumentation/InstrumentationModuleInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/instrumentation/InstrumentationModuleInstaller.java index ef45ac208226..a0924738e44b 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/instrumentation/InstrumentationModuleInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/instrumentation/InstrumentationModuleInstaller.java @@ -43,6 +43,7 @@ import net.bytebuddy.description.annotation.AnnotationSource; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; +import net.bytebuddy.utility.JavaModule; public final class InstrumentationModuleInstaller { @@ -213,7 +214,8 @@ private AgentBuilder installInjectingModule( .transform(ConstantAdjuster.instance()) .transform( (builder, typeDescription, classLoader, module, protectionDomain) -> { - if (instrumentationModule instanceof ExperimentalInstrumentationModule + if (JavaModule.isSupported() + && instrumentationModule instanceof ExperimentalInstrumentationModule && !openerRun.get()) { ExperimentalInstrumentationModule experimentalModule = (ExperimentalInstrumentationModule) instrumentationModule;