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

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

Introduction

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

Prototype

public void visitTypeInsn(final int opcode, final String type) 

Source Link

Document

Visits a type instruction.

Usage

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

License:Open Source License

protected void generateFieldAccess(LocalVariablesSorter mv, Pair<String, String> field) {
    Type fieldType = Type.getType(field.getValue1());

    if (!isAllowed(fieldType.getClassName())) {
        return;//from www .  j  a v a2  s  .c om
    }

    this.getFieldOwner(mv);
    mv.visitInsn(DUP);

    mv.visitFieldInsn(GETFIELD, this.thisClass.getASMType().getInternalName(), field.getValue0(),
            field.getValue1());
    mv.visitMethodInsn(INVOKESTATIC, REGISTER_METHOD_OWNER_NAME, REGISTER_METHOD_NAME,
            REGISTER_METHOD_SIMPLE_DESC, false);
    if (this.version != null) {
        mv.visitTypeInsn(CHECKCAST, this.version.eraseUpdatableType(this.namespace.getClass(fieldType))
                .getASMType().getInternalName());
    } else {
        mv.visitTypeInsn(CHECKCAST, fieldType.getInternalName());
    }
    mv.visitFieldInsn(PUTFIELD, this.thisClass.getASMType().getInternalName(), field.getValue0(),
            field.getValue1());
}