aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/interAbstract
diff options
context:
space:
mode:
authorwisberg <wisberg>2004-01-09 19:17:01 +0000
committerwisberg <wisberg>2004-01-09 19:17:01 +0000
commitef9b26876a26ced9a621d5b9ec7a6d611b1c04c9 (patch)
treed1ca772609eb935fb598c43d14f07f42872101cd /tests/bugs/interAbstract
parent0a41a4eceadf9936f67a72e31652e35ddc80bd4b (diff)
downloadaspectj-ef9b26876a26ced9a621d5b9ec7a6d611b1c04c9.tar.gz
aspectj-ef9b26876a26ced9a621d5b9ec7a6d611b1c04c9.zip
@testcase PR#49784 aspect declares interface method
Diffstat (limited to 'tests/bugs/interAbstract')
-rw-r--r--tests/bugs/interAbstract/InterfaceMethodDeclarationAbstract.java42
-rw-r--r--tests/bugs/interAbstract/InterfaceMethodDeclarationFull.java42
-rw-r--r--tests/bugs/interAbstract/InterfaceMethodDeclarationNone.java42
3 files changed, 126 insertions, 0 deletions
diff --git a/tests/bugs/interAbstract/InterfaceMethodDeclarationAbstract.java b/tests/bugs/interAbstract/InterfaceMethodDeclarationAbstract.java
new file mode 100644
index 000000000..7eb4abab4
--- /dev/null
+++ b/tests/bugs/interAbstract/InterfaceMethodDeclarationAbstract.java
@@ -0,0 +1,42 @@
+/* *******************************************************************
+ * Copyright (c) 2004 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Wes Isberg initial implementation
+ * ******************************************************************/
+
+import org.aspectj.testing.Tester;
+
+/**
+ * @testcase PR#49784 aspect declares interface method (abstract)
+ */
+public class InterfaceMethodDeclarationAbstract {
+
+ public static void main(String[] args) {
+ Tester.expectEvent("before-execution");
+ Tester.expectEvent("before-call");
+ I i = new C();
+ Tester.check(1 == i.getInt(), "1 == i.getInt()");
+ Tester.checkAllEvents();
+ }
+}
+
+interface I {}
+
+aspect A {
+ abstract int I.getInt(); // implicitly public
+ before() : execution(int getInt()) && target(I) {
+ Tester.event("before-execution");
+ }
+ before() : call(int getInt()) && target(I) {
+ Tester.event("before-call");
+ }
+}
+class C implements I {
+ public int getInt() { return 1; }
+}
diff --git a/tests/bugs/interAbstract/InterfaceMethodDeclarationFull.java b/tests/bugs/interAbstract/InterfaceMethodDeclarationFull.java
new file mode 100644
index 000000000..f823b6e94
--- /dev/null
+++ b/tests/bugs/interAbstract/InterfaceMethodDeclarationFull.java
@@ -0,0 +1,42 @@
+/* *******************************************************************
+ * Copyright (c) 2004 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Wes Isberg initial implementation
+ * ******************************************************************/
+
+import org.aspectj.testing.Tester;
+
+/**
+ * @testcase PR#49784 aspect declares interface method (public abstract)
+ */
+public class InterfaceMethodDeclarationFull {
+
+ public static void main(String[] args) {
+ Tester.expectEvent("before-execution");
+ Tester.expectEvent("before-call");
+ I i = new C();
+ Tester.check(1 == i.getInt(), "1 == i.getInt()");
+ Tester.checkAllEvents();
+ }
+}
+
+interface I {}
+
+aspect A {
+ abstract public int I.getInt();
+ before() : execution(int getInt()) && target(I) {
+ Tester.event("before-execution");
+ }
+ before() : call(int getInt()) && target(I) {
+ Tester.event("before-call");
+ }
+}
+class C implements I {
+ public int getInt() { return 1; }
+}
diff --git a/tests/bugs/interAbstract/InterfaceMethodDeclarationNone.java b/tests/bugs/interAbstract/InterfaceMethodDeclarationNone.java
new file mode 100644
index 000000000..dfef03478
--- /dev/null
+++ b/tests/bugs/interAbstract/InterfaceMethodDeclarationNone.java
@@ -0,0 +1,42 @@
+/* *******************************************************************
+ * Copyright (c) 2004 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Wes Isberg initial implementation
+ * ******************************************************************/
+
+import org.aspectj.testing.Tester;
+
+/**
+ * @testcase PR#49784 aspect declares interface method (no modifiers)
+ */
+public class InterfaceMethodDeclarationNone {
+
+ public static void main(String[] args) {
+ Tester.expectEvent("before-execution");
+ Tester.expectEvent("before-call");
+ I i = new C();
+ Tester.check(1 == i.getInt(), "1 == i.getInt()");
+ Tester.checkAllEvents();
+ }
+}
+
+interface I {}
+
+aspect A {
+ int I.getInt(); // implicitly public abstract
+ before() : execution(int getInt()) && target(I) {
+ Tester.event("before-execution");
+ }
+ before() : call(int getInt()) && target(I) {
+ Tester.event("before-call");
+ }
+}
+class C implements I {
+ public int getInt() { return 1; }
+}