scala/scala — pull request #3582 by adriaanm (2014-02-25 05:33:47+00:00)
Title: SI-8251 deprecate `ListBuffer::readOnly`

This is a minimal version of #3489, which only deprecates `readOnly`.

This is the first step towards fixing the unexpected behavior of `ListBuffer`.

Many of `ListBuffer`'s operations are forwarded to the underlying `List`,
essentially leaking that abstraction to clients that call e.g., `toIterable`.
When the buffer changes, the `Iterable` obtained through `toIterable` will
reflect that change.

To avoid this exposure, call `toList` to obtain an immutable copy.

See also:
https://groups.google.com/d/msg/scala-internals/g_-gIWgB8Os/kWazrALbLKEJ
https://gist.github.com/paulp/9081797