Skip to content

Commit 50ed12d

Browse files
committed
Address binary incompatibilities
- Restore default implementation of ClassTag.apply in 2.12.x - Whitelist the change to add a concrete implementation of toList in IndexedSeqOptimized. I tested the latter change for potential breakage with: ``` object Test { def main(args: Array[String]) { def s = new collection.immutable.WrappedString("") s.toList (s: collection.IndexedSeqOptimized[Char, Any]).toList (s: collection.GenTraversableOnce[Char]).toList } } ``` ``` $ qscalac sandbox/test.scala && scala-launch 2.12.0 Test $ scalac-launch 2.12.0 sandbox/test.scala && qscala Test ```
1 parent 4a8810b commit 50ed12d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

library/src/mima-filters/2.12.0.forwards.excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ ProblemFilters.exclude[MissingFieldProblem]("scala.collection.immutable.Map#Map1
4545
ProblemFilters.exclude[MissingFieldProblem]("scala.collection.immutable.Map#Map2.serialVersionUID")
4646
ProblemFilters.exclude[MissingFieldProblem]("scala.collection.immutable.Map#Map3.serialVersionUID")
4747
ProblemFilters.exclude[MissingFieldProblem]("scala.collection.immutable.Map#Map4.serialVersionUID")
48+
ProblemFilters.exclude[DirectAbstractMethodProblem]("scala.collection.GenTraversableOnce.toList")

library/src/scala/reflect/ClassTag.scala

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,20 @@ trait ClassTag[T] extends ClassManifestDeprecatedApis[T] with Equals with Serial
4646
def wrap: ClassTag[Array[T]] = ClassTag[Array[T]](arrayClass(runtimeClass))
4747

4848
/** Produces a new array with element type `T` and length `len` */
49-
override def newArray(len: Int): Array[T]
49+
override def newArray(len: Int): Array[T] = {
50+
runtimeClass match {
51+
case java.lang.Byte.TYPE => new Array[Byte](len).asInstanceOf[Array[T]]
52+
case java.lang.Short.TYPE => new Array[Short](len).asInstanceOf[Array[T]]
53+
case java.lang.Character.TYPE => new Array[Char](len).asInstanceOf[Array[T]]
54+
case java.lang.Integer.TYPE => new Array[Int](len).asInstanceOf[Array[T]]
55+
case java.lang.Long.TYPE => new Array[Long](len).asInstanceOf[Array[T]]
56+
case java.lang.Float.TYPE => new Array[Float](len).asInstanceOf[Array[T]]
57+
case java.lang.Double.TYPE => new Array[Double](len).asInstanceOf[Array[T]]
58+
case java.lang.Boolean.TYPE => new Array[Boolean](len).asInstanceOf[Array[T]]
59+
case java.lang.Void.TYPE => new Array[Unit](len).asInstanceOf[Array[T]]
60+
case _ => java.lang.reflect.Array.newInstance(runtimeClass, len).asInstanceOf[Array[T]]
61+
}
62+
}
5063

5164
/** A ClassTag[T] can serve as an extractor that matches only objects of type T.
5265
*

0 commit comments

Comments
 (0)