/** * {@inheritDoc} */ public AnnotationVisitor visit(String annotationTypeDescriptor, boolean visible) { return fieldVisitor.visitAnnotation(annotationTypeDescriptor, visible); }
/** * Visits a non standard attribute of the field. * * @param attribute an attribute. */ public void visitAttribute(final Attribute attribute) { if (fv != null) { fv.visitAttribute(attribute); } }
/** * Visits the end of the field. This method, which is the last one to be called, is used to inform * the visitor that all the annotations and attributes of the field have been visited. */ public void visitEnd() { if (fv != null) { fv.visitEnd(); } } }
fieldVisitor.visitAnnotation(annotationDescriptor, /* visible = */ true), currentAnnotationOffset, /* named = */ true, fieldVisitor.visitAnnotation(annotationDescriptor, /* visible = */ false), currentAnnotationOffset, /* named = */ true, fieldVisitor.visitTypeAnnotation( context.currentTypeAnnotationTarget, context.currentTypeAnnotationTargetPath, fieldVisitor.visitTypeAnnotation( context.currentTypeAnnotationTarget, context.currentTypeAnnotationTargetPath, fieldVisitor.visitAttribute(attributes); attributes = nextAttribute; fieldVisitor.visitEnd(); return currentOffset;
/** * Visits an annotation on the type of the field. * * @param typeRef a reference to the annotated type. The sort of this type reference must be * {@link TypeReference#FIELD}. See {@link TypeReference}. * @param typePath the path to the annotated type argument, wildcard bound, array element type, or * static inner type within 'typeRef'. May be {@literal null} if the annotation targets * 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not * interested in visiting this annotation. */ public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { if (api < Opcodes.ASM5) { throw new UnsupportedOperationException("This feature requires ASM5"); } if (fv != null) { return fv.visitTypeAnnotation(typeRef, typePath, descriptor, visible); } return null; }
/** * {@inheritDoc} */ public AnnotationVisitor visit(String annotationTypeDescriptor, boolean visible, int typeReference, String typePath) { return fieldVisitor.visitTypeAnnotation(typeReference, TypePath.fromString(typePath), annotationTypeDescriptor, visible); } }
/** * Visits an annotation of the field. * * @param descriptor the class descriptor of the annotation class. * @param visible {@literal true} if the annotation is visible at runtime. * @return a visitor to visit the annotation values, or {@literal null} if this visitor is not * interested in visiting this annotation. */ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (fv != null) { return fv.visitAnnotation(descriptor, visible); } return null; }
/** * {@inheritDoc} */ public void drain(TypeInitializer.Drain drain, ClassVisitor classVisitor, AnnotationValueFilter.Factory annotationValueFilterFactory) { fieldCacheCanAppendEntries = false; TypeInitializer typeInitializer = this.typeInitializer; for (Map.Entry<FieldCacheEntry, FieldDescription.InDefinedShape> entry : registeredFieldCacheEntries.entrySet()) { FieldVisitor fieldVisitor = classVisitor.visitField(entry.getValue().getModifiers(), entry.getValue().getInternalName(), entry.getValue().getDescriptor(), entry.getValue().getGenericSignature(), FieldDescription.NO_DEFAULT_VALUE); if (fieldVisitor != null) { fieldVisitor.visitEnd(); typeInitializer = typeInitializer.expandWith(entry.getKey().storeIn(entry.getValue())); } } drain.apply(classVisitor, typeInitializer, this); for (TypeWriter.MethodPool.Record record : registeredAccessorMethods.values()) { record.apply(classVisitor, this, annotationValueFilterFactory); } for (TypeWriter.MethodPool.Record record : registeredGetters.values()) { record.apply(classVisitor, this, annotationValueFilterFactory); } for (TypeWriter.MethodPool.Record record : registeredSetters.values()) { record.apply(classVisitor, this, annotationValueFilterFactory); } }
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { constraint.assertAnnotation(); return super.visitAnnotation(desc, visible); } }
/** * {@inheritDoc} */ public void apply(ClassVisitor classVisitor, AnnotationValueFilter.Factory annotationValueFilterFactory) { FieldVisitor fieldVisitor = classVisitor.visitField(fieldDescription.getActualModifiers(), fieldDescription.getInternalName(), fieldDescription.getDescriptor(), fieldDescription.getGenericSignature(), FieldDescription.NO_DEFAULT_VALUE); if (fieldVisitor != null) { FieldAttributeAppender.ForInstrumentedField.INSTANCE.apply(fieldVisitor, fieldDescription, annotationValueFilterFactory.on(fieldDescription)); fieldVisitor.visitEnd(); } }
@Override public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { observedTypes.add(Type.getType(descriptor).getInternalName()); AnnotationVisitor annotationVisitor = super.visitAnnotation(descriptor, visible); if (annotationVisitor != null) { return new TypeReferenceAnnotationVisitor(annotationVisitor); } else { return IGNORE_ANNOTATION; } } }
/** * {@inheritDoc} */ public void apply(ClassVisitor classVisitor, AnnotationValueFilter.Factory annotationValueFilterFactory) { FieldVisitor fieldVisitor = classVisitor.visitField(fieldDescription.getActualModifiers(), fieldDescription.getInternalName(), fieldDescription.getDescriptor(), fieldDescription.getGenericSignature(), resolveDefault(FieldDescription.NO_DEFAULT_VALUE)); if (fieldVisitor != null) { attributeAppender.apply(fieldVisitor, fieldDescription, annotationValueFilterFactory.on(fieldDescription)); fieldVisitor.visitEnd(); } }