ArrayList allAnnotations = new ArrayList();
ArrayList allPositions = new ArrayList();
int bestOffset = Integer.MAX_VALUE;
while (iter.hasNext()) {
Annotation annot = (Annotation) iter.next();
if (RutaCorrectionProcessor.isQuickFixableType(annot)) {
Position pos = model.getPosition(annot);
if (pos != null && isInside(pos.offset, rangeStart, rangeEnd)) { // inside
// our
// range?
allAnnotations.add(annot);
allPositions.add(pos);
bestOffset = processAnnotation(annot, pos, invocationLocation, bestOffset);
}
}
}
if (bestOffset == Integer.MAX_VALUE) {
return invocationLocation;
}
for (int i = 0; i < allPositions.size(); i++) {
Position pos = (Position) allPositions.get(i);
if (isInside(bestOffset, pos.offset, pos.offset + pos.length)) {
resultingAnnotations.add(allAnnotations.get(i));
}
}
return bestOffset;
} else {
while (iter.hasNext()) {
Annotation annot = (Annotation) iter.next();
if (RutaCorrectionProcessor.isQuickFixableType(annot)) {
Position pos = model.getPosition(annot);
if (pos != null && isInside(invocationLocation, pos.offset, pos.offset + pos.length)) {
resultingAnnotations.add(annot);
}