Package org.ow2.asm

Examples of org.ow2.asm.MethodVisitor


        } catch (Exception e) {
        }
    }

    public void testIllegalByteInsnOperand() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitIntInsn(BIPUSH, Integer.MAX_VALUE);
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here


        } catch (Exception e) {
        }
    }

    public void testIllegalShortInsnOperand() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitIntInsn(SIPUSH, Integer.MAX_VALUE);
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        } catch (Exception e) {
        }
    }

    public void testIllegalVarInsnOperand() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitVarInsn(ALOAD, -1);
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        } catch (Exception e) {
        }
    }

    public void testIllegalIntInsnOperand() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitIntInsn(NEWARRAY, 0);
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }

    private void methodInsns(final ClassWriter cw) {
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC,
                "methodInsns",
                "()V",
                null,
                null);
        // invokstatic
        mv.visitMethodInsn(INVOKESTATIC, "pkg/Insns", "ireturn", "()I");
        // invokespecial
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "pkg/Insns", "lreturn", "()J");
        // invokevirtual
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, "pkg/Insns", "freturn", "()F");
        // invokeinterface
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List", "size", "()I");
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
View Full Code Here

        } catch (Exception e) {
        }
    }

    public void testIllegalTypeInsnOperand() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitTypeInsn(NEW, "[I");
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        } catch (Exception e) {
        }
    }

    public void testIllegalLabelInsnOperand() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        Label l = new Label();
        mv.visitLabel(l);
        try {
            mv.visitLabel(l);
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

                String name,
                String desc,
                String signature,
                String[] exceptions)
            {
                final MethodVisitor next = cv.visitMethod(access,
                        name,
                        desc,
                        signature,
                        exceptions);
                if (next == null) {
View Full Code Here

        } catch (Exception e) {
        }
    }

    public void testIllegalTableSwitchParameters1() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitCode();
        try {
            mv.visitTableSwitchInsn(1, 0, new Label(), new Label[0]);
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }

    private void monitorInsns(final ClassWriter cw) {
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC,
                "monitorInsns",
                "()V",
                null,
                null);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(MONITORENTER);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(MONITOREXIT);
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
View Full Code Here

TOP

Related Classes of org.ow2.asm.MethodVisitor

Copyright © 2018 www.massapicom. 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.