Example usage for org.objectweb.asm.util CheckMethodAdapter CheckMethodAdapter

List of usage examples for org.objectweb.asm.util CheckMethodAdapter CheckMethodAdapter

Introduction

In this page you can find the example usage for org.objectweb.asm.util CheckMethodAdapter CheckMethodAdapter.

Prototype

protected CheckMethodAdapter(final int api, final MethodVisitor methodVisitor,
        final Map<Label, Integer> labelInsnIndices) 

Source Link

Document

Constructs a new CheckMethodAdapter object.

Usage

From source file:org.elasticsearch.painless.SimpleChecksAdapter.java

License:Apache License

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    MethodVisitor in = cv.visitMethod(access, name, desc, signature, exceptions);
    CheckMethodAdapter checker = new CheckMethodAdapter(WriterConstants.ASM_VERSION, in,
            new HashMap<Label, Integer>()) {
        @Override//from ww  w .j ava 2s .co m
        public void visitJumpInsn(int opcode, Label label) {
            mv.visitJumpInsn(opcode, label);
        }

        @Override
        public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
            mv.visitTryCatchBlock(start, end, handler, type);
        }
    };
    checker.version = WriterConstants.CLASS_VERSION;
    return checker;
}