Example usage for org.objectweb.asm MethodVisitor visitTypeAnnotation

List of usage examples for org.objectweb.asm MethodVisitor visitTypeAnnotation

Introduction

In this page you can find the example usage for org.objectweb.asm MethodVisitor visitTypeAnnotation.

Prototype

public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath,
        final String descriptor, final boolean visible) 

Source Link

Document

Visits an annotation on a type in the method signature.

Usage

From source file:com.facebook.buck.jvm.java.abi.TypeAnnotationMirror.java

License:Apache License

@Override
public void appendTo(MethodVisitor method) {
    AnnotationVisitor visitor = method.visitTypeAnnotation(typeRef, typePath, desc, visible);
    visitValues(visitor);/*from   w w  w . ja  v  a  2s  .c o m*/
    visitor.visitEnd();
}

From source file:org.jephyr.activeobject.instrument.ActiveObjectClassAdapter.java

License:Open Source License

private static void acceptAllBeforeCode(MethodNode methodNode, MethodVisitor mv) {
    if (methodNode.parameters != null) {
        for (ParameterNode node : methodNode.parameters) {
            node.accept(mv);//from   w  w w .j a  va  2s .  com
        }
    }

    if (methodNode.annotationDefault != null) {
        AnnotationVisitor av = mv.visitAnnotationDefault();
        if (av != null) {
            acceptAnnotation(av, null, methodNode.annotationDefault);
            av.visitEnd();
        }
    }

    if (methodNode.visibleAnnotations != null) {
        for (AnnotationNode node : methodNode.visibleAnnotations) {
            node.accept(mv.visitAnnotation(node.desc, true));
        }
    }

    if (methodNode.invisibleAnnotations != null) {
        for (AnnotationNode node : methodNode.invisibleAnnotations) {
            node.accept(mv.visitAnnotation(node.desc, false));
        }
    }

    if (methodNode.visibleTypeAnnotations != null) {
        for (TypeAnnotationNode node : methodNode.visibleTypeAnnotations) {
            node.accept(mv.visitTypeAnnotation(node.typeRef, node.typePath, node.desc, true));
        }
    }

    if (methodNode.invisibleTypeAnnotations != null) {
        for (TypeAnnotationNode node : methodNode.invisibleTypeAnnotations) {
            node.accept(mv.visitTypeAnnotation(node.typeRef, node.typePath, node.desc, false));
        }
    }

    if (methodNode.visibleParameterAnnotations != null) {
        int parameter = 0;
        for (List<AnnotationNode> nodes : methodNode.visibleParameterAnnotations) {
            if (nodes != null) {
                for (AnnotationNode node : nodes) {
                    node.accept(mv.visitParameterAnnotation(parameter, node.desc, true));
                }
            }
            parameter++;
        }
    }

    if (methodNode.invisibleParameterAnnotations != null) {
        int parameter = 0;
        for (List<AnnotationNode> nodes : methodNode.invisibleParameterAnnotations) {
            if (nodes != null) {
                for (AnnotationNode node : nodes) {
                    node.accept(mv.visitParameterAnnotation(parameter, node.desc, false));
                }
            }
            parameter++;
        }
    }

    if (methodNode.attrs != null) {
        for (Attribute attribute : methodNode.attrs) {
            mv.visitAttribute(attribute);
        }
    }
}