From: Andy Clement Date: Tue, 26 Sep 2017 14:43:22 +0000 (-0700) Subject: Ensure interfacemethodref can be built for invokestatic calls on interface methods X-Git-Tag: V1_9_0_RC3~2^2~65 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5b36d19d18b61ffbf8400deb36e3098e50910cdb;p=aspectj.git Ensure interfacemethodref can be built for invokestatic calls on interface methods --- 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");