Example usage for org.objectweb.asm.commons LocalVariablesSorter visitCode

List of usage examples for org.objectweb.asm.commons LocalVariablesSorter visitCode

Introduction

In this page you can find the example usage for org.objectweb.asm.commons LocalVariablesSorter visitCode.

Prototype

public void visitCode() 

Source Link

Document

Starts the visit of the method's code, if any (i.e.

Usage

From source file:rubah.bytecode.transformers.AddTraverseMethod.java

License:Open Source License

private void generateTraverseMethod() {
    LocalVariablesSorter mv = new LocalVariablesSorter(TRAVERSE_METHOD_ACC_FLAGS, TRAVERSE_METHOD_DESC,
            this.visitMethod(this.getTraverseMethodAccess(), this.getTraverseMethodName(), TRAVERSE_METHOD_DESC,
                    null, null));/*w w  w. j  av  a2  s. com*/
    mv.visitCode();

    if (isAllowed(this.thisClass.getFqn())) {
        this.generateTraverseMethodPreamble(mv);

        if (!this.fields.isEmpty()) {
            for (Pair<String, String> field : this.fields) {
                this.generateFieldAccess(mv, field);
            }
        }
    }
    mv.visitInsn(RETURN);
    mv.visitMaxs(0, 0);
    mv.visitEnd();
}