return;
}
IField ifield = type.getField(field.getFieldName());
ISourceRange sourceRange = null;
IScanner scanner = null;
JavaModelException ex = null;
try {
sourceRange = ifield.getNameRange();
} catch (JavaModelException e) {
ex = e;
}
try {
// second try...
if (sourceRange == null) {
sourceRange = ifield.getSourceRange();
}
scanner = initScanner(type, sourceRange);
} catch (JavaModelException e) {
String message = "Can not complete field annotation " + field + " for the field: " + ifield + " in class: "
+ qualifiedClassName + ", type " + type + ", bug " + bug;
if (ex != null) {
// report only first one
e = ex;
}
FindbugsPlugin.getDefault().logMessage(IStatus.WARNING, message, e);
}
if (scanner == null || sourceRange == null) {
return;
}
int lineNbr = scanner.getLineNumber(sourceRange.getOffset());
lineNbr = lineNbr <= 0 ? 1 : lineNbr;
String sourceFileStr = getSourceFileHint(type, qualifiedClassName);
field.setSourceLines(new SourceLineAnnotation(qualifiedClassName, sourceFileStr, lineNbr, lineNbr, 0, 0));
}