aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShigeru Chiba <chibash@users.noreply.github.com>2016-07-31 12:24:55 +0900
committerGitHub <noreply@github.com>2016-07-31 12:24:55 +0900
commit8b4d1e62750f7b5785f6df3258aced6314b82057 (patch)
tree5b7e611b719abe1c1195abd8d0103b60397600f8 /src
parentb26c2c8d98cb6d18823ecb117f76d1ce482f7fc4 (diff)
parentc0b62eeabad1f96da80f26339f6cd1986330174f (diff)
downloadjavassist-8b4d1e62750f7b5785f6df3258aced6314b82057.tar.gz
javassist-8b4d1e62750f7b5785f6df3258aced6314b82057.zip
Merge pull request #96 from jboss-javassist/master
bug fixes from master
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/bytecode/Bytecode.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/Bytecode.java b/src/main/javassist/bytecode/Bytecode.java
index 4de69dab..34068f8d 100644
--- a/src/main/javassist/bytecode/Bytecode.java
+++ b/src/main/javassist/bytecode/Bytecode.java
@@ -1025,13 +1025,20 @@ public class Bytecode extends ByteVector implements Cloneable, Opcode {
* @see Descriptor#ofMethod(CtClass,CtClass[])
*/
public void addInvokestatic(CtClass clazz, String name, String desc) {
- addInvokestatic(constPool.addClassInfo(clazz), name, desc);
+ boolean isInterface;
+ if (clazz == THIS)
+ isInterface = false;
+ else
+ isInterface = clazz.isInterface();
+
+ addInvokestatic(constPool.addClassInfo(clazz), name, desc, isInterface);
}
/**
* Appends INVOKESTATIC.
*
* @param classname the fully-qualified class name.
+ * It must not be an interface-type name.
* @param name the method name
* @param desc the descriptor of the method signature.
*
@@ -1045,15 +1052,26 @@ public class Bytecode extends ByteVector implements Cloneable, Opcode {
* Appends INVOKESTATIC.
*
* @param clazz the index of <code>CONSTANT_Class_info</code>
- * structure.
+ * structure. It must not be an interface type.
* @param name the method name
* @param desc the descriptor of the method signature.
*
* @see Descriptor#ofMethod(CtClass,CtClass[])
*/
public void addInvokestatic(int clazz, String name, String desc) {
+ addInvokestatic(clazz, name, desc, false);
+ }
+
+ private void addInvokestatic(int clazz, String name, String desc,
+ boolean isInterface) {
add(INVOKESTATIC);
- addIndex(constPool.addMethodrefInfo(clazz, name, desc));
+ int index;
+ if (isInterface)
+ index = constPool.addInterfaceMethodrefInfo(clazz, name, desc);
+ else
+ index = constPool.addMethodrefInfo(clazz, name, desc);
+
+ addIndex(index);
growStack(Descriptor.dataSize(desc));
}