summaryrefslogtreecommitdiff
path: root/test/files/run/t6168/Context.java
blob: d0fb5d254376ad6614cb542355a844a48c3d99fd (plain) (blame)
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
public class Context<ParentType> {
    private ParentType parent;

    public Context() {}

    public ParentType getParent() {
        return parent;
    }

    public void setParent(ParentType parent) {
         this.parent = parent;
    }

    public Field<Integer> intField() {
        return new Field<Integer>() {
            @Override
            public Integer get() {
                return 0;
            }

            @Override
            public ParentType set(Integer t) {
                return parent;
            }
        };
    }

    public abstract class Field<T> { //Note this is a path dependent type

        public abstract T get();

        public abstract ParentType set(T t);
    }
}