diff options
-rw-r--r-- | src/main/javassist/CtClass.java | 4 | ||||
-rw-r--r-- | src/main/javassist/bytecode/Bytecode.java | 4 | ||||
-rw-r--r-- | src/test/javassist/JvstTest4.java | 11 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 28697715..f34a565a 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -69,7 +69,7 @@ public abstract class CtClass { /** * The version number of this release. */ - public static final String version = "3.17.1-GA"; + public static final String version = "3.18.0-GA"; /** * Prints the version number and the copyright notice. @@ -80,7 +80,7 @@ public abstract class CtClass { */ public static void main(String[] args) { System.out.println("Javassist version " + CtClass.version); - System.out.println("Copyright (C) 1999-2012 Shigeru Chiba." + System.out.println("Copyright (C) 1999-2013 Shigeru Chiba." + " All Rights Reserved."); } diff --git a/src/main/javassist/bytecode/Bytecode.java b/src/main/javassist/bytecode/Bytecode.java index bea7b6fa..fb4d3ec9 100644 --- a/src/main/javassist/bytecode/Bytecode.java +++ b/src/main/javassist/bytecode/Bytecode.java @@ -1083,7 +1083,7 @@ public class Bytecode extends ByteVector implements Cloneable, Opcode { public void addInvokevirtual(int clazz, String name, String desc) { add(INVOKEVIRTUAL); addIndex(constPool.addMethodrefInfo(clazz, name, desc)); - growStack(Descriptor.dataSize(desc)); // assume CosntPool#REF_invokeStatic + growStack(Descriptor.dataSize(desc) - 1); } /** @@ -1170,7 +1170,7 @@ public class Bytecode extends ByteVector implements Cloneable, Opcode { add(INVOKEDYNAMIC); addIndex(dyn); add(0, 0); - growStack(Descriptor.dataSize(desc) - 1); + growStack(Descriptor.dataSize(desc)); // assume ConstPool#REF_invokeStatic } /** diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index 7cf6178a..768b7400 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -817,4 +817,15 @@ public class JvstTest4 extends JvstTestRoot { assertEquals(10, invoke(obj, "test33")); assertEquals(100, invoke(obj, "test44")); } + + public void testJIRA186() throws Exception { + CtClass cc = sloader.get("test4.JIRA186"); + cc.getDeclaredMethod("test").insertBefore("{" + + " java.util.List l = new java.util.ArrayList();" + + " l.add(this.toString());" + + "}"); + cc.writeFile(); + Object obj = make(cc.getName()); + assertEquals(1, invoke(obj, "test")); + } } |