Fix muzzle failure on calls to primitive array clone (#5405)

This commit is contained in:
Lauri Tulmin 2022-02-22 19:10:47 +02:00 committed by GitHub
parent ceb36c4a17
commit 84b46cbc48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -362,6 +362,12 @@ final class ReferenceCollectingClassVisitor extends ClassVisitor {
? 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) {

View File

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