Commit e7623f7
JSpecify: handle incorrect method parameter nullability for method reference (#845)
We now report an error for the following test case:
```java
class Test {
interface A<T1 extends @nullable Object> {
String function(T1 o);
}
static String foo(Object o) {
return o.toString();
}
static void testPositive() {
// we now report an error here, as foo's parameter need to be @nullable
A<@nullable Object> p = Test::foo;
}
static void testNegative() {
A<Object> p = Test::foo;
}
}
```
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>1 parent 2d2b829 commit e7623f7
File tree
3 files changed
+29
-19
lines changed- nullaway/src
- main/java/com/uber/nullaway
- test/java/com/uber/nullaway
3 files changed
+29
-19
lines changedLines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | 882 | | |
888 | 883 | | |
889 | 884 | | |
| |||
904 | 899 | | |
905 | 900 | | |
906 | 901 | | |
907 | | - | |
| 902 | + | |
908 | 903 | | |
909 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
745 | 756 | | |
746 | 757 | | |
747 | 758 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
433 | | - | |
| 432 | + | |
434 | 433 | | |
435 | 434 | | |
436 | 435 | | |
| |||
0 commit comments