From 5b36d19d18b61ffbf8400deb36e3098e50910cdb Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Tue, 26 Sep 2017 07:43:22 -0700 Subject: [PATCH] Ensure interfacemethodref can be built for invokestatic calls on interface methods --- .../aspectj/apache/bcel/generic/InstructionFactory.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionFactory.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionFactory.java index 4ff25bd55..c5db1904a 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionFactory.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionFactory.java @@ -82,6 +82,10 @@ public class InstructionFactory implements InstructionConstants { this(null, cp); } + public InvokeInstruction createInvoke(String class_name, String name, Type ret_type, Type[] arg_types, short kind) { + return createInvoke(class_name, name, ret_type, arg_types, kind, false); + } + /** * Create an invoke instruction. * @@ -90,14 +94,15 @@ public class InstructionFactory implements InstructionConstants { * @param ret_type return type of method * @param arg_types argument types of method * @param kind how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL, or INVOKESPECIAL + * @param isInterface for an invokestatic on an interface allows us to tell this method the target is an interface * @see Constants */ - public InvokeInstruction createInvoke(String class_name, String name, Type ret_type, Type[] arg_types, short kind) { + public InvokeInstruction createInvoke(String class_name, String name, Type ret_type, Type[] arg_types, short kind, boolean isInterface) { String signature = Utility.toMethodSignature(ret_type, arg_types); int index; - if (kind == Constants.INVOKEINTERFACE) { + if (kind == Constants.INVOKEINTERFACE || isInterface) { index = cp.addInterfaceMethodref(class_name, name, signature); } else if (kind == Constants.INVOKEDYNAMIC){ throw new IllegalStateException("NYI"); -- 2.39.5