[Isolate-interest] Isolate: Generics and autoboxing considered harmful

Laurent Daynes Laurent.Daynes at Sun.COM
Wed May 25 05:22:47 EDT 2005


To be fair with Bill, there are a few JDK 1.5 features that are used:
- Enum  (IsolateStatus.ExitReason, IsolateStatus.State)
- varargs  (e.g., Isolate.start, LinkMessage.newCompositeMessage...)
- Generic signature (open and tryOpen)

Laurent

Miles Sabin wrote:

>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
>_______________________________________________
>Isolate-interest mailing list
>Isolate-interest at altair.cs.oswego.edu
>http://altair.cs.oswego.edu/mailman/listinfo/isolate-interest
>  
>

-- 
Laurent Daynes,

Sun Microsystems Inc.,
180 Av. de L'Europe
ZIRST de Montbonnot
Montbonnot Saint-Martin 38330
France

tel: +33 (0)4 76 18 88 18
fax: +33 (0)4 76 18 88 88


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20050525/fddd1b4f/attachment.htm


More information about the Isolate-interest mailing list