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

Inconsistent toString implementation in objects being sorted results in IllegalArgumentException

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description



      jjs> function RandomObject() { this.toString = function() { return
      (Math.random() * 100).toString(); } }
      jjs> 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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: