public boolean handleMessage(IMessage message) throws AbortException {
if (!(message.isError() || message.isWarning()))
return sink.handleMessage(message);
// we only care about warnings and errors here...
ISourceLocation sLoc = message.getSourceLocation();
// See bug 62073. We should assert that the caller pass the correct primary source location.
// But for AJ1.2 final we will simply do less processing of the locations if that is not the
// case (By calling sink.handleMessage()) - this ensures we don't put out bogus source context info.
if (sLoc instanceof EclipseSourceLocation) {
EclipseSourceLocation esLoc = (EclipseSourceLocation) sLoc;
if (currentlyWeaving != null && esLoc.getCompilationResult() != null) {
if (!currentlyWeaving.equals(((EclipseSourceLocation) sLoc).getCompilationResult()))
return sink.handleMessage(message);
// throw new RuntimeException("Primary source location must match the file we are currently processing!");
}
}
// bug 128618 - want to do a similar thing as in bug 62073 above, however
// we're not an EclipseSourceLocation we're a SourceLocation.
if (sLoc instanceof SourceLocation) {
SourceLocation sl = (SourceLocation) sLoc;
if (currentlyWeaving != null && sl.getSourceFile() != null) {
if (!String.valueOf(currentlyWeaving.getFileName()).equals(sl.getSourceFile().getAbsolutePath())) {
return sink.handleMessage(message);
// throw new RuntimeException("Primary source location must match the file we are currently processing!");
}
}
}
CompilationResult problemSource = currentlyWeaving;
if (problemSource == null) {
// must be a problem found during completeTypeBindings phase of begin to compile
if (sLoc instanceof EclipseSourceLocation) {
problemSource = ((EclipseSourceLocation) sLoc).getCompilationResult();
}
if (problemSource == null) {
// XXX this is ok for ajc, will have to do better for AJDT in time...
return sink.handleMessage(message);
}
}
int startPos = getStartPos(sLoc, problemSource);
int endPos = getEndPos(sLoc, problemSource);
int severity = message.isError() ? ProblemSeverities.Error : ProblemSeverities.Warning;
char[] filename = problemSource.fileName;
boolean usedBinarySourceFileName = false;
if (problemSource.isFromBinarySource()) {
if (sLoc != null) {
filename = sLoc.getSourceFile().getPath().toCharArray();
usedBinarySourceFileName = true;
}
}
ReferenceContext referenceContext = findReferenceContextFor(problemSource);
CategorizedProblem problem = compiler.problemReporter.createProblem(filename, IProblem.Unclassified, new String[0],
new String[] { message.getMessage() }, severity, startPos, endPos, sLoc != null ? sLoc.getLine() : 0,
sLoc != null ? sLoc.getColumn() : 0);
IProblem[] seeAlso = buildSeeAlsoProblems(problem, message.getExtraSourceLocations(), problemSource,
usedBinarySourceFileName);
problem.setSeeAlsoProblems(seeAlso);
StringBuffer details = new StringBuffer();