| 1 |
import org.checkerframework.checker.initialization.qual.Initialized; |
| 2 |
import org.checkerframework.checker.initialization.qual.UnderInitialization; |
| 3 |
import org.checkerframework.checker.initialization.qual.UnknownInitialization; |
| 4 |
import org.checkerframework.checker.nullness.qual.NonNull; |
| 5 |
import org.checkerframework.checker.nullness.qual.Nullable; |
| 6 |
|
| 7 |
public class Commitment { |
| 8 |
|
| 9 |
@NonNull String t; |
| 10 |
|
| 11 |
// :: error: (initialization.invalid.field.type) |
| 12 |
@NonNull @UnderInitialization String a; |
| 13 |
// :: error: (initialization.invalid.field.type) |
| 14 |
@Initialized String b; |
| 15 |
@UnknownInitialization @Nullable String c; |
| 16 |
|
| 17 |
// :: error: (initialization.invalid.constructor.return.type) |
| 18 |
public @UnderInitialization Commitment(int i) { |
| 19 |
a = ""; |
| 20 |
t = ""; |
| 21 |
b = ""; |
| 22 |
} |
| 23 |
|
| 24 |
// :: error: (initialization.invalid.constructor.return.type) |
| 25 |
public @Initialized Commitment(int i, int j) { |
| 26 |
a = ""; |
| 27 |
t = ""; |
| 28 |
b = ""; |
| 29 |
} |
| 30 |
|
| 31 |
// :: error: (initialization.invalid.constructor.return.type) |
| 32 |
public @Initialized @NonNull Commitment(boolean i) { |
| 33 |
a = ""; |
| 34 |
t = ""; |
| 35 |
b = ""; |
| 36 |
} |
| 37 |
|
| 38 |
// :: error: (initialization.invalid.constructor.return.type) |
| 39 |
public @Nullable Commitment(char i) { |
| 40 |
a = ""; |
| 41 |
t = ""; |
| 42 |
b = ""; |
| 43 |
} |
| 44 |
|
| 45 |
// :: error: (initialization.fields.uninitialized) |
| 46 |
public Commitment() { |
| 47 |
// :: error: (dereference.of.nullable) |
| 48 |
t.toLowerCase(); |
| 49 |
|
| 50 |
t = ""; |
| 51 |
|
| 52 |
@UnderInitialization @NonNull Commitment c = this; |
| 53 |
|
| 54 |
@UnknownInitialization @NonNull Commitment c1 = this; |
| 55 |
|
| 56 |
// :: error: (assignment.type.incompatible) |
| 57 |
@Initialized @NonNull Commitment c2 = this; |
| 58 |
} |
| 59 |
|
| 60 |
// :: error: (initialization.fields.uninitialized) |
| 61 |
public Commitment(@UnknownInitialization Commitment arg) { |
| 62 |
t = ""; |
| 63 |
|
| 64 |
// :: error: (argument.type.incompatible) |
| 65 |
@UnderInitialization Commitment t = new Commitment(this, 1); |
| 66 |
|
| 67 |
// :: error: (assignment.type.incompatible) |
| 68 |
@Initialized Commitment t1 = new Commitment(this); |
| 69 |
|
| 70 |
@UnderInitialization Commitment t2 = new Commitment(this); |
| 71 |
} |
| 72 |
|
| 73 |
// :: error: (initialization.fields.uninitialized) |
| 74 |
public Commitment(Commitment arg, int i) {} |
| 75 |
} |