Fwd: Fwd: Proposal for generics over primitives needs a rethink

Gavin King gavin at hibernate.org
Mon Jan 5 20:27:26 UTC 2015


On Mon, Jan 5, 2015 at 6:48 PM, martin odersky <martin.odersky at epfl.ch> wrote:

> I think Any[] needs needs to erase either to Object, or to a new type
> such as "AnyArray". You need to use reflection to access the elements
> of of an Any[] by looking at the array element type tag.

Ahyes, that sounds like it would work.

It also sounds like with this approach you might want an additional
specialization. You would have:

- ArrayList (for ArrayList<Object>, ArrayList<String>, etc)
- ArrayList$$Any (for ArrayList<Any>, uses reflection)
- ArrayList$$int and friends

Thanks Martin.


-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the valhalla-dev mailing list