hg: lambda/lambda/jdk: 8009736: Comparator to allow narrowing type on combinator APIs

Dan Smith daniel.smith at oracle.com
Mon Mar 11 11:12:22 PDT 2013


[I mean Collections.reverseOrder]

Probably a bad idea.  Adding type parameters to an existing generic method (i.e., it already has at least one type parameter) will break all call sites that use explicit type parameters.  That's almost certainly beyond our tolerance for source-incompatible changes.

—Dan

On Mar 11, 2013, at 11:33 AM, Dan Smith <daniel.smith at oracle.com> wrote:

> To be consistent, Comparators.reverseOrder should be changed to match (thus avoiding an unchecked cast).  	Don't know what our compatibility policies are for existing generic methods, though...
> 
> —Dan
> 
> On Mar 9, 2013, at 11:27 PM, henry.jen at oracle.com wrote:
> 
>> Changeset: fb7b7275d220
>> Author:    henryjen
>> Date:      2013-03-08 21:54 -0800
>> URL:       http://hg.openjdk.java.net/lambda/lambda/jdk/rev/fb7b7275d220
>> 
>> 8009736: Comparator to allow narrowing type on combinator APIs
>> Reviewed-by:
>> Summary: Allow to narrow return type, add javadoc return tag
>> Allow key extract not limited to Comparable, but use a Comparator of key type.
>> 
>> ! src/share/classes/java/util/Comparator.java
>> ! src/share/classes/java/util/Comparators.java
>> 
>> 
> 
> 



More information about the lambda-dev mailing list