aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/packagevisibility
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/packagevisibility
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/packagevisibility')
-rw-r--r--tests/new/packagevisibility/PackagesAndAdvice.java39
-rw-r--r--tests/new/packagevisibility/testPackage/Class1.java11
-rw-r--r--tests/new/packagevisibility/testPackage/Class2.java13
3 files changed, 63 insertions, 0 deletions
diff --git a/tests/new/packagevisibility/PackagesAndAdvice.java b/tests/new/packagevisibility/PackagesAndAdvice.java
new file mode 100644
index 000000000..ca17f0da7
--- /dev/null
+++ b/tests/new/packagevisibility/PackagesAndAdvice.java
@@ -0,0 +1,39 @@
+package packagevisibility;
+import org.aspectj.testing.Tester;
+
+import packagevisibility.testPackage.*;
+
+public class PackagesAndAdvice
+{
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ packagevisibility.testPackage.Class1 c1 =
+ new packagevisibility.testPackage.Class1();
+ Tester.checkEqual(c1.doIt("-1"),
+ "-1-advised-advised1-1-class1",
+ "publically visible");
+ Tester.checkEqual(c1.doItToClass2("-2"),
+ "-2-advised-advised1-2-class2",
+ "package visible");
+ }
+
+}
+
+aspect A {
+ static String message = "-advised";
+
+ String around(String s):
+ call(String doIt(String)) && args(s) &&
+ (target(packagevisibility.testPackage.Class1) ||
+ target(packagevisibility.testPackage.Class2)) {
+ String result = s + message;
+ result += A1.message;
+ return result + proceed(s);
+ }
+
+}
+
+class A1 {
+ static String message = "-advised1";
+}
diff --git a/tests/new/packagevisibility/testPackage/Class1.java b/tests/new/packagevisibility/testPackage/Class1.java
new file mode 100644
index 000000000..d53733d34
--- /dev/null
+++ b/tests/new/packagevisibility/testPackage/Class1.java
@@ -0,0 +1,11 @@
+package packagevisibility.testPackage;
+
+public class Class1 {
+ public String doIt(String s) {
+ return s + "-class1";
+ }
+
+ public String doItToClass2(String s) {
+ return (new packagevisibility.testPackage.Class2()).doIt(s);
+ }
+}
diff --git a/tests/new/packagevisibility/testPackage/Class2.java b/tests/new/packagevisibility/testPackage/Class2.java
new file mode 100644
index 000000000..d32e84683
--- /dev/null
+++ b/tests/new/packagevisibility/testPackage/Class2.java
@@ -0,0 +1,13 @@
+package packagevisibility.testPackage;
+
+class Class2 {
+ String doIt(String s) {
+ new Runnable() {
+ public void run() {
+ System.out.println("running");
+ }
+ }.run();
+
+ return s + "-class2";
+ }
+}