[Isolate-interest] Isolate: Generics and autoboxing considered
harmful
Miles Sabin
miles at milessabin.com
Wed May 25 04:36:33 EDT 2005
Bill Foote wrote,
> However, this last rev added generics and autoboxing to the API.
Only generics ... no autoboxing.
> 2) Every place where generics and autoboxing occur in the API,
> include normative text saying what they map to in
> compilation environments that don't support these new
> features. It must be sufficient to unambiguously specify the
> signatures that would be present in a pre-autoboxing/generics
> environment, and readable by someone "skilled in the art" who
> isn't up on generics and autoboxing.
>
> I'm of course open to other solutions.
>
> I know, it's tempting to say "well, people should know about the
> mapping," but that's not good enough for standards organizations.
I'm afraid I can't resist the temptation ;-)
The only place we use generics is on the open method on LinkMessage. The
generic signature is,
<T> T open(Class<T> type)
and a generic use looks like,
String s = m.open(String.class);
On platforms which don't support generics the signature would be,
Object open(Class type)
and a non-generic use would look like,
String s = (String)m.open(String.class)
ie. the mapping is: erase the type parameters to the bound (Object in
this case) and insert the necessary casts by hand.
I don't think there'd be any particular problem adding a note to the
documentation mentioning this, but it'd just be duplicating text from
the JLS, so is it really necessary?
Cheers,
Miles
More information about the Isolate-interest
mailing list