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 mode: SubL<?> is rejected as Base<? extends List<String>> when SubL's type parameter has a narrower bound than Base's #2206
incompatible types: SubL<?> cannot be converted to Base<? extends List<String>> (SubL<?> is a subtype of Base<?>)
Expected behavior
No error. By capture conversion (JLS 5.1.10) the ? of SubL<?> takes the bound of T, which is List<String>, so the source is SubL<CAP extends List<String>>, whose supertype Base<CAP> is contained in Base<? extends List<String>>. NullAway appears to compare the wildcard after substituting it into Base, where it takes the implicit @Nullable Object bound of U instead of the bound of T.
The same happens one level down: with static class SubW<T> extends Base<List<T>> {}, SubW<?> s; Base<? extends List<? extends Object>> t = s; is reported, though T's bound Object is non-null in @NullMarked code.
Activity
Check every bound note a message test compares
Keep the bound note consistent with the bound the check compared
Keep the source caret on the written type and derive the note from on…
Name a bound's type parameter only where it declares the compared bound