Proposal: Improved Wildcard Syntax for Java

Mark Mahieu mark at twistedbanana.demon.co.uk
Sun Mar 1 00:23:02 PST 2009


On 1 Mar 2009, at 07:08, Reinier Zwitserloot wrote:
>
> There's also a typo in 'mneumonic' :)
>
> NB: For what it's worth, because the need to remember super-produces
> extends-consumes does not go away, I don't think this is going to help
> much.

The PECS mnemonic is the other way around (http://java.sun.com/docs/ 
books/effective/generics.pdf).  I suppose that reinforces the point  
this proposal is making ;)

My current concern with this proposal, is that it appears to suggest  
migrating any and all code to use 'in/out';  although I can see how  
that might improve matters when applied to collection-y methods, it's  
less clear to me that it would be better in some other cases.  For  
example, on the class Class we have:

	boolean isAnnotationPresent(Class<? extends Annotation>  
annotationClass)

which feels more obvious to me than:

	boolean isAnnotationPresent(Class<out Annotation> annotationClass)

To be fair, I haven't given it long to sink in.  But perhaps some  
additional examples that don't involve the Collections API would be a  
good addition to this proposal?

Regards,

Mark




More information about the coin-dev mailing list