This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/master by this push:
new ae10173 add support for invokestatic of an InterfaceMethodref (#39)
ae10173 is described below
commit ae1017364bad6dab70e73efd2fe23f0a9c2cfeef
Author: Mark Roberts <[email protected]>
AuthorDate: Mon Jun 1 14:27:08 2020 -0700
add support for invokestatic of an InterfaceMethodref (#39)
---
.../org/apache/bcel/generic/InstructionFactory.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/bcel/generic/InstructionFactory.java
b/src/main/java/org/apache/bcel/generic/InstructionFactory.java
index 32c52cf..8610cd1 100644
--- a/src/main/java/org/apache/bcel/generic/InstructionFactory.java
+++ b/src/main/java/org/apache/bcel/generic/InstructionFactory.java
@@ -83,13 +83,28 @@ public class InstructionFactory implements
InstructionConstants {
*/
public InvokeInstruction createInvoke( final String class_name, final
String name, final Type ret_type,
final Type[] arg_types, final short kind ) {
+ return createInvoke(class_name, name, ret_type, arg_types, kind, kind
== Const.INVOKEINTERFACE);
+ }
+
+ /** Create an invoke instruction. (Except for invokedynamic.)
+ *
+ * @param class_name name of the called class
+ * @param name name of the called method
+ * @param ret_type return type of method
+ * @param arg_types argument types of method
+ * @param kind how to invoke: INVOKEINTERFACE, INVOKESTATIC,
INVOKEVIRTUAL, or INVOKESPECIAL
+ * @param use_interface force use of InterfaceMethodref
+ * @since 6.4.2
+ */
+ public InvokeInstruction createInvoke( final String class_name, final
String name, final Type ret_type,
+ final Type[] arg_types, final short kind, final boolean
use_interface ) {
int index;
int nargs = 0;
final String signature = Type.getMethodSignature(ret_type, arg_types);
for (final Type arg_type : arg_types) {
nargs += arg_type.getSize();
}
- if (kind == Const.INVOKEINTERFACE) {
+ if (use_interface) {
index = cp.addInterfaceMethodref(class_name, name, signature);
} else {
index = cp.addMethodref(class_name, name, signature);