aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/ParentInterfaceUsingChildInnerInterface.java
blob: 499c3035d11fcdf54f8e1c5f0c957467dca1d5de (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
import org.aspectj.testing.*;


/** @testcase PR#645 PUREJAVA Parent interface using public inner interface of child in same file */
interface Child extends Parent {
    public interface Inner { 
        public String ok();
    }
}

/** Parent must be in same file as child and be declared AFTER */
interface Parent { 
    public Child.Inner getChildInner(); 
}

public class ParentInterfaceUsingChildInnerInterface {
    public static void main (String[] args) {
        Example me = new Example();   
        String result = me.getChildInner().ok(); 
        Tester.check(((result != null) && result.startsWith("ok")),
                     "expected ok... got " + result); 
    } 
}

class Example implements Parent {
    public Child.Inner getChildInner() {
        return new Child.Inner() {
                public String ok() {
                    return "ok: " + getClass().getName();
                }
            };
    }
}