Package org.ow2.asm

Examples of org.ow2.asm.MethodVisitor.visitCode()


    }

    private void returnInsns(final ClassWriter cw) {
        MethodVisitor mv;
        mv = cw.visitMethod(ACC_STATIC, "ireturnInsn", "()I", null, null);
        mv.visitCode();
        mv.visitInsn(ICONST_0);
        mv.visitInsn(IRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        mv = cw.visitMethod(ACC_PRIVATE, "lreturnInsn", "()J", null, null);
View Full Code Here


        }
    }

    public void testIllegalFrameType() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitFrame(123, 0, null, 0, null);
            fail();
        } catch (Exception e) {
        }
View Full Code Here

        }
    }

    public void testIllegalFrameLocalCount() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitFrame(F_SAME, 1, new Object[] { INTEGER }, 0, null);
            fail();
        } catch (Exception e) {
        }
View Full Code Here

        mv.visitInsn(ICONST_0);
        mv.visitInsn(IRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        mv = cw.visitMethod(ACC_PRIVATE, "lreturnInsn", "()J", null, null);
        mv.visitCode();
        mv.visitInsn(LCONST_0);
        mv.visitInsn(LRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        mv = cw.visitMethod(0, "freturnInsn", "()F", null, null);
View Full Code Here

        }
    }

    public void testIllegalFrameStackCount() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitFrame(F_SAME, 0, null, 1, new Object[] { INTEGER });
            fail();
        } catch (Exception e) {
        }
View Full Code Here

        mv.visitInsn(LCONST_0);
        mv.visitInsn(LRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        mv = cw.visitMethod(0, "freturnInsn", "()F", null, null);
        mv.visitCode();
        mv.visitInsn(FCONST_0);
        mv.visitInsn(FRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        mv = cw.visitMethod(0, "dreturnInsn", "()D", null, null);
View Full Code Here

        }
    }

    public void testIllegalFrameLocalArray() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitFrame(F_APPEND, 1, new Object[0], 0, null);
            fail();
        } catch (Exception e) {
        }
View Full Code Here

        mv.visitInsn(FCONST_0);
        mv.visitInsn(FRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
        mv = cw.visitMethod(0, "dreturnInsn", "()D", null, null);
        mv.visitCode();
        mv.visitInsn(DCONST_0);
        mv.visitInsn(DRETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
View Full Code Here

        }
    }

    public void testIllegalFrameStackArray() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitFrame(F_SAME1, 0, null, 1, new Object[0]);
            fail();
        } catch (Exception e) {
        }
View Full Code Here

        }
    }

    public void testIllegalFrameValue() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitFrame(F_FULL, 1, new Object[] { "LC;" }, 0, null);
            fail();
        } catch (Exception e) {
        }
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.