aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/OrderOfExtendsPlusAndImplementsPlus.java
blob: ba1265f1c5d9e46a58b737c731f5a2221991b747 (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
import org.aspectj.testing.Tester;
public class OrderOfExtendsPlusAndImplementsPlus {
    public static void main(String[] args) {
        try {
            new OrderOfExtendsPlusAndImplementsPlus().realMain(args);
        } catch (Throwable t) {
            Tester.throwable(t);
        }
    }
    public void realMain(String[] args) throws Exception {
        Class[] cs = new Class[]{C.class, D.class};
        for (int i = 0; i < cs.length; i++) {
            check(cs[i]);
        }
    }
    private void check(Class c) {
        Tester.checkEq(c.getInterfaces()[0], I.class,
                       c + " doesn't implement " + I.class);
        Tester.checkEq(c.getSuperclass(), S.class,
                       c + " doesn't extend " + S.class);
    }
}

class S {}
interface I {}
class C {}
class D {}

aspect A {
    declare parents: C implements I;
    declare parents: C extends S;
}

aspect B {
    declare parents: D extends S;
    declare parents: D implements I;
}