Skip to content

Commit fc54427

Browse files
committed
Merge pull request scala#4233 from kanielc/SI-7770
SI-7770 mutable.BitSet.toImmutable isn't immutable
2 parents 92dce69 + 08f27bb commit fc54427

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/library/scala/collection/mutable/BitSet.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int]
160160
*
161161
* @return an immutable set containing all the elements of this set.
162162
*/
163+
@deprecated("If this BitSet contains a value that is 128 or greater, the result of this method is an 'immutable' " +
164+
"BitSet that shares state with this mutable BitSet. Thus, if the mutable BitSet is modified, it will violate the " +
165+
"immutability of the result.", "2.11.6")
163166
def toImmutable = immutable.BitSet.fromBitMaskNoCopy(elems)
164167

165168
override def clone(): BitSet = {

test/files/jvm/serialization-new.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: there were two deprecation warnings; re-run with -deprecation for details
1+
warning: there were three deprecation warnings; re-run with -deprecation for details
22
a1 = Array[1,2,3]
33
_a1 = Array[1,2,3]
44
arrayEquals(a1, _a1): true

test/files/jvm/serialization.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: there were two deprecation warnings; re-run with -deprecation for details
1+
warning: there were three deprecation warnings; re-run with -deprecation for details
22
a1 = Array[1,2,3]
33
_a1 = Array[1,2,3]
44
arrayEquals(a1, _a1): true

test/files/run/bitsets.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
warning: there were three deprecation warnings; re-run with -deprecation for details
12
ms0 = BitSet(2)
23
ms1 = BitSet(2)
34
ms2 = BitSet(2)

0 commit comments

Comments
 (0)