Package javassist

Examples of javassist.CtClass.writeFile()


    }

    public void testRebuild2() throws Exception {
        CtClass cc = loader.get("javassist.bytecode.StackMapTest$C3");
        rebuildStackMaps2(cc);
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(7, invoke(t1, "test"));
    }

    public static class C3 {
View Full Code Here


    }

    public void testRebuild3() throws Exception {
        CtClass cc = loader.get("javassist.bytecode.StackMapTest$T3");
        rebuildStackMaps2(cc);
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(1100, invoke(t1, "test"));
    }

    public static interface Intf2 {
View Full Code Here

    }

    public void testRebuildArray() throws Exception {
        CtClass cc = loader.get("javassist.bytecode.StackMapTest$T4");
        rebuildStackMaps2(cc);
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(30, invoke(t1, "test"));
    }

    public static class T4 {
View Full Code Here

    }

    public void testRebuildConstructor() throws Exception {
        CtClass cc = loader.get("javassist.bytecode.StackMapTest$T5");
        rebuildStackMaps2(cc);
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(123, invoke(t1, "test"));
    }

    public static class T5 {
View Full Code Here

    }

    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 {
View Full Code Here

            sbuf.append("s =\"" + i + "\";");

        cc.getDeclaredMethod("foo").insertBefore(sbuf.toString());
        cc.getDeclaredMethod("test2").setBody(loader.get("javassist.bytecode.StackMapTest$T8").getDeclaredMethod("test2"), null);
        //rebuildStackMaps2(cc);
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(110, invoke(t1, "test"));
    }

    public static class T7 {
View Full Code Here

            sbuf.append("s =\"" + i + "\";");

        cc.getDeclaredMethod("foo").insertBefore(sbuf.toString());
        cc.getDeclaredMethod("test2").setBody(loader.get("javassist.bytecode.StackMapTest$T8b").getDeclaredMethod("test2"), null);
        rebuildStackMaps2(cc);
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(110, invoke(t1, "test"));
    }

    public static class T7b {
View Full Code Here

            sbuf.append("s =\"" + i + "\";");

        cc.getDeclaredMethod("foo").insertBefore(sbuf.toString());
        cc.getDeclaredMethod("test2").setBody(loader.get("javassist.bytecode.StackMapTest$T8c").getDeclaredMethod("test2"), null);

        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(100, invoke(t1, "test"));
    }

    public static class T7c {
View Full Code Here

        CtClass orig = loader.get("javassist.bytecode.StackMapTest$T8d");
        CtMethod origM = orig.getDeclaredMethod("test2");
        writeLdcw(origM);
        cc.getDeclaredMethod("test2").setBody(origM, null);

        orig.writeFile();
        cc.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(100, invoke(t1, "test"));
    }
View Full Code Here

        CtClass in = loader.get("javassist.bytecode.StackMapTest$T9$In");
        rebuildStackMaps2(cc);
        rebuildStackMaps2(par);
        rebuildStackMaps2(in);
        cc.writeFile();
        in.writeFile();
        par.writeFile();
        Object t1 = make(cc.getName());
        assertEquals(19, invoke(t1, "test"));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.