| 1 |
// Test case for Issue #779 |
| 2 |
// https://github.com/typetools/checker-framework/issues/779 |
| 3 |
|
| 4 |
import org.checkerframework.checker.initialization.qual.*; |
| 5 |
import org.checkerframework.checker.nullness.qual.*; |
| 6 |
|
| 7 |
class A { |
| 8 |
Object g = new Object(); |
| 9 |
|
| 10 |
A() { |
| 11 |
foo(); |
| 12 |
} |
| 13 |
|
| 14 |
void foo(@UnderInitialization(A.class) A this) { |
| 15 |
System.out.println("foo A " + g.toString()); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
class B extends A { |
| 20 |
Object f = new Object(); |
| 21 |
|
| 22 |
void foo(@UnderInitialization(A.class) B this) { |
| 23 |
// :: error: (dereference.of.nullable) |
| 24 |
System.out.println("foo B " + this.f.toString()); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
public class Issue779 { |
| 29 |
public static void main(String[] args) { |
| 30 |
new B(); |
| 31 |
} |
| 32 |
} |