Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8024970 André Bargull's list on Sep 17, 2013
  3. JDK-8080182

Array.prototype.sort throws IAE on inconsistent comparison

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u60, 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b65
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        function RandomObject() {
            this.toString = function() {
                return (Math.random() * 100).toString();
            }
        }

        for (var j=0; j <100; ++j) {
            var arr = [];
            for (var i = 0; i < 64; ++i)
                arr[i] = new RandomObject;
            arr.sort();
        }

        Expected: no IllegalArgumentException is thrown

        Actual: java.lang.IllegalArgumentException: Comparison method violates
        its general contract!

          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: