]> source.dussan.org Git - aspectj.git/commitdiff
@testcase PR#40805 interface call signatures when declaring method in aspect
authorwisberg <wisberg>
Sat, 26 Jul 2003 00:21:16 +0000 (00:21 +0000)
committerwisberg <wisberg>
Sat, 26 Jul 2003 00:21:16 +0000 (00:21 +0000)
tests/ajcTestsFailing.xml
tests/bugs/DeclareWarningAndInterfaceMethodCW.java [new file with mode: 0644]

index ddc6cc1ddd704900dbb799d2e7a47a8a9e6696ea..35a87fefd7f73843f021272132ffe75e582deabf 100644 (file)
@@ -4,5 +4,20 @@
 <!-- contains valid tests that the compiler has never passed -->
 
 <suite>
-
+       <ajc-test dir="bugs" 
+               title="interface call signatures when declaring method in aspect"
+               pr="40805">
+               <compile files="DeclareWarningAndInterfaceMethodCW.java">
+                       <message kind="warning" line="27" text="call getSomething"/>
+                       <message kind="warning" line="27" text="call ICanGetSomething.getSomething"/>
+                       <message kind="warning" line="31" text="call getSomething"/>
+                       <message kind="warning" line="31" text="call ICanGetSomething.getSomething"/>
+                       <message kind="warning" line="33" text="call getSomething"/>
+                       <message kind="warning" line="33" text="call ICanGetSomething.getSomething"/>
+                       <message kind="warning" line="35" text="call getSomething"/>
+                       <message kind="warning" line="35" text="call ICanGetSomething.getSomething"/>
+                       <message kind="warning" line="38" text="call getSomething"/>
+                       <message kind="warning" line="38" text="call ICanGetSomething.getSomething"/>
+                       </compile>
+               </ajc-test>
 </suite>
diff --git a/tests/bugs/DeclareWarningAndInterfaceMethodCW.java b/tests/bugs/DeclareWarningAndInterfaceMethodCW.java
new file mode 100644 (file)
index 0000000..1046a80
--- /dev/null
@@ -0,0 +1,55 @@
+
+/*
+ * ajc fails to detect call join points using the
+ * declaring interface as the type when the method
+ * was declared in the aspect.
+ */
+
+public class DeclareWarningAndInterfaceMethodCW {
+    public static void main(String[] args) {
+        new C().doSomething();
+    }
+}
+
+interface ICanGetSomething {
+    Object getSomething();
+}
+
+class B implements ICanGetSomething {
+    public Object getSomething() { // CE conflict here?
+        return new Object();
+    }
+}
+
+class C {
+
+    C() {
+        new B().getSomething(); // 2 CW declared here
+    }
+
+    static void staticMethod() {
+        new B().getSomething(); // 2 CW declared here
+        B b = new B();
+        b.getSomething(); // 2 CW declared here
+        ICanGetSomething i = new B();
+        i.getSomething(); // 2 CW declared here
+    }
+    void doSomething() {
+        Object result = new B().getSomething(); // 2 CW here
+        if (null == result) {
+            throw new Error("no result");
+        }
+    }
+}
+
+/** @testcase PR#40805 interface call signatures when declaring method in aspect */
+aspect A { 
+    // comment this out to get correct warnings
+    public Object ICanGetSomething.getSomething() { 
+        return null; 
+    }
+    declare warning : call(Object ICanGetSomething.getSomething())
+        : "call ICanGetSomething.getSomething()";
+    declare warning : call(Object getSomething())
+        : "call getSomething()";
+}