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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • None
    • b121
    • generic
    • generic

        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"

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

                Created:
                Updated:
                Resolved: