aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/packagevisibility/PackagesAndAdvice.java
blob: 199df0cbe0d492df9fdb37ca066dbaf2d6b8e181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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) {
        String result = s + message;
	result += A1.message;
	return result + proceed(s);
    }

}

class A1 {
    static String message = "-advised1";
}