Simplifying reified generics with partial specialization
Martijn Verburg
martijnverburg at gmail.com
Mon Jan 5 20:09:19 UTC 2015
On this side note - there is/was a great mailing list for these sorts of
discussions that I'd enjoyed lurking on (
https://groups.google.com/forum/#!forum/jvm-languages) - perhaps we could
resurrect that list somewhat and have some of those discussions there?
Cheers,
Martijn
On 5 January 2015 at 20:00, Ron Pressler <ron at paralleluniverse.co> wrote:
> > it would be a bad idea to have occurrences of “int" which actually
> mean int|null.
>
>
> They don’t. ArrayList<int> is specialized and cannot hold nulls, and while
> it would implement List<Integer>, it throws an NPE when trying to store a
> null, just like when trying to auto-unbox a null Integer. A List<Integer>
> is perfectly allowed to behave this way.
>
> But I suggest that, per Brian’s request, we continue this discussion
> elsewhere. This isn’t the place for protracted discussions.
>
>
>
>
>
>
>
> > On Jan 5, 2015, at 9:52 PM, Gavin King <gavin at hibernate.org> wrote:
> >
> >
> > On Mon, Jan 5, 2015 at 1:10 PM, Ron Pressler <ron at paralleluniverse.co>
> wrote:
> >
> >
> >> This would mean that ArrayList<int> will implement List<Integer> (and
> will
> >> therefore extend List and List<?>)
> >>
> >>
> >>
> >
> >
> > Ron I think this would be a bad idea. Yes, I know that Java
> > unfortunately doesn't provide a typesafe null value, but I still think
> > that it would be a bad idea to have occurrences of "int" which
> > actually mean int|null. I think there's a really strong precedent in
> > the language that ints can't be null.
> >
> >
> > OTOH, perhaps it would be viable to make ArrayList<int> a subtype of
> > ArrayList<? extends Integer>.
> >
> >
>
>
More information about the valhalla-dev
mailing list