You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JSpecify: false positive when ? super T is on the both sides of call and T is nullable #1500
changed the title [-]False positive when ? super T is on the both sides of call and T is nullable in JSpecify Mode[/-][+]JSpecify: false positive when ? super T is on the both sides of call and T is nullable[/+]on Mar 27, 2026
Thanks for the report, this is most likely due to incomplete support for wildcards; see #1360 and also #1462. I'll leave this one open and we should check that it's fixed after adding more wildcards support
Basically, javac cannot infer that Foo.of(new Foo<Object>()) should have type Foo<String> based on FOO's type, since it goes through the call to or. Right now, for similar reasons, NullAway does not know that Foo.of(new Foo<@Nullable Void>()) "should" have type Foo<@Nullable Void> and infers Foo<Void> instead.
Now, for the Void type, one could argue we just should always infer @Nullable Void and add some special treatment. We could think about that, though it'd be low priority. But, I don't think this issue was about the Void type specifically.
Activity
[-]False positive when ? super T is on the both sides of call and T is nullable in JSpecify Mode[/-][+]JSpecify: false positive when ? super T is on the both sides of call and T is nullable[/+]msridhar commentedon Apr 3, 2026
Thanks for the report, this is most likely due to incomplete support for wildcards; see #1360 and also #1462. I'll leave this one open and we should check that it's fixed after adding more wildcards support
unv-unv commentedon Apr 14, 2026
Checked in 0.13.2. Problem is still here.
msridhar commentedon Apr 14, 2026
Yeah, we'll update / close this issue when this one is fixed, but it will take some time.
Add test for #1500
Add test for #1500
Add test for #1500
Add test for #1500
Add test for #1500
Add test for #1500
msridhar commentedon May 1, 2026
@unv-unv I wrote a Java equivalent of this test and it does not compile:
The following modified
FOOdeclaration does compile:(Godbolt link)
Basically,
javaccannot infer thatFoo.of(new Foo<Object>())should have typeFoo<String>based onFOO's type, since it goes through the call toor. Right now, for similar reasons, NullAway does not know thatFoo.of(new Foo<@Nullable Void>())"should" have typeFoo<@Nullable Void>and infersFoo<Void>instead.Now, for the
Voidtype, one could argue we just should always infer@Nullable Voidand add some special treatment. We could think about that, though it'd be low priority. But, I don't think this issue was about theVoidtype specifically.@unv-unv thoughts?
Initial inference for wildcards (#1549)
Run inference for generic method calls nested inside receivers (#1571)
Enable test for issue 1500 and add comment (apache#1560)