ResolvedMember itdIsActually = fieldMunger.getSignature();
Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>();
boolean modificationOccured = false;
for (Iterator<DeclareAnnotation> iter2 = decaFs.iterator(); iter2.hasNext();) {
DeclareAnnotation decaF = iter2.next();
if (decaF.matches(itdIsActually, world)) {
if (decaF.isRemover()) {
LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger);
if (annotationHolder.hasAnnotation(decaF.getAnnotationType())) {
isChanged = true;
// something to remove
annotationHolder.removeAnnotation(decaF.getAnnotationType());
AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
decaF.getSourceLocation(), itdIsActually.getSourceLocation(), true);
} else {
worthRetrying.add(decaF);
}
} else {
LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger);
if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors)) {
continue; // skip this one...
}
annotationHolder.addAnnotation(decaF.getAnnotation());
AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
decaF.getSourceLocation(), itdIsActually.getSourceLocation(), false);
isChanged = true;
modificationOccured = true;
}
} else {
if (!decaF.isStarredAnnotationPattern()) {
worthRetrying.add(decaF); // an annotation is specified
// that might be put on by a
// subsequent decaf
}
}
}
while (!worthRetrying.isEmpty() && modificationOccured) {
modificationOccured = false;
List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
for (Iterator<DeclareAnnotation> iter2 = worthRetrying.iterator(); iter2.hasNext();) {
DeclareAnnotation decaF = iter2.next();
if (decaF.matches(itdIsActually, world)) {
if (decaF.isRemover()) {
LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger);
if (annotationHolder.hasAnnotation(decaF.getAnnotationType())) {
isChanged = true;
// something to remove
annotationHolder.removeAnnotation(decaF.getAnnotationType());
AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
decaF.getSourceLocation(), itdIsActually.getSourceLocation(), true);
forRemoval.add(decaF);
}
} else {
LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger);
if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors)) {
continue; // skip this one...
}
annotationHolder.addAnnotation(decaF.getAnnotation());
AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
decaF.getSourceLocation(), itdIsActually.getSourceLocation(), false);
isChanged = true;
modificationOccured = true;
forRemoval.add(decaF);
}
}