Nullness markers to enable flattening
Gernot Neppert
mcnepp02 at googlemail.com
Thu Mar 2 14:21:54 UTC 2023
The following two lines are quotes from Dan's list of "key ideas":
- Nullness is an *optional* property of variables/expressions/etc.,
distinct from types.
- Type variable types have nullness, too.
To me, this looks a little contradictory. If we agree on the first
statement (and I do agree with it),
then Type-variables should not have an attached nullness-marker.
Rather, each _use_ of a Type-variable in a generic class would have
the attached nullness.
Otherwise, a type-variable would again denote a "non-nullable" type,
so you'd be back where you came from...
Consider the following example. IMHO, adding @NonNull to the
type-variable would be of no real advantage.
class Holder<T> {
static <T> Holder<T> of(@NonNull T value) {
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20230302/3f71bc2e/attachment-0001.htm>
More information about the valhalla-spec-observers
mailing list