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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b129
    • Verification:
      Verified

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  henryjen Henry Jen
                  Reporter:
                  henryjen Henry Jen
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  14 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: