| 1 |
// See checker/tests/nullness/InferNullType.java for test that verifies correct Nullness Checker |
| 2 |
// errors |
| 3 |
class InferNullType { |
| 4 |
|
| 5 |
<T extends Object> T toInfer(T input) { |
| 6 |
return input; |
| 7 |
} |
| 8 |
|
| 9 |
<T> T toInfer2(T input) { |
| 10 |
return input; |
| 11 |
} |
| 12 |
|
| 13 |
<T, S extends T> T toInfer3(T input, S p2) { |
| 14 |
return input; |
| 15 |
} |
| 16 |
|
| 17 |
<T extends Number, S extends T> T toInfer4(T input, S p2) { |
| 18 |
return input; |
| 19 |
} |
| 20 |
|
| 21 |
void x() { |
| 22 |
@SuppressWarnings("nullness:type.argument.type.incompatible") |
| 23 |
Object m = toInfer(null); |
| 24 |
Object m2 = toInfer2(null); |
| 25 |
|
| 26 |
Object m3 = toInfer3(null, null); |
| 27 |
Object m4 = toInfer3(1, null); |
| 28 |
Object m5 = toInfer3(null, 1); |
| 29 |
|
| 30 |
@SuppressWarnings("nullness:type.argument.type.incompatible") |
| 31 |
Object m6 = toInfer4(null, null); |
| 32 |
@SuppressWarnings("nullness:type.argument.type.incompatible") |
| 33 |
Object m7 = toInfer4(1, null); |
| 34 |
@SuppressWarnings("nullness:type.argument.type.incompatible") |
| 35 |
Object m8 = toInfer4(null, 1); |
| 36 |
} |
| 37 |
} |