Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8015314 Umbrella: Stream API loose ends
  3. JDK-8023528

Rename Comparator combinators to disambiguate overloading methods

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • P3
    • Resolution: Fixed
    • None
    • 8
    • core-libs
    • None
    • 8
    • b106
    • Verified

    Description

      We currently have a pile of Comparator combinators, all currently called comparing() or thenComparing().

      These overloads have a problem: for implicit lambdas, we can't distinguish between

        comparing(T->U)
      and
        comparing(T->int)

      because we don't type-check the body of the lambda until we do overload selection, and don't do overload selection based on whether there are type errors in the body (this was roundly rejected as being too brittle). So for lambdas like:

        comparing(x -> x.size())

      we've got a circularity -- even under the older, more complex scheme.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: