public static void generate(Attribute[] old, Attribute[] new_,
List<AttributePatch> patches){
// One patch for runtime, one for non-runtime.
for(boolean isRuntime : new boolean[]{true, false}){
// Find old Annotations
Annotations oldAnnots = null;
for(int i = 0; i < old.length; i++){
boolean correct = false;
correct |= isRuntime &&
old[i] instanceof RuntimeVisibleAnnotations;
correct |= !isRuntime &&
old[i] instanceof RuntimeInvisibleAnnotations;
if(correct){
oldAnnots = (Annotations)old[i];
break;
}
}
//Find new Annotations
Annotations newAnnots = null;
for(int i = 0; i < new_.length; i++){
boolean correct = false;
correct |= isRuntime &&
new_[i] instanceof RuntimeVisibleAnnotations;
correct |= !isRuntime &&
new_[i] instanceof RuntimeInvisibleAnnotations;
if(correct){
newAnnots = (Annotations)new_[i];
break;
}
}
AnnotationEntry[] oldEntries = oldAnnots == null ?
new AnnotationEntry[0] :
oldAnnots.getAnnotationEntries();
AnnotationEntry[] newEntries = newAnnots == null ?
new AnnotationEntry[0] :
newAnnots.getAnnotationEntries();
// Finds entries which are new.
List<AnnotationEntry> addedEntries =
new ArrayList<AnnotationEntry>();
outer: for(AnnotationEntry newAe : newEntries){