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

TypeError when a java.util.Comparator object is invoked as a function

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b121
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Nashorn supports calling FunctionalInterface interface objects to be treated like functions. This fails for java.util.Comparator objects:

        jjs> f = java.util.Comparator.reverseOrder()
        java.util.Collections$ReverseComparator@6283d8b8
        jjs> f.compare(343, 55)
        -1
        jjs> f(343, 55)
        <shell>:1 TypeError: java.util.Collections$ReverseComparator@6283d8b8 has no suc
        h function "equals"

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  sundar Sundararajan Athijegannathan
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: