From: aclement Date: Wed, 7 May 2008 22:08:01 +0000 (+0000) Subject: 209372: guard for -1 source line when no line numbers in class file X-Git-Tag: Root_refactoring~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d3c3e32b533cbfa15120ad0414d07c5dbeec4296;p=aspectj.git 209372: guard for -1 source line when no line numbers in class file --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java index a9c853bec..62cfaa7f4 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java @@ -131,11 +131,19 @@ public class EclipseAdapterUtils { public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world) { ISourceLocation sourceLocation = makeSourceLocation(unit, problem); IProblem[] seeAlso = problem.seeAlso(); - ISourceLocation[] seeAlsoLocations = new ISourceLocation[seeAlso.length]; + // If the user has turned off classfile line number gen, then we may not be able to tell them + // about all secondary locations (pr209372) + int validPlaces = 0; + for (int ii=0;ii=0) validPlaces++; + } + ISourceLocation[] seeAlsoLocations = new ISourceLocation[validPlaces]; + int pos = 0; for (int i = 0; i < seeAlso.length; i++) { - seeAlsoLocations[i] = new SourceLocation(new File(new String(seeAlso[i].getOriginatingFileName())), - seeAlso[i].getSourceLineNumber()); - + if (seeAlso[i].getSourceLineNumber()>=0) { + seeAlsoLocations[pos++] = new SourceLocation(new File(new String(seeAlso[i].getOriginatingFileName())), + seeAlso[i].getSourceLineNumber()); + } } // We transform messages from AJ types to eclipse IProblems // and back to AJ types. During their time as eclipse problems,