Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-4461

ObservableBuffer fails to notify about some changes

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0-M3
    • Component/s: Library (Misc)
    • Labels:
      None
    • Environment:

      observable buffer

      Description

      === What steps will reproduce the problem (please be specific and use wikiformatting)? ===

          import scala.collection.mutable._
          import scala.collection.script._
       
          val buf = new ArrayBuffer[Int] with ObservableBuffer[Int]
          buf.subscribe(new Subscriber[Message[Int], ObservableBuffer[Int]] {
            def notify(pub: ObservableBuffer[Int], event: Message[Int]) = println(event)
          })
          
          buf += 1 // works
          buf ++= Array(2) // works
          buf ++= ArrayBuffer(3) // fails

      === What is the expected behavior? ===
      I expect to see three messages printed to the console:

      Include(End,1)
      Include(End,2)
      Include(End,3)

      === What do you see instead? ===
      Only the first two messages are printed:

      Include(End,1)
      Include(End,2)

      === Additional information ===
      Comes from the overloaded ++= in ArrayBuffer, which handles IndexedSeqs differently. Maybe other overloaded methods prevent the ObservableXXX decorators from notifying property in other circumstances, too.

      === What versions of the following are you using? ===

      • Scala: 2.8.1
      • Java: 1.6.0_24-b07-334-10M3326
      • Operating system: Mac OS X 10.6.7

        Attachments

          Activity

            People

            • Assignee:
              prokopec Aleksandar Prokopec
              Reporter:
              jppellet Jean-Philippe Pellet
            • Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: