From: acolyer Date: Fri, 19 Sep 2003 08:16:17 +0000 (+0000) Subject: bug 43033 - NPE in concretize error path for ReferencePointcut X-Git-Tag: V1_1_1~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=53570863fa77364052937376a0ff65ce2fa37842;p=aspectj.git bug 43033 - NPE in concretize error path for ReferencePointcut --- diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 9fd028f8f..cd3310c0c 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6763,4 +6763,16 @@ + + + + + + + + + + + diff --git a/tests/bugs/concretizeNpe/base/ExceptionHandling.java b/tests/bugs/concretizeNpe/base/ExceptionHandling.java new file mode 100644 index 000000000..5f63ad61a --- /dev/null +++ b/tests/bugs/concretizeNpe/base/ExceptionHandling.java @@ -0,0 +1,6 @@ +package base; + +public abstract aspect ExceptionHandling { + public abstract pointcut scope(); + declare soft: Exception: scope(); +} diff --git a/tests/bugs/concretizeNpe/model/ModelExceptionHandling.java b/tests/bugs/concretizeNpe/model/ModelExceptionHandling.java new file mode 100644 index 000000000..0778aec22 --- /dev/null +++ b/tests/bugs/concretizeNpe/model/ModelExceptionHandling.java @@ -0,0 +1,13 @@ + +package model; + +import java.lang.RuntimeException; + +import base.ExceptionHandling; + +public aspect ModelExceptionHandling extends ExceptionHandling { + public pointcut scope() : within(*); + + protected RuntimeException convertCheckedException(Throwable t) { + return new RuntimeException(t.getMessage(),t +} diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java index 8781641c7..1b9848ccf 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -18,10 +18,10 @@ import java.io.DataOutputStream; import java.io.IOException; import java.lang.reflect.Modifier; -import org.apache.bcel.classfile.JavaClass; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.MessageUtil; import org.aspectj.util.FuzzyBoolean; +import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; @@ -240,9 +240,11 @@ public class ReferencePointcut extends Pointcut { if (pointcutDec.isAbstract()) { //Thread.currentThread().dumpStack(); + ShadowMunger enclosingAdvice = bindings.getEnclosingAdvice(); searchStart.getWorld().showMessage(IMessage.ERROR, pointcutDec + " is abstract", - getSourceLocation(), bindings.getEnclosingAdvice().getSourceLocation()); + getSourceLocation(), + (null == enclosingAdvice) ? null : enclosingAdvice.getSourceLocation()); return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); }