src/share/classes/jdk/internal/org/objectweb/asm/util/TraceAnnotationVisitor.java

Print this page




  59 package jdk.internal.org.objectweb.asm.util;
  60 
  61 import jdk.internal.org.objectweb.asm.AnnotationVisitor;
  62 import jdk.internal.org.objectweb.asm.Opcodes;
  63 
  64 /**
  65  * An {@link AnnotationVisitor} that prints the annotations it visits with a
  66  * {@link Printer}.
  67  *
  68  * @author Eric Bruneton
  69  */
  70 public final class TraceAnnotationVisitor extends AnnotationVisitor {
  71 
  72     private final Printer p;
  73 
  74     public TraceAnnotationVisitor(final Printer p) {
  75         this(null, p);
  76     }
  77 
  78     public TraceAnnotationVisitor(final AnnotationVisitor av, final Printer p) {
  79         super(Opcodes.ASM4, av);
  80         this.p = p;
  81     }
  82 
  83     @Override
  84     public void visit(final String name, final Object value) {
  85         p.visit(name, value);
  86         super.visit(name, value);
  87     }
  88 
  89     @Override
  90     public void visitEnum(
  91         final String name,
  92         final String desc,
  93         final String value)
  94     {
  95         p.visitEnum(name, desc, value);
  96         super.visitEnum(name, desc, value);
  97     }
  98 
  99     @Override
 100     public AnnotationVisitor visitAnnotation(
 101         final String name,
 102         final String desc)
 103     {
 104         Printer p = this.p.visitAnnotation(name, desc);
 105         AnnotationVisitor av = this.av == null
 106                 ? null
 107                 : this.av.visitAnnotation(name, desc);
 108         return new TraceAnnotationVisitor(av, p);
 109     }
 110 
 111     @Override
 112     public AnnotationVisitor visitArray(final String name) {
 113         Printer p = this.p.visitArray(name);
 114         AnnotationVisitor av = this.av == null
 115                 ? null
 116                 : this.av.visitArray(name);
 117         return new TraceAnnotationVisitor(av, p);
 118     }
 119 
 120     @Override
 121     public void visitEnd() {
 122         p.visitAnnotationEnd();
 123         super.visitEnd();
 124     }
 125 }


  59 package jdk.internal.org.objectweb.asm.util;
  60 
  61 import jdk.internal.org.objectweb.asm.AnnotationVisitor;
  62 import jdk.internal.org.objectweb.asm.Opcodes;
  63 
  64 /**
  65  * An {@link AnnotationVisitor} that prints the annotations it visits with a
  66  * {@link Printer}.
  67  *
  68  * @author Eric Bruneton
  69  */
  70 public final class TraceAnnotationVisitor extends AnnotationVisitor {
  71 
  72     private final Printer p;
  73 
  74     public TraceAnnotationVisitor(final Printer p) {
  75         this(null, p);
  76     }
  77 
  78     public TraceAnnotationVisitor(final AnnotationVisitor av, final Printer p) {
  79         super(Opcodes.ASM5, av);
  80         this.p = p;
  81     }
  82 
  83     @Override
  84     public void visit(final String name, final Object value) {
  85         p.visit(name, value);
  86         super.visit(name, value);
  87     }
  88 
  89     @Override
  90     public void visitEnum(final String name, final String desc,
  91             final String value) {



  92         p.visitEnum(name, desc, value);
  93         super.visitEnum(name, desc, value);
  94     }
  95 
  96     @Override
  97     public AnnotationVisitor visitAnnotation(final String name,
  98             final String desc) {


  99         Printer p = this.p.visitAnnotation(name, desc);
 100         AnnotationVisitor av = this.av == null ? null : this.av
 101                 .visitAnnotation(name, desc);

 102         return new TraceAnnotationVisitor(av, p);
 103     }
 104 
 105     @Override
 106     public AnnotationVisitor visitArray(final String name) {
 107         Printer p = this.p.visitArray(name);
 108         AnnotationVisitor av = this.av == null ? null : this.av
 109                 .visitArray(name);

 110         return new TraceAnnotationVisitor(av, p);
 111     }
 112 
 113     @Override
 114     public void visitEnd() {
 115         p.visitAnnotationEnd();
 116         super.visitEnd();
 117     }
 118 }