Skip to content

Commit ec92bff

Browse files
authored
Muzzle: do not generate references for primitive arrays in method body (#8361)
1 parent ca6895a commit ec92bff

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/ReferenceCreator.java

+3
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ public void visitMethodInsn(
390390

391391
@Override
392392
public void visitTypeInsn(final int opcode, final String stype) {
393+
if (ignoreReference(stype)) {
394+
return;
395+
}
393396
Type type = underlyingType(Type.getObjectType(stype));
394397

395398
if (ignoreReference(type.getInternalName())) {

Diff for: dd-java-agent/agent-tooling/src/test/java/datadog/trace/agent/tooling/muzzle/TestAdviceClasses.java

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public static void methodBodyAdvice() {
1616
a.b.aMethodWithArrays(new String[0]);
1717
B.aStaticMethod();
1818
A.staticB.aMethod("bar");
19+
Object barr = new byte[0];
20+
if (barr instanceof byte[]) {
21+
barr = null;
22+
}
1923
}
2024

2125
public static class A {

0 commit comments

Comments
 (0)