Late-breaking API correction

Remi Forax forax at univ-mlv.fr
Thu Feb 6 07:45:43 PST 2014


On 02/06/2014 04:32 PM, Brian Goetz wrote:
> In a total flub, we managed to screw up the signature for one of the 
> variants of Comparator.thenComparing:
>
>   <U extends Comparable<? super U>> Comparator<T> thenComparing(
>     Function<? super T, ? extends U> keyExtractor,
>     Comparator<? super U> keyComparator);
>
> Here, the "U extends Comparable" bound is not needed, and harmful 
> (since you wouldn't be able to use this method for a non-comparable 
> key, even though a Comparator is provided.)  Just a dumb cut and paste 
> error.
>
> Tracked at:
>
>   https://bugs.openjdk.java.net/browse/JDK-8033590
>
> Will be reflected in FAB library spec bundle.
>

I agree, it should be:
<U> Comparator<T> thenComparing(
     Function<? super T, ? extends U> keyExtractor,
     Comparator<? super U> keyComparator)

Rémi



More information about the lambda-libs-spec-observers mailing list