}
@Override
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature,
final Object value) {
final FieldVisitor toWrap = wrapped.visitField(access, name, desc, signature, value);
final ClassInfo classInfo = (ClassInfo) wrapped.getInfo();
FieldInfo testFieldInfo = null;
// should be the most recently added field, so iterate backward:
for (int i = classInfo.getFields().size() - 1; i >= 0; i--) {
final FieldInfo atI = classInfo.getFields().get(i);
if (atI.getName().equals(name) && atI.getType().equals(desc)) {
testFieldInfo = atI;
break;
}
}
if (testFieldInfo == null) {
return toWrap;
}
final FieldInfo fieldInfo = testFieldInfo;
return new FieldVisitor(Opcodes.ASM4, toWrap) {
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, fieldInfo);
}