Scala Programming Language
  1. Scala Programming Language
  2. SI-4961

StackOverFlowError when modifying examples/sort2.scala

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows7 / JDK 1.7, Netbeans 7.01

      Description

      When expanding the List to be sorted by examples/sort2.scala to some more values like val xs2 = List(6, 2, 8, 5, 112,-44,-22,109,56,-66,43,42,109,-111,2341) the program crashes with a StackOverFlowError.

      As a scala beginner I have no idea if this error is due to the algorithm used in the example or if it reveals some bigger bug in Scala.

      This is the stacktrace:
      Exception in thread "main" java.lang.StackOverflowError
      at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:115)
      at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:42)
      at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:213)
      at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      at scala.collection.immutable.List.foreach(List.scala:45)
      at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
      at scala.collection.immutable.List.filter(List.scala:45)
      at examples.sort2$.sort(sort2.scala:14)

        Activity

        Hide
        Paul Phillips added a comment -

        Bug in the sort algorithm, will check in fix shortly.

        Show
        Paul Phillips added a comment - Bug in the sort algorithm, will check in fix shortly.
        Hide
        Commit Message Bot added a comment -

        (extempore in r25909) Fix bug in example sort.

        Embarrassing bug causes sort to explode if there are any
        duplicated elements. Closes SI-4961, no review.

        Show
        Commit Message Bot added a comment - (extempore in r25909 ) Fix bug in example sort. Embarrassing bug causes sort to explode if there are any duplicated elements. Closes SI-4961 , no review.

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Carlo Luib-Finettti
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:
              Resolved:

              Development