diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2013-04-12 09:21:45 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2013-04-12 09:21:45 +0000 |
commit | d5500a2a6f5703f10a703ad6498e28c52c367104 (patch) | |
tree | 3387a12b5552c2f286594c3dfce74989ed9b9eb0 | |
parent | 91f6abdd9e1e637251e9bfae381afc0c6a47c1b9 (diff) | |
download | javassist-d5500a2a6f5703f10a703ad6498e28c52c367104.tar.gz javassist-d5500a2a6f5703f10a703ad6498e28c52c367104.zip |
fixed JASSIST-186
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@702 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-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")); + } } |