*******************************************************************************/
package org.aspectj.ajdt.internal.compiler;
+import java.util.ArrayList;
import java.util.List;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceLocation;
private IProblem[] buildSeeAlsoProblems(List sourceLocations,
CompilationResult problemSource,
boolean usedBinarySourceFileName) {
- int probLength = sourceLocations.size();
- if (usedBinarySourceFileName) probLength++;
- IProblem[] ret = new IProblem[probLength];
+ List ret = new ArrayList();
+
for (int i = 0; i < sourceLocations.size(); i++) {
ISourceLocation loc = (ISourceLocation) sourceLocations.get(i);
- ret[i] = new DefaultProblem(loc.getSourceFile().getPath().toCharArray(),
+ if (loc != null ) {
+ DefaultProblem dp =
+ new DefaultProblem( loc.getSourceFile().getPath().toCharArray(),
"see also",
0,
new String[] {},
getStartPos(loc,null),
getEndPos(loc,null),
loc.getLine());
+ ret.add(dp);
+ } else {
+ throw new RuntimeException("Internal Compiler Error: Unexpected null source location passed as 'see also' location.");
+ }
}
if (usedBinarySourceFileName) {
- ret[ret.length -1] = new DefaultProblem(problemSource.fileName,"see also",0,new String[] {},
+ DefaultProblem dp = new DefaultProblem(problemSource.fileName,"see also",0,new String[] {},
ProblemSeverities.Ignore,0,
0,0);
+ ret.add(dp);
}
- return ret;
+ IProblem[] retValue = (IProblem[])ret.toArray(new IProblem[]{});
+ return retValue;
}
}
</compile>
</ajc-test>
+ <ajc-test dir="bugs/abstractITDs"
+ pr="64331" title="java.lang.NullPointerException in WeaverMessageHandler class">
+ <compile files="A.java,C.java" aspectpath="B.jar">
+ <message kind="error" line="1" text="must implement abstract inter-type declaration: void A.foo()"/>
+ </compile>
+ </ajc-test>
+
</suite>
for (Iterator iter = getInterTypeMungersIncludingSupers().iterator(); iter.hasNext();) {
ConcreteTypeMunger element = (ConcreteTypeMunger) iter.next();
if (element.getSignature() != null && element.getSignature().isAbstract()) {
+ ISourceLocation xtraLocation = element.getSourceLocation();
+ if (xtraLocation == null) {
+ // Until intertype mungers remember where they came from, the source location
+ // for the element is null when binary weaving. In these cases uses the
+ // source location for the aspect containing the ITD
+ xtraLocation = element.getAspectType().getSourceLocation();
+ }
world.getMessageHandler().handleMessage(
new Message("must implement abstract inter-type declaration: " + element.getSignature(),
"", IMessage.ERROR, getSourceLocation(), null,
- new ISourceLocation[] { element.getSourceLocation() }));
+ new ISourceLocation[] { xtraLocation }));
}
}
}