Skip to content

Commit 4e32d1c

Browse files
committed
fix instrumenting lambdas on jdk24
1 parent 411f6b2 commit 4e32d1c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
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;");

0 commit comments

Comments
 (0)