aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/PointcutLibraryTest.java
blob: 17ce36b52a4e51c79423217ac87777c91b7227bc (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
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * This test case produces a ClassFormatError under 1.1.0, but
 * the code is not set up to run/test correctly
 * after the bug is fixed.
 */

/** @testcase PR#40876 subtype-qualified pointcut reference */
public class PointcutLibraryTest {
    public static void main(String[] a) {
        new Test().run();
    }
}

class Test {
    public void run(){ prun(); }
    private void prun() {
        System.out.println("Test.prun()");
    }
}

/** private default implementation of library */
class PrivatePointcutLibrary {
    pointcut adviceCflow() : !cflow(adviceexecution());
    pointcut publicCalls() : call(public * *(..))
        && !adviceCflow();
}

/** public interface for library */
class PointcutLibrary extends PrivatePointcutLibrary {
}

// ---- different clients of the library

/** use library by inheriting scope in class */
class CPL extends PointcutLibrary {
    static aspect A {
        before() : publicCalls() {
            System.out.println("CPL: " 
                + thisJoinPointStaticPart);
        }
    }
}

/** client by external reference to CPL */
aspect ExternalClientOfCPL {
    before() : CPL.publicCalls() { // remove this to avoid bug?
        System.out.println("XDP: " 
            + thisJoinPointStaticPart);
    }
}