Search in sources :

Example 26 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project Bytecoder by mirkosertic.

the class TraceMethodVisitor method visitParameterAnnotation.

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

Example 27 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project Bytecoder by mirkosertic.

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 28 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project Bytecoder by mirkosertic.

the class TraceFieldVisitor method visitTypeAnnotation.

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

Example 29 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project Bytecoder by mirkosertic.

the class TraceFieldVisitor method visitAnnotation.

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

Example 30 with AnnotationVisitor

use of jdk.internal.org.objectweb.asm.AnnotationVisitor in project Bytecoder by mirkosertic.

the class AnnotationNode method accept.

/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name, final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
Also used : AnnotationVisitor(jdk.internal.org.objectweb.asm.AnnotationVisitor) List(java.util.List) ArrayList(java.util.ArrayList)

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