aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/javassist
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2012-11-15 15:06:33 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2012-11-15 15:06:33 +0000
commit226a8f53e5d26d8a4a5aefcfd09340bbc9caf7ce (patch)
treecc37a3cbb8524ff7cee6acb4fcf366c78bb4bdc8 /src/test/javassist
parentc135586d0914166b9ec51eef0e5dea07be8c7e95 (diff)
downloadjavassist-226a8f53e5d26d8a4a5aefcfd09340bbc9caf7ce.tar.gz
javassist-226a8f53e5d26d8a4a5aefcfd09340bbc9caf7ce.zip
fixed JASSIST-177
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@686 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/test/javassist')
-rw-r--r--src/test/javassist/bytecode/StackMapTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/javassist/bytecode/StackMapTest.java b/src/test/javassist/bytecode/StackMapTest.java
index c3be2231..1004b29c 100644
--- a/src/test/javassist/bytecode/StackMapTest.java
+++ b/src/test/javassist/bytecode/StackMapTest.java
@@ -13,6 +13,7 @@ import javassist.ClassPool;
import javassist.CodeConverter;
import javassist.CtClass;
import javassist.CtMethod;
+import javassist.CtNewConstructor;
import javassist.CtNewMethod;
import javassist.JvstTest;
import javassist.Loader;
@@ -779,6 +780,36 @@ public class StackMapTest extends TestCase {
assertTrue(two.subtypeOf(objarray));
}
+ public void testJsr() throws Exception {
+ CtClass cc = loader.makeClass("javassist.bytecode.StackMapTestJsrTest");
+ ClassFile cf = cc.getClassFile();
+ cf.setMajorVersion(ClassFile.JAVA_6);
+ ConstPool cp = cf.getConstPool();
+ MethodInfo mi = new MethodInfo(cp, "test", "()I");
+ mi.setAccessFlags(AccessFlag.PUBLIC);
+ Bytecode code = new Bytecode(cp, 1, 3);
+ code.addIconst(3);
+ code.addIstore(1);
+ code.add(Opcode.JSR);
+ code.addIndex(5);
+ code.addIload(1);
+ code.add(Opcode.IRETURN);
+ code.addAstore(2);
+ code.addRet(2);
+ CodeAttribute ca = code.toCodeAttribute();
+ mi.addAttribute(ca);
+ mi.rebuildStackMap(loader);
+ cf.addMethod(mi);
+ cc.addConstructor(CtNewConstructor.make("public StackMapTestJsrTest() {}", cc));
+ cc.addMethod(CtMethod.make("public static void main(String[] args) {"
+ + "new javassist.bytecode.StackMapTestJsrTest().test();"
+ + "}",
+ cc));
+ cc.writeFile();
+ // Object t1 = make(cc.getName());
+ // assertEquals(3, invoke(t1, "test"));
+ }
+
public void tstCtClassType() throws Exception {
ClassPool cp = ClassPool.getDefault();
CtClass cc = cp.get("javassist.CtClassType");