Simplifying reified generics with partial specialization

Simon Ochsenreither simon at ochsenreither.de
Mon Jan 5 17:47:32 UTC 2015


> As to your other example, you'd get a 
> ClassCastException/ArrayStoreException because the storage is still 
> specialized. This behavior is specifically allowed by the List 
> interface contract.

a) That contract comes from pre-Generics ages.
b) One of the goals of Generics was to move errors from runtime to 
compile time. This would reverse the success of it (success in the sense 
of "I haven't seen a ClassCastException coming from the collection API 
for a long time"). I think it's fair to say that pretty much no codebase 
in the wild today would be prepared to handle such CCEs.
c) What about all the APIs out there, which are defined more strictly?


More information about the valhalla-dev mailing list