aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/javassist
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2012-09-24 14:42:54 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2012-09-24 14:42:54 +0000
commitfc32a1d8493f30ee2e543d54797d36e822c8248a (patch)
treee25ac3c2b0ad66528be0fdd5551c19f14a478963 /src/test/javassist
parentb667870a98525cacac572c8657c6f5135e25a385 (diff)
downloadjavassist-fc32a1d8493f30ee2e543d54797d36e822c8248a.tar.gz
javassist-fc32a1d8493f30ee2e543d54797d36e822c8248a.zip
fixed JASSIST-160 by rewriting the whole javassist.bytecode.stackmap package.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@665 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/test/javassist')
-rw-r--r--src/test/javassist/bytecode/StackMapTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/javassist/bytecode/StackMapTest.java b/src/test/javassist/bytecode/StackMapTest.java
index bd21a899..3dba27d3 100644
--- a/src/test/javassist/bytecode/StackMapTest.java
+++ b/src/test/javassist/bytecode/StackMapTest.java
@@ -294,6 +294,51 @@ public class StackMapTest extends TestCase {
}
}
+ public void testRebuildConstructor() throws Exception {
+ CtClass cc = loader.get("javassist.bytecode.StackMapTest$T5");
+ rebuildStackMaps2(cc);
+ cc.writeFile();
+ Object t1 = make(cc.getName());
+ assertEquals(122, invoke(t1, "test"));
+ }
+
+ public static class T5 {
+ int count;
+ public T5() { count = 0; }
+ public T5(int k) {
+ if (k > 0) count = 10;
+ else count = 100;
+ count++;
+ }
+ public T5(double d) {
+ this(d > 0.0 ? 1 : -1);
+ if (d > 1.0) count += 10;
+ else count += 100;
+ count++;
+ }
+ public int test() {
+ return new T5(3).count + new T5(1.0).count;
+ }
+ }
+
+ public void testRebuildConstructor2() throws Exception {
+ CtClass cc = loader.get("javassist.bytecode.StackMapTest$T6");
+ rebuildStackMaps2(cc);
+ cc.writeFile();
+ Object t1 = make(cc.getName());
+ assertEquals(101, invoke(t1, "test2"));
+ }
+
+ public static class T6 {
+ public int test2() {
+ T5 t0 = new T5();
+ T5 t = new T5(t0.count > 0 ? (new T5(t0.count > 0 ? 1 : -1).count) : -1);
+ if (t0.count > 0)
+ t.count += 1000;
+ return t.count;
+ }
+ }
+
public void tstCtClassType() throws Exception {
ClassPool cp = ClassPool.getDefault();
CtClass cc = cp.get("javassist.CtClassType");