summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Cockburn <kanielc@gmail.com>2015-01-06 17:58:47 -0500
committerDenton Cockburn <kanielc@gmail.com>2015-01-07 20:24:05 -0500
commit08f27bbd41d91122d96ad58a70a42e55483c8b2b (patch)
treee861e0f2f31415dc42d6a45cb0c511725d69558b
parent7ba38a07916426314cc3bff6999f3992757e0b26 (diff)
downloadscala-08f27bbd41d91122d96ad58a70a42e55483c8b2b.tar.gz
scala-08f27bbd41d91122d96ad58a70a42e55483c8b2b.tar.bz2
scala-08f27bbd41d91122d96ad58a70a42e55483c8b2b.zip
SI-7770 mutable.BitSet.toImmutable isn't immutable
Mark method as deprecated due to it not providing the expected result, while fixing it will break existing code.
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala3
-rw-r--r--test/files/jvm/serialization-new.check2
-rw-r--r--test/files/jvm/serialization.check2
-rw-r--r--test/files/run/bitsets.check1
4 files changed, 6 insertions, 2 deletions
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index faa4155317..78150b5e88 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -160,6 +160,9 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
*
* @return an immutable set containing all the elements of this set.
*/
+ @deprecated("If this BitSet contains a value that is 128 or greater, the result of this method is an 'immutable' " +
+ "BitSet that shares state with this mutable BitSet. Thus, if the mutable BitSet is modified, it will violate the " +
+ "immutability of the result.", "2.11.6")
def toImmutable = immutable.BitSet.fromBitMaskNoCopy(elems)
override def clone(): BitSet = {
diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check
index 1555135926..cb26446f40 100644
--- a/test/files/jvm/serialization-new.check
+++ b/test/files/jvm/serialization-new.check
@@ -1,4 +1,4 @@
-warning: there were two deprecation warnings; re-run with -deprecation for details
+warning: there were three deprecation warnings; re-run with -deprecation for details
a1 = Array[1,2,3]
_a1 = Array[1,2,3]
arrayEquals(a1, _a1): true
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index 1555135926..cb26446f40 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -1,4 +1,4 @@
-warning: there were two deprecation warnings; re-run with -deprecation for details
+warning: there were three deprecation warnings; re-run with -deprecation for details
a1 = Array[1,2,3]
_a1 = Array[1,2,3]
arrayEquals(a1, _a1): true
diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check
index 41c2ccdcb8..c24fd6238f 100644
--- a/test/files/run/bitsets.check
+++ b/test/files/run/bitsets.check
@@ -1,3 +1,4 @@
+warning: there were three deprecation warnings; re-run with -deprecation for details
ms0 = BitSet(2)
ms1 = BitSet(2)
ms2 = BitSet(2)