aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/introductionPackage
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/introductionPackage
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/introductionPackage')
-rw-r--r--tests/new/introductionPackage/one/Aspect.java25
-rw-r--r--tests/new/introductionPackage/one/C.java13
-rw-r--r--tests/new/introductionPackage/one/TestAspect.java28
-rw-r--r--tests/new/introductionPackage/two/C.java5
4 files changed, 71 insertions, 0 deletions
diff --git a/tests/new/introductionPackage/one/Aspect.java b/tests/new/introductionPackage/one/Aspect.java
new file mode 100644
index 000000000..43ce36c20
--- /dev/null
+++ b/tests/new/introductionPackage/one/Aspect.java
@@ -0,0 +1,25 @@
+package one;
+
+/** @testcase PR#548 introduced methods have incorrect package */
+public aspect Aspect {
+ public void C.foo() { // workaround: add qualification: one.C.foo
+ /** @testcase PR#548 introduction method casting this to introduction type */
+ ((C) this).protectedMethod(); // bad CE: Can't convert from two.C to one.C
+ /** @testcase PR#548 introduction method accessing protected method */
+ protectedMethod(); // bad CE: can't find any method with name: protectedMethod
+ /** @testcase PR#548 introduction method accessing public method */
+ publicMethod(); // bad CE: can't find any method with name: publicMethod
+ /** @testcase PR#548 introduction method accessing default method */
+ defaultMethod(); // bad CE: can't find any method with name: defaultMethod
+
+ /** @testcase PR#548 introduction method accessing protected field */
+ int i = protectedInt; // bad CE: can't bind name: protectedInt
+ /** @testcase PR#548 introduction method accessing private field */
+ int j = publicInt; // bad CE: can't bind name: publicInt
+ /** @testcase PR#548 introduction method accessing default field */
+ int k = defaultInt; // bad CE: can't bind name: defaultInt
+ int l = i * j * k;
+ //privateMethod(); // todo error case
+ //int p = privateInt; // todo error case
+ }
+}
diff --git a/tests/new/introductionPackage/one/C.java b/tests/new/introductionPackage/one/C.java
new file mode 100644
index 000000000..47fa2a078
--- /dev/null
+++ b/tests/new/introductionPackage/one/C.java
@@ -0,0 +1,13 @@
+package one;
+
+/** @testcase PR#548 */
+public class C {
+ public void publicMethod(){ }
+ protected void protectedMethod(){}
+ void defaultMethod(){ }
+ private void privateMethod(){ }
+ public int publicInt = 1;
+ protected int protectedInt = 1;
+ int defaultInt = 1;
+ private int privateInt = 1;
+}
diff --git a/tests/new/introductionPackage/one/TestAspect.java b/tests/new/introductionPackage/one/TestAspect.java
new file mode 100644
index 000000000..11e4188b3
--- /dev/null
+++ b/tests/new/introductionPackage/one/TestAspect.java
@@ -0,0 +1,28 @@
+package one;
+
+import org.aspectj.testing.*;
+public aspect TestAspect {
+ public static void main(String[] args) {
+ C me = new C();
+ me.foo();
+ Tester.checkAllEvents();
+ }
+ static {
+ Tester.expectEvent("execution(void one.C.publicMethod())");
+ Tester.expectEvent("execution(void one.C.protectedMethod())");
+ Tester.expectEvent("execution(void one.C.defaultMethod())");
+ Tester.expectEvent("get(int one.C.protectedInt)");
+ Tester.expectEvent("get(int one.C.publicInt)");
+ Tester.expectEvent("get(int one.C.defaultInt)");
+
+ // XXX added - correct?
+ Tester.expectEvent("execution(void one.C.foo())");
+ Tester.expectEvent("execution(void one.C.protectedMethod())");
+ }
+
+ before () : execution(* C.*(..)) || get(int C.*)
+ {
+ Tester.event("" + thisJoinPointStaticPart);
+ //System.out.println("" + thisJoinPointStaticPart);
+ }
+}
diff --git a/tests/new/introductionPackage/two/C.java b/tests/new/introductionPackage/two/C.java
new file mode 100644
index 000000000..1db9e2b99
--- /dev/null
+++ b/tests/new/introductionPackage/two/C.java
@@ -0,0 +1,5 @@
+package two;
+
+/** @testcase PR#548 */
+public class C { }
+