Nullness markers to enable flattening

Quân Anh Mai anhmdq at gmail.com
Thu Mar 2 14:35:47 UTC 2023


But we want a List<Integer> to be different from a List<int>. Thanks.

On Thu, 2 Mar 2023 at 22:22, Gernot Neppert <mcnepp02 at googlemail.com> wrote:

> 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/20dc413d/attachment.htm>


More information about the valhalla-spec-observers mailing list