Skip to content

Commit

Permalink
Fix muzzle failure on calls to primitive array clone (#5405)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Feb 22, 2022
1 parent ceb36c4 commit 84b46cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ public void visitMethodInsn(
? underlyingType(Type.getType(owner))
: Type.getType("L" + owner + ";");

// method invoked on a primitive array type
if (ownerType.getSort() != Type.OBJECT) {
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
return;
}

{ // ref for method return type
Type returnType = underlyingType(methodType.getReturnType());
if (returnType.getSort() == Type.OBJECT) {
Expand Down
2 changes: 2 additions & 0 deletions muzzle/src/test/java/muzzle/TestClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class TestClasses {

public static class MethodBodyAdvice {
@SuppressWarnings("ReturnValueIgnored")
@Advice.OnMethodEnter
public static void methodBodyAdvice() {
A a = new A();
Expand All @@ -24,6 +25,7 @@ public static void methodBodyAdvice() {
a.publicB.methodWithArrays(new String[0]);
B.staticMethod();
A.staticB.method("bar");
new int[0].clone();
}

public static class A {
Expand Down

0 comments on commit 84b46cb

Please sign in to comment.