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
|
// Test case for
// https://github.com/typetools/checker-framework/issues/152
import testlib.flowexpression.qual.FlowExp;
// @skip-test
public class ThisSuper {
static class SuperClass {
protected final Object field = new Object();
private @FlowExp("field") Object superField;
}
static class SubClass extends SuperClass {
/* Hides SuperClass.field */
private final Object field = new Object();
private @FlowExp("field") Object subField;
void method() {
// super.superField : @FlowExp("super.field")
// this.subField : @FlowExp("this.field")
// :: error: (assignment.type.incompatible)
this.subField = super.superField;
// :: error: (assignment.type.incompatible)
super.superField = this.subField;
@FlowExp("super.field") Object o1 = super.superField;
@FlowExp("this.field") Object o2 = this.subField;
}
}
class OuterClass {
private final Object lock = new Object();
@FlowExp("this.lock") Object field;
class InnerClass {
private final Object lock = new Object();
// :: error: (assignment.type.incompatible)
@FlowExp("this.lock") Object field2 = field;
}
}
}
|