aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-07-26 00:21:16 +0000
committerwisberg <wisberg>2003-07-26 00:21:16 +0000
commite49c9eb667399bea490f88462b5e880fb2028539 (patch)
tree8c95be9251d56938e1907018ae5416d6028cceb0 /tests/bugs
parentcd1ad650b8397ac72ed3e712bf2314fca8e0c17c (diff)
downloadaspectj-e49c9eb667399bea490f88462b5e880fb2028539.tar.gz
aspectj-e49c9eb667399bea490f88462b5e880fb2028539.zip
@testcase PR#40805 interface call signatures when declaring method in aspect
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/DeclareWarningAndInterfaceMethodCW.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/bugs/DeclareWarningAndInterfaceMethodCW.java b/tests/bugs/DeclareWarningAndInterfaceMethodCW.java
new file mode 100644
index 000000000..1046a8014
--- /dev/null
+++ b/tests/bugs/DeclareWarningAndInterfaceMethodCW.java
@@ -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()";
+}