Ensure CHECKCAST is added for arrays as well as objects, fixes #358

This commit is contained in:
Mumfrey committed 2019-09-17 13:48:44 +01:00
1 parent 1dc0522559
commit f18d8f8adf
1 file changed
+1 -1
@@ -746,7 +746,7 @@ public class CallbackInjector extends Injector {
String accessor = CallbackInfoReturnable.getReturnAccessor(callback.target.returnType);
String descriptor = CallbackInfoReturnable.getReturnDescriptor(callback.target.returnType);
callback.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, this.callbackInfoClass, accessor, descriptor, false));
if (callback.target.returnType.getSort() == Type.OBJECT) {
if (callback.target.returnType.getSort() >= Type.ARRAY) {
callback.add(new TypeInsnNode(Opcodes.CHECKCAST, callback.target.returnType.getInternalName()));
}
callback.add(new InsnNode(callback.target.returnType.getOpcode(Opcodes.IRETURN)));