-
Notifications
You must be signed in to change notification settings - Fork 322
Open
Labels
bugjspecifyRelated to support for jspecify standard (see jspecify.dev)Related to support for jspecify standard (see jspecify.dev)
Description
A variant of #1290:
@NullMarked
class Foo {
interface Callback<T extends @Nullable Object> {
void onResult(T thing);
}
void receiver(Callback<@Nullable Object> value) {
}
void target(@Nullable Object thing) {
}
public <T extends @Nullable Object> Callback<T> makeCancelable(Callback<T> callback) {
return callback;
}
void main() {
receiver(makeCancelable(this::target));
}
}
results in:
Foo.java:21: warning: [NullAway] incompatible types: Callback<Object> cannot be converted to Callback<@Nullable Object>
receiver(makeCancelable(this::target));
^
(see http://t.uber.com/nullaway )
An explicit cast will work-around it:
void main() {
receiver(makeCancelable((Callback<@Nullable Object>) this::target));
}
Metadata
Metadata
Assignees
Labels
bugjspecifyRelated to support for jspecify standard (see jspecify.dev)Related to support for jspecify standard (see jspecify.dev)