]> source.dussan.org Git - aspectj.git/commitdiff
bug 43033 - NPE in concretize error path for ReferencePointcut
authoracolyer <acolyer>
Fri, 19 Sep 2003 08:16:17 +0000 (08:16 +0000)
committeracolyer <acolyer>
Fri, 19 Sep 2003 08:16:17 +0000 (08:16 +0000)
tests/ajcTests.xml
tests/bugs/concretizeNpe/base/ExceptionHandling.java [new file with mode: 0644]
tests/bugs/concretizeNpe/model/ModelExceptionHandling.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java

index 9fd028f8fcbdc4e1d55afb502cfb95479d2fdf27..cd3310c0cd52f67d8327cdff17b6690e91a23355 100644 (file)
         <compile files="AdviceInteraction.java"/>
         <run class="AdviceInteraction"/>
     </ajc-test>
+    
+       <ajc-test dir="bugs/concretizeNpe" pr="43033"
+               title="NPE in concretization error path">
+               <compile files="base/ExceptionHandling.java,model/ModelExceptionHandling.java">
+                 <message line="5" kind="error" text="pointcut base.ExceptionHandling.scope() is abstract"/>
+                 <message line="4" kind="error" text="inherited abstract pointcut base.ExceptionHandling.scope() is not made concrete"/>
+                 <message line="8" kind="error" text="inherited abstract pointcut base.ExceptionHandling.scope() is not made concrete"/>
+                 <message line="12" kind="error" text="Unmatched bracket"/>
+                 <message line="13" kind="error" text="Syntax error on token"/>
+               </compile>
+       </ajc-test>
+
 </suite>
diff --git a/tests/bugs/concretizeNpe/base/ExceptionHandling.java b/tests/bugs/concretizeNpe/base/ExceptionHandling.java
new file mode 100644 (file)
index 0000000..5f63ad6
--- /dev/null
@@ -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 (file)
index 0000000..0778aec
--- /dev/null
@@ -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
+}
index 8781641c7fb929c33ba3754cbba10e33a2148c8c..1b9848ccf2629170aa1471421d7596963846edbf 100644 (file)
@@ -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);
                        }