From 48c2e8d42715597b2ce3cb5e039115629d38a6cb Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 9 Jan 2009 20:06:55 +0000 Subject: [PATCH] 260384: guards for npes that could occur due to other errors in the source --- .../ajdt/internal/compiler/ast/PointcutDeclaration.java | 4 ++++ .../ajdt/internal/compiler/lookup/EclipseSourceType.java | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java index 4e6b64276..a95a3e7f9 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java @@ -217,6 +217,10 @@ public class PointcutDeclaration extends AjMethodDeclaration { public ResolvedPointcutDefinition makeResolvedPointcutDefinition(EclipseFactory inWorld) { if (resolvedPointcutDeclaration != null) return resolvedPointcutDeclaration; + if (binding == null) { + // other errors exist that will be reported separately + return null; + } // System.out.println("pc: " + getPointcut() + ", " + getPointcut().state); ReferenceBinding declaringClass = binding.declaringClass; TypeBinding[] parameters = binding.parameters; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java index 11c7fe985..c59e8c4fd 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java @@ -397,6 +397,10 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { ResolvedMember[] pointcuts = getDeclaredPointcuts(); boolean sawError = false; for (int i = 0, len = pointcuts.length; i < len; i++) { + if (pointcuts[i]==null) { + // Something else is broken in this file and will be reported separately + continue; + } if (pointcuts[i].isAbstract()) { if (!this.isAspect()) { eclipseWorld().showMessage(IMessage.ERROR, "abstract pointcut only allowed in aspect" + pointcuts[i].getName(), @@ -410,6 +414,10 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { } for (int j = i + 1; j < len; j++) { + if (pointcuts[j]==null) { + // Something else is broken in this file and will be reported separately + continue; + } if (pointcuts[i].getName().equals(pointcuts[j].getName())) { eclipseWorld().showMessage(IMessage.ERROR, "duplicate pointcut name: " + pointcuts[j].getName(), pointcuts[i].getSourceLocation(), pointcuts[j].getSourceLocation()); -- 2.39.5