Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8033590

java.util.Comparator::thenComparing has unnecessary type restriction

XMLWordPrintable

    • b129
    • Verified

        FULL PRODUCT VERSION :


        A DESCRIPTION OF THE PROBLEM :
        The following method of java.util.Comparator requires that type U extend java.lang.Comparable.

          <U extends Comparable<? super U>> Comparator<T> thenComparing(
            Function<? super T, ? extends U> keyExtractor,
            Comparator<? super U> keyComparator);

        But this restriction is unnecessary because keyComparator is used to compare extracted key objects.



        REPRODUCIBILITY :
        This bug can be reproduced always.

              henryjen Henry Jen
              henryjen Henry Jen
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: