private void setAffectedLines(final BugInstance warning, final Bug bug) {
   Iterator<BugAnnotation> annotationIterator = warning.annotationIterator();
   while (annotationIterator.hasNext()) {
     BugAnnotation bugAnnotation = annotationIterator.next();
     if (bugAnnotation instanceof SourceLineAnnotation) {
       SourceLineAnnotation annotation = (SourceLineAnnotation) bugAnnotation;
       bug.addLineRange(new LineRange(annotation.getStartLine(), annotation.getEndLine()));
     }
   }
 }