aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pureJava/ParentUsingChild.java
blob: 2133628a36d8c00f021496ac670d9b846cc62109 (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
import org.aspectj.testing.*;

/** @testcase PUREJAVA PR#728 interface using preceding subinterface in its definition (order matters) */
interface Child extends Parent {
    interface Toy { }
}

interface Parent { // order matters - must be after Child
    Child.Toy battle();
}

public class ParentUsingChild {
    public static void main (String[] args) {
        Tester.check(Parent.class.isAssignableFrom(Child.class),
                     "!Parent.class.isAssignableFrom(Child.class)");
        Parent p = new Parent() {
                public Child.Toy battle() {
                    return new Child.Toy(){};
                }
            };
        Child.Toy battle = p.battle();
        Tester.check(battle instanceof Child.Toy,
                     "!battle instanceof Child.Toy");
    } 
}