@@ -115,13 +115,21 @@ object ArraySeq {
115115 ArrayBuilder .make[T ]()(m) mapResult ArraySeq .unsafeWrapArray[T ]
116116 }
117117
118+ private def unsupportedUpdate : Nothing =
119+ throw new UnsupportedOperationException (" immutable ArraySeq does not support mutation" )
120+
121+ private final val updateDeprecationMsg =
122+ " Mutation is not supported for immutable ArraySeq, and should not have ever been " +
123+ " part of the API"
124+
118125 @ SerialVersionUID (3L )
119126 final class ofRef [T <: AnyRef ](val unsafeArray : Array [T ]) extends ArraySeq [T ] with Serializable {
120127 lazy val elemTag = ClassTag [T ](unsafeArray.getClass.getComponentType)
121128 def length : Int = unsafeArray.length
122129 def apply (index : Int ): T = unsafeArray(index)
123- def update (index : Int , elem : T ) { unsafeArray(index) = elem }
124- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
130+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
131+ def update (index : Int , elem : T ): Unit = unsupportedUpdate
132+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
125133 override def equals (that : Any ) = that match {
126134 case that : ofRef[_] =>
127135 arrayEquals(unsafeArray.asInstanceOf [Array [AnyRef ]],
@@ -135,8 +143,9 @@ object ArraySeq {
135143 def elemTag = ClassTag .Byte
136144 def length : Int = unsafeArray.length
137145 def apply (index : Int ): Byte = unsafeArray(index)
138- def update (index : Int , elem : Byte ) { unsafeArray(index) = elem }
139- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
146+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
147+ def update (index : Int , elem : Byte ): Unit = unsupportedUpdate
148+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
140149 override def equals (that : Any ) = that match {
141150 case that : ofByte => Arrays .equals(unsafeArray, that.unsafeArray)
142151 case _ => super .equals(that)
@@ -148,8 +157,9 @@ object ArraySeq {
148157 def elemTag = ClassTag .Short
149158 def length : Int = unsafeArray.length
150159 def apply (index : Int ): Short = unsafeArray(index)
151- def update (index : Int , elem : Short ) { unsafeArray(index) = elem }
152- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
160+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
161+ def update (index : Int , elem : Short ): Unit = unsupportedUpdate
162+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
153163 override def equals (that : Any ) = that match {
154164 case that : ofShort => Arrays .equals(unsafeArray, that.unsafeArray)
155165 case _ => super .equals(that)
@@ -161,8 +171,9 @@ object ArraySeq {
161171 def elemTag = ClassTag .Char
162172 def length : Int = unsafeArray.length
163173 def apply (index : Int ): Char = unsafeArray(index)
164- def update (index : Int , elem : Char ) { unsafeArray(index) = elem }
165- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
174+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
175+ def update (index : Int , elem : Char ): Unit = unsupportedUpdate
176+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
166177 override def equals (that : Any ) = that match {
167178 case that : ofChar => Arrays .equals(unsafeArray, that.unsafeArray)
168179 case _ => super .equals(that)
@@ -174,8 +185,9 @@ object ArraySeq {
174185 def elemTag = ClassTag .Int
175186 def length : Int = unsafeArray.length
176187 def apply (index : Int ): Int = unsafeArray(index)
177- def update (index : Int , elem : Int ) { unsafeArray(index) = elem }
178- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
188+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
189+ def update (index : Int , elem : Int ): Unit = unsupportedUpdate
190+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
179191 override def equals (that : Any ) = that match {
180192 case that : ofInt => Arrays .equals(unsafeArray, that.unsafeArray)
181193 case _ => super .equals(that)
@@ -187,8 +199,9 @@ object ArraySeq {
187199 def elemTag = ClassTag .Long
188200 def length : Int = unsafeArray.length
189201 def apply (index : Int ): Long = unsafeArray(index)
190- def update (index : Int , elem : Long ) { unsafeArray(index) = elem }
191- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
202+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
203+ def update (index : Int , elem : Long ): Unit = unsupportedUpdate
204+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
192205 override def equals (that : Any ) = that match {
193206 case that : ofLong => Arrays .equals(unsafeArray, that.unsafeArray)
194207 case _ => super .equals(that)
@@ -200,8 +213,9 @@ object ArraySeq {
200213 def elemTag = ClassTag .Float
201214 def length : Int = unsafeArray.length
202215 def apply (index : Int ): Float = unsafeArray(index)
203- def update (index : Int , elem : Float ) { unsafeArray(index) = elem }
204- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
216+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
217+ def update (index : Int , elem : Float ): Unit = unsupportedUpdate
218+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
205219 override def equals (that : Any ) = that match {
206220 case that : ofFloat => Arrays .equals(unsafeArray, that.unsafeArray)
207221 case _ => super .equals(that)
@@ -213,8 +227,9 @@ object ArraySeq {
213227 def elemTag = ClassTag .Double
214228 def length : Int = unsafeArray.length
215229 def apply (index : Int ): Double = unsafeArray(index)
216- def update (index : Int , elem : Double ) { unsafeArray(index) = elem }
217- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
230+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
231+ def update (index : Int , elem : Double ): Unit = unsupportedUpdate
232+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
218233 override def equals (that : Any ) = that match {
219234 case that : ofDouble => Arrays .equals(unsafeArray, that.unsafeArray)
220235 case _ => super .equals(that)
@@ -228,8 +243,9 @@ object ArraySeq {
228243 def elemTag = ClassTag .Boolean
229244 def length : Int = unsafeArray.length
230245 def apply (index : Int ): Boolean = unsafeArray(index)
231- def update (index : Int , elem : Boolean ) { unsafeArray(index) = elem }
232- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
246+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
247+ def update (index : Int , elem : Boolean ): Unit = unsupportedUpdate
248+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
233249 override def equals (that : Any ) = that match {
234250 case that : ofBoolean => Arrays .equals(unsafeArray, that.unsafeArray)
235251 case _ => super .equals(that)
@@ -241,8 +257,9 @@ object ArraySeq {
241257 def elemTag = ClassTag .Unit
242258 def length : Int = unsafeArray.length
243259 def apply (index : Int ): Unit = unsafeArray(index)
244- def update (index : Int , elem : Unit ) { unsafeArray(index) = elem }
245- override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
260+ @ deprecated(updateDeprecationMsg, since = " 2.4.2" )
261+ def update (index : Int , elem : Unit ): Unit = unsupportedUpdate
262+ override def hashCode = MurmurHash3 .arrayHash(unsafeArray, MurmurHash3 .seqSeed)
246263 override def equals (that : Any ) = that match {
247264 case that : ofUnit => unsafeArray.length == that.unsafeArray.length
248265 case _ => super .equals(that)
0 commit comments