1 30 package org.objectweb.asm.optimizer; 31 32 import org.objectweb.asm.AnnotationVisitor; 33 import org.objectweb.asm.Attribute; 34 import org.objectweb.asm.FieldVisitor; 35 36 42 public class FieldConstantsCollector implements FieldVisitor { 43 44 private FieldVisitor fv; 45 46 private ConstantPool cp; 47 48 public FieldConstantsCollector(final FieldVisitor fv, final ConstantPool cp) 49 { 50 this.fv = fv; 51 this.cp = cp; 52 } 53 54 public AnnotationVisitor visitAnnotation( 55 final String desc, 56 final boolean visible) 57 { 58 cp.newUTF8(desc); 59 if (visible) { 60 cp.newUTF8("RuntimeVisibleAnnotations"); 61 } else { 62 cp.newUTF8("RuntimeInvisibleAnnotations"); 63 } 64 return new AnnotationConstantsCollector(fv.visitAnnotation(desc, 65 visible), cp); 66 } 67 68 public void visitAttribute(final Attribute attr) { 69 fv.visitAttribute(attr); 71 } 72 73 public void visitEnd() { 74 fv.visitEnd(); 75 } 76 } 77 | Popular Tags |