]> source.dussan.org Git - aspectj.git/commitdiff
@testcase PR#75129 NPE on thisJoinPoint mistake
authorwisberg <wisberg>
Mon, 27 Sep 2004 21:14:44 +0000 (21:14 +0000)
committerwisberg <wisberg>
Mon, 27 Sep 2004 21:14:44 +0000 (21:14 +0000)
tests/ajcTestsFailing.xml
tests/bugs/TjpMistake.java [new file with mode: 0644]

index 167f12d9e47c6f04a83da8cfaf2fde22e91d9e6b..a15692546e32101affabc9b987b501f69e171175 100644 (file)
           files="Test_AroundVarBug.java,AroundVarBug.java"/>
         <run class="Test_AroundVarBug"/>
     </ajc-test>
+
+    <ajc-test 
+       dir="bugs" 
+       pr="75129"
+               title="NPE on thisJoinPoint mistake">
+        <compile files="TjpMistake.java">
+               <message kind="error" line="22"/>
+        </compile>
+    </ajc-test>
     
 </suite>
diff --git a/tests/bugs/TjpMistake.java b/tests/bugs/TjpMistake.java
new file mode 100644 (file)
index 0000000..4934da2
--- /dev/null
@@ -0,0 +1,29 @@
+/** @testcase PR#75129 NPE on thisJoinPoint mistake */
+public class TjpMistake {
+public static void main(String[] a) {
+   new C().go();
+   new D().go();
+   new E().go();
+}
+}
+interface I { void go();}
+class C {}
+class D { 
+  public void go() { System.out.println("D.go() in " + this); }
+}
+class E extends D { 
+}
+aspect A {
+  declare parents: (C || D) implements I;
+  public void I.go() { System.out.println("I.go() in " + this); }
+  before() : execution(* I.*(..)) { 
+       System.out.println(
+       // mistake caused compiler crash rather than error
+       thisJoinPoint.getSignature.toLongString()  // CE 22
+       // correct
+       //thisJoinPointStaticPart.getSignature().toLongString() 
+       + " " 
+       + thisJoinPoint.getSignature().getDeclaringType() 
+       + " " 
+       + this); }
+}