64 import jdk.internal.org.objectweb.asm.Label;
65 import jdk.internal.org.objectweb.asm.MethodVisitor;
66 import jdk.internal.org.objectweb.asm.Opcodes;
67 import jdk.internal.org.objectweb.asm.TypePath;
68
69 /**
70 * A {@link MethodVisitor} that prints the methods it visits with a
71 * {@link Printer}.
72 *
73 * @author Eric Bruneton
74 */
75 public final class TraceMethodVisitor extends MethodVisitor {
76
77 public final Printer p;
78
79 public TraceMethodVisitor(final Printer p) {
80 this(null, p);
81 }
82
83 public TraceMethodVisitor(final MethodVisitor mv, final Printer p) {
84 super(Opcodes.ASM5, mv);
85 this.p = p;
86 }
87
88 @Override
89 public void visitParameter(String name, int access) {
90 p.visitParameter(name, access);
91 super.visitParameter(name, access);
92 }
93
94 @Override
95 public AnnotationVisitor visitAnnotation(final String desc,
96 final boolean visible) {
97 Printer p = this.p.visitMethodAnnotation(desc, visible);
98 AnnotationVisitor av = mv == null ? null : mv.visitAnnotation(desc,
99 visible);
100 return new TraceAnnotationVisitor(av, p);
101 }
102
103 @Override
104 public AnnotationVisitor visitTypeAnnotation(int typeRef,
|
64 import jdk.internal.org.objectweb.asm.Label;
65 import jdk.internal.org.objectweb.asm.MethodVisitor;
66 import jdk.internal.org.objectweb.asm.Opcodes;
67 import jdk.internal.org.objectweb.asm.TypePath;
68
69 /**
70 * A {@link MethodVisitor} that prints the methods it visits with a
71 * {@link Printer}.
72 *
73 * @author Eric Bruneton
74 */
75 public final class TraceMethodVisitor extends MethodVisitor {
76
77 public final Printer p;
78
79 public TraceMethodVisitor(final Printer p) {
80 this(null, p);
81 }
82
83 public TraceMethodVisitor(final MethodVisitor mv, final Printer p) {
84 super(Opcodes.ASM6, mv);
85 this.p = p;
86 }
87
88 @Override
89 public void visitParameter(String name, int access) {
90 p.visitParameter(name, access);
91 super.visitParameter(name, access);
92 }
93
94 @Override
95 public AnnotationVisitor visitAnnotation(final String desc,
96 final boolean visible) {
97 Printer p = this.p.visitMethodAnnotation(desc, visible);
98 AnnotationVisitor av = mv == null ? null : mv.visitAnnotation(desc,
99 visible);
100 return new TraceAnnotationVisitor(av, p);
101 }
102
103 @Override
104 public AnnotationVisitor visitTypeAnnotation(int typeRef,
|