Search in sources :

Example 1 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project jdk8u_jdk by JetBrains.

the class TraceAnnotationVisitor method visitArray.

@Override
public AnnotationVisitor visitArray(final String name) {
    Printer p = this.p.visitArray(name);
    AnnotationVisitor av = this.av == null ? null : this.av.visitArray(name);
    return new TraceAnnotationVisitor(av, p);
}
Also used : AnnotationVisitor(jdk.internal.org.objectweb.asm.AnnotationVisitor)

Example 2 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project jdk8u_jdk by JetBrains.

the class TraceAnnotationVisitor method visitAnnotation.

@Override
public AnnotationVisitor visitAnnotation(final String name, final String desc) {
    Printer p = this.p.visitAnnotation(name, desc);
    AnnotationVisitor av = this.av == null ? null : this.av.visitAnnotation(name, desc);
    return new TraceAnnotationVisitor(av, p);
}
Also used : AnnotationVisitor(jdk.internal.org.objectweb.asm.AnnotationVisitor)

Example 3 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project jdk8u_jdk by JetBrains.

the class TraceClassVisitor method visitTypeAnnotation.

@Override
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
    Printer p = this.p.visitClassTypeAnnotation(typeRef, typePath, desc, visible);
    AnnotationVisitor av = cv == null ? null : cv.visitTypeAnnotation(typeRef, typePath, desc, visible);
    return new TraceAnnotationVisitor(av, p);
}
Also used : AnnotationVisitor(jdk.internal.org.objectweb.asm.AnnotationVisitor)

Example 4 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project jdk8u_jdk by JetBrains.

the class MethodNode method accept.

/**
     * Makes the given method visitor visit this method.
     *
     * @param mv
     *            a method visitor.
     */
public void accept(final MethodVisitor mv) {
    // visits the method parameters
    int i, j, n;
    n = parameters == null ? 0 : parameters.size();
    for (i = 0; i < n; i++) {
        ParameterNode parameter = parameters.get(i);
        mv.visitParameter(parameter.name, parameter.access);
    }
    // visits the method attributes
    if (annotationDefault != null) {
        AnnotationVisitor av = mv.visitAnnotationDefault();
        AnnotationNode.accept(av, null, annotationDefault);
        if (av != null) {
            av.visitEnd();
        }
    }
    n = visibleAnnotations == null ? 0 : visibleAnnotations.size();
    for (i = 0; i < n; ++i) {
        AnnotationNode an = visibleAnnotations.get(i);
        an.accept(mv.visitAnnotation(an.desc, true));
    }
    n = invisibleAnnotations == null ? 0 : invisibleAnnotations.size();
    for (i = 0; i < n; ++i) {
        AnnotationNode an = invisibleAnnotations.get(i);
        an.accept(mv.visitAnnotation(an.desc, false));
    }
    n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations.size();
    for (i = 0; i < n; ++i) {
        TypeAnnotationNode an = visibleTypeAnnotations.get(i);
        an.accept(mv.visitTypeAnnotation(an.typeRef, an.typePath, an.desc, true));
    }
    n = invisibleTypeAnnotations == null ? 0 : invisibleTypeAnnotations.size();
    for (i = 0; i < n; ++i) {
        TypeAnnotationNode an = invisibleTypeAnnotations.get(i);
        an.accept(mv.visitTypeAnnotation(an.typeRef, an.typePath, an.desc, false));
    }
    n = visibleParameterAnnotations == null ? 0 : visibleParameterAnnotations.length;
    for (i = 0; i < n; ++i) {
        List<?> l = visibleParameterAnnotations[i];
        if (l == null) {
            continue;
        }
        for (j = 0; j < l.size(); ++j) {
            AnnotationNode an = (AnnotationNode) l.get(j);
            an.accept(mv.visitParameterAnnotation(i, an.desc, true));
        }
    }
    n = invisibleParameterAnnotations == null ? 0 : invisibleParameterAnnotations.length;
    for (i = 0; i < n; ++i) {
        List<?> l = invisibleParameterAnnotations[i];
        if (l == null) {
            continue;
        }
        for (j = 0; j < l.size(); ++j) {
            AnnotationNode an = (AnnotationNode) l.get(j);
            an.accept(mv.visitParameterAnnotation(i, an.desc, false));
        }
    }
    if (visited) {
        instructions.resetLabels();
    }
    n = attrs == null ? 0 : attrs.size();
    for (i = 0; i < n; ++i) {
        mv.visitAttribute(attrs.get(i));
    }
    // visits the method's code
    if (instructions.size() > 0) {
        mv.visitCode();
        // visits try catch blocks
        n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size();
        for (i = 0; i < n; ++i) {
            tryCatchBlocks.get(i).updateIndex(i);
            tryCatchBlocks.get(i).accept(mv);
        }
        // visits instructions
        instructions.accept(mv);
        // visits local variables
        n = localVariables == null ? 0 : localVariables.size();
        for (i = 0; i < n; ++i) {
            localVariables.get(i).accept(mv);
        }
        // visits local variable annotations
        n = visibleLocalVariableAnnotations == null ? 0 : visibleLocalVariableAnnotations.size();
        for (i = 0; i < n; ++i) {
            visibleLocalVariableAnnotations.get(i).accept(mv, true);
        }
        n = invisibleLocalVariableAnnotations == null ? 0 : invisibleLocalVariableAnnotations.size();
        for (i = 0; i < n; ++i) {
            invisibleLocalVariableAnnotations.get(i).accept(mv, false);
        }
        // visits maxs
        mv.visitMaxs(maxStack, maxLocals);
        visited = true;
    }
    mv.visitEnd();
}
Also used : AnnotationVisitor(jdk.internal.org.objectweb.asm.AnnotationVisitor)

Example 5 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project jdk8u_jdk by JetBrains.

the class TraceMethodVisitor method visitLocalVariableAnnotation.

@Override
public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) {
    Printer p = this.p.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible);
    AnnotationVisitor av = mv == null ? null : mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible);
    return new TraceAnnotationVisitor(av, p);
}
Also used : AnnotationVisitor(jdk.internal.org.objectweb.asm.AnnotationVisitor)

Aggregations

AnnotationVisitor (jdk.internal.org.objectweb.asm.AnnotationVisitor)31 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ClassReader (jdk.internal.org.objectweb.asm.ClassReader)1 ClassVisitor (jdk.internal.org.objectweb.asm.ClassVisitor)1 ClassWriter (jdk.internal.org.objectweb.asm.ClassWriter)1 FieldVisitor (jdk.internal.org.objectweb.asm.FieldVisitor)1 MethodVisitor (jdk.internal.org.objectweb.asm.MethodVisitor)1