| 1 |
import org.checkerframework.common.value.qual.MinLen; |
| 2 |
|
| 3 |
@SuppressWarnings("nullness") // Don't want to depend on @Nullable |
| 4 |
class AssignmentContext { |
| 5 |
|
| 6 |
void foo(String[] a) {} |
| 7 |
|
| 8 |
void t1(boolean b) { |
| 9 |
String[] s = b ? new String[] {""} : null; |
| 10 |
} |
| 11 |
|
| 12 |
void t2(boolean b) { |
| 13 |
foo(b ? new String[] {""} : null); |
| 14 |
} |
| 15 |
|
| 16 |
String[] t3(boolean b) { |
| 17 |
return b ? new String[] {""} : null; |
| 18 |
} |
| 19 |
|
| 20 |
void t4(boolean b) { |
| 21 |
String[] s = null; |
| 22 |
s = b ? new String[] {""} : null; |
| 23 |
} |
| 24 |
|
| 25 |
void assignToCast(String @MinLen(4) [] @MinLen(5) [] currentSample) { |
| 26 |
// This statement used to cause a null pointer exception. |
| 27 |
((String @MinLen(5) []) currentSample[3])[4] = currentSample[3][4]; |
| 28 |
} |
| 29 |
} |