Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix muzzle failure on calls to primitive array clone #5405

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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