From 410b1fd6ed140dc03b74f6d47ea3e150e6670bfe Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sat, 3 Jan 2026 15:45:02 +0900 Subject: [PATCH] Replace old wildcard syntax --- library/src/scala/Array.scala | 2 +- library/src/scala/NamedTuple.scala | 4 ++-- library/src/scala/collection/ArrayOps.scala | 4 ++-- library/src/scala/collection/IndexedSeq.scala | 4 ++-- library/src/scala/collection/Iterable.scala | 2 +- library/src/scala/collection/LinearSeq.scala | 2 +- library/src/scala/collection/Map.scala | 2 +- library/src/scala/collection/Seq.scala | 2 +- library/src/scala/collection/SortedMap.scala | 2 +- .../scala/collection/concurrent/TrieMap.scala | 16 ++++++------- .../convert/JavaCollectionWrappers.scala | 18 +++++++------- .../generic/DefaultSerializationProxy.scala | 6 ++--- .../scala/collection/immutable/ArraySeq.scala | 6 ++--- .../scala/collection/immutable/HashMap.scala | 8 +++---- .../scala/collection/immutable/HashSet.scala | 6 ++--- .../scala/collection/immutable/IntMap.scala | 2 +- .../src/scala/collection/immutable/List.scala | 2 +- .../scala/collection/immutable/LongMap.scala | 2 +- .../src/scala/collection/immutable/Map.scala | 2 +- .../collection/immutable/NumericRange.scala | 2 +- .../src/scala/collection/immutable/Seq.scala | 4 ++-- .../scala/collection/immutable/SeqMap.scala | 2 +- .../src/scala/collection/immutable/Set.scala | 2 +- .../scala/collection/immutable/TreeMap.scala | 2 +- .../collection/immutable/TreeSeqMap.scala | 2 +- .../scala/collection/immutable/TreeSet.scala | 2 +- .../scala/collection/immutable/Vector.scala | 24 +++++++++---------- .../scala/collection/mutable/AnyRefMap.scala | 2 +- .../collection/mutable/ArrayBuffer.scala | 2 +- .../collection/mutable/ArrayBuilder.scala | 2 +- .../scala/collection/mutable/ArraySeq.scala | 4 ++-- .../scala/collection/mutable/LongMap.scala | 2 +- .../src/scala/collection/mutable/Map.scala | 6 ++--- .../src/scala/concurrent/impl/Promise.scala | 4 ++-- library/src/scala/math/Equiv.scala | 20 ++++++++-------- library/src/scala/math/Ordering.scala | 24 +++++++++---------- .../reflect/ClassManifestDeprecatedApis.scala | 6 ++--- library/src/scala/reflect/Manifest.scala | 6 ++--- library/src/scala/runtime/ScalaRunTime.scala | 14 +++++------ .../src/scala/util/hashing/MurmurHash3.scala | 4 ++-- 40 files changed, 114 insertions(+), 114 deletions(-) diff --git a/library/src/scala/Array.scala b/library/src/scala/Array.scala index e081905c7b18..461abdef5803 100644 --- a/library/src/scala/Array.scala +++ b/library/src/scala/Array.scala @@ -190,7 +190,7 @@ object Array { def apply[T: ClassTag](xs: T*): Array[T] = { val len = xs.length xs match { - case wa: immutable.ArraySeq[_] if wa.unsafeArray.getClass.getComponentType == classTag[T].runtimeClass => + case wa: immutable.ArraySeq[?] if wa.unsafeArray.getClass.getComponentType == classTag[T].runtimeClass => // We get here in test/files/run/sd760a.scala, `Array[T](t)` for // a specialized type parameter `T`. While we still pay for two // copies of the array it is better than before when we also boxed diff --git a/library/src/scala/NamedTuple.scala b/library/src/scala/NamedTuple.scala index 998a87ef485f..04d55e17ca1a 100644 --- a/library/src/scala/NamedTuple.scala +++ b/library/src/scala/NamedTuple.scala @@ -223,8 +223,8 @@ object NamedTupleDecomposition: /** The names of a named tuple, represented as a tuple of literal string values. */ type Names[X <: AnyNamedTuple] <: Tuple = X match - case NamedTuple[n, _] => n + case NamedTuple[n, ?] => n /** The value types of a named tuple represented as a regular tuple. */ type DropNames[NT <: AnyNamedTuple] <: Tuple = NT match - case NamedTuple[_, x] => x + case NamedTuple[?, x] => x diff --git a/library/src/scala/collection/ArrayOps.scala b/library/src/scala/collection/ArrayOps.scala index 99db3eceb0b0..c482056a2b05 100644 --- a/library/src/scala/collection/ArrayOps.scala +++ b/library/src/scala/collection/ArrayOps.scala @@ -994,10 +994,10 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal { var i = 0 while(i < len) { xs(i) match { - case it: IterableOnce[_] => + case it: IterableOnce[?] => val k = it.knownSize if(k > 0) size += k - case a: Array[_] => size += a.length + case a: Array[?] => size += a.length case _ => } i += 1 diff --git a/library/src/scala/collection/IndexedSeq.scala b/library/src/scala/collection/IndexedSeq.scala index 8528928cc5eb..fcf7053e1050 100644 --- a/library/src/scala/collection/IndexedSeq.scala +++ b/library/src/scala/collection/IndexedSeq.scala @@ -104,7 +104,7 @@ transparent trait IndexedSeqOps[+A, +CC[_], +C] extends Any with SeqOps[A, CC, C if (!isEmpty) apply(0) else throw new NoSuchElementException(s"head of empty ${ self match { - case self: IndexedSeq[_] => self.collectionClassName + case self: IndexedSeq[?] => self.collectionClassName case _ => toString } }") @@ -115,7 +115,7 @@ transparent trait IndexedSeqOps[+A, +CC[_], +C] extends Any with SeqOps[A, CC, C if (!isEmpty) apply(length - 1) else throw new NoSuchElementException(s"last of empty ${ self match { - case self: IndexedSeq[_] => self.collectionClassName + case self: IndexedSeq[?] => self.collectionClassName case _ => toString } }") diff --git a/library/src/scala/collection/Iterable.scala b/library/src/scala/collection/Iterable.scala index 2e2a4e3bac08..f117046972d0 100644 --- a/library/src/scala/collection/Iterable.scala +++ b/library/src/scala/collection/Iterable.scala @@ -1022,7 +1022,7 @@ trait MapFactoryDefaults[K, +V, override protected def newSpecificBuilder: mutable.Builder[(K, V @uncheckedVariance), CC[K, V @uncheckedVariance]] = mapFactory.newBuilder[K, V] override def empty: CC[K, V @uncheckedVariance] = (this: AnyRef) match { // Implemented here instead of in TreeSeqMap since overriding empty in TreeSeqMap is not forwards compatible (should be moved) - case self: immutable.TreeSeqMap[_, _] => immutable.TreeSeqMap.empty(self.orderedBy).asInstanceOf[CC[K, V]] + case self: immutable.TreeSeqMap[?, ?] => immutable.TreeSeqMap.empty(self.orderedBy).asInstanceOf[CC[K, V]] case _ => mapFactory.empty } diff --git a/library/src/scala/collection/LinearSeq.scala b/library/src/scala/collection/LinearSeq.scala index c31077bffa39..1aa69d909dd7 100644 --- a/library/src/scala/collection/LinearSeq.scala +++ b/library/src/scala/collection/LinearSeq.scala @@ -104,7 +104,7 @@ transparent trait LinearSeqOps[+A, +CC[X] <: LinearSeq[X], +C <: LinearSeq[A] & if (thatKnownSize >= 0) this lengthCompare thatKnownSize else that match { - case that: LinearSeq[_] => + case that: LinearSeq[?] => var thisSeq = this var thatSeq = that while (thisSeq.nonEmpty && thatSeq.nonEmpty) { diff --git a/library/src/scala/collection/Map.scala b/library/src/scala/collection/Map.scala index 18cd7226782e..1de2e26e3cb0 100644 --- a/library/src/scala/collection/Map.scala +++ b/library/src/scala/collection/Map.scala @@ -66,7 +66,7 @@ trait Map[K, +V] */ override def equals(o: Any): Boolean = (this eq o.asInstanceOf[AnyRef]) || (o match { - case map: Map[K @unchecked, _] if map.canEqual(this) => + case map: Map[K @unchecked, ?] if map.canEqual(this) => (this.size == map.size) && { try this.forall(kv => map.getOrElse(kv._1, Map.DefaultSentinelFn()) == kv._2) catch { case _: ClassCastException => false } // PR #9565 / scala/bug#12228 diff --git a/library/src/scala/collection/Seq.scala b/library/src/scala/collection/Seq.scala index 5f3a49b09b6d..f9c5729bf8a4 100644 --- a/library/src/scala/collection/Seq.scala +++ b/library/src/scala/collection/Seq.scala @@ -1073,7 +1073,7 @@ object SeqOps { } // Now we know we actually need KMP search, so do it else S match { - case xs: scala.collection.IndexedSeq[_] => + case xs: scala.collection.IndexedSeq[?] => // We can index into S directly; it should be adequately fast val Wopt = kmpOptimizeWord(W, n0, n1, forward) val T = kmpJumpTable(Wopt, n1-n0) diff --git a/library/src/scala/collection/SortedMap.scala b/library/src/scala/collection/SortedMap.scala index 3170caf3e06f..40199f7bd014 100644 --- a/library/src/scala/collection/SortedMap.scala +++ b/library/src/scala/collection/SortedMap.scala @@ -33,7 +33,7 @@ trait SortedMap[K, +V] override def equals(that: Any): Boolean = that match { case _ if this eq that.asInstanceOf[AnyRef] => true - case sm: SortedMap[K @unchecked, _] if sm.ordering == this.ordering => + case sm: SortedMap[K @unchecked, ?] if sm.ordering == this.ordering => (sm canEqual this) && (this.size == sm.size) && { val i1 = this.iterator diff --git a/library/src/scala/collection/concurrent/TrieMap.scala b/library/src/scala/collection/concurrent/TrieMap.scala index 74f964cfa6ed..314767ee935c 100644 --- a/library/src/scala/collection/concurrent/TrieMap.scala +++ b/library/src/scala/collection/concurrent/TrieMap.scala @@ -55,10 +55,10 @@ private[collection] final class INode[K, V](bn: MainNode[K, V] | Null, g: Gen, e prev match { case null => m - case fn: FailedNode[_, _] => // try to commit to previous value + case fn: FailedNode[?, ?] => // try to commit to previous value if (CAS(m, fn.prev)) fn.prev else GCAS_Complete(/*READ*/mainnode, ct) - case vn: MainNode[_, _] => + case vn: MainNode[?, ?] => // Assume that you've read the root from the generation G. // Assume that the snapshot algorithm is correct. // ==> you can only reach nodes in generations <= G. @@ -284,7 +284,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V] | Null, g: Gen, e case basicNode => throw new MatchError(basicNode) } } - case tn: TNode[_, _] => // 3) non-live node + case tn: TNode[?, ?] => // 3) non-live node def cleanReadOnly(tn: TNode[K, V]) = if (ct.nonReadOnly) { clean(parent.nn, ct, lev - 5) RESTART @@ -412,9 +412,9 @@ private[collection] final class INode[K, V](bn: MainNode[K, V] | Null, g: Gen, e /* this is a quiescent method! */ def string(lev: Int): String = "%sINode -> %s".format(" " * lev, mainnode match { case null => "" - case tn: TNode[_, _] => "TNode(%s, %s, %d, !)".format(tn.k, tn.v, tn.hc) - case cn: CNode[_, _] => cn.string(lev) - case ln: LNode[_, _] => ln.string(lev) + case tn: TNode[?, ?] => "TNode(%s, %s, %d, !)".format(tn.k, tn.v, tn.hc) + case cn: CNode[?, ?] => cn.string(lev) + case ln: LNode[?, ?] => ln.string(lev) case x => "".format(x) }) @@ -549,7 +549,7 @@ private[collection] final class CNode[K, V](val bitmap: Int, val array: Array[Ba while (i < array.length) { val pos = (i + offset) % array.length array(pos) match { - case sn: SNode[_, _] => sz += 1 + case sn: SNode[?, ?] => sz += 1 case in: INode[K, V] @uc => sz += in.cachedSize(ct) case basicNode => throw new MatchError(basicNode) } @@ -604,7 +604,7 @@ private[collection] final class CNode[K, V](val bitmap: Int, val array: Array[Ba } private def resurrect(inode: INode[K, V], inodemain: AnyRef): BasicNode = inodemain match { - case tn: TNode[_, _] => tn.copyUntombed + case tn: TNode[?, ?] => tn.copyUntombed case _ => inode } diff --git a/library/src/scala/collection/convert/JavaCollectionWrappers.scala b/library/src/scala/collection/convert/JavaCollectionWrappers.scala index 3fba0b926364..6dc918ac330b 100644 --- a/library/src/scala/collection/convert/JavaCollectionWrappers.scala +++ b/library/src/scala/collection/convert/JavaCollectionWrappers.scala @@ -38,7 +38,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { def nextElement(): A = underlying.next() override def remove(): Nothing = throw new UnsupportedOperationException override def equals(other: Any): Boolean = other match { - case that: IteratorWrapper[_] => this.underlying == that.underlying + case that: IteratorWrapper[?] => this.underlying == that.underlying case _ => false } override def hashCode(): Int = underlying.hashCode() @@ -49,7 +49,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { def hasNext = underlying.hasNext def next(): A = underlying.next override def equals(other: Any): Boolean = other match { - case that: JIteratorWrapper[_] => this.underlying == that.underlying + case that: JIteratorWrapper[?] => this.underlying == that.underlying case _ => false } override def hashCode(): Int = underlying.hashCode() @@ -60,7 +60,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { def hasNext = underlying.hasMoreElements def next(): A = underlying.nextElement override def equals(other: Any): Boolean = other match { - case that: JEnumerationWrapper[_] => this.underlying == that.underlying + case that: JEnumerationWrapper[?] => this.underlying == that.underlying case _ => false } override def hashCode(): Int = underlying.hashCode() @@ -76,7 +76,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { @SerialVersionUID(3L) class IterableWrapper[A](val underlying: Iterable[A]^) extends ju.AbstractCollection[A] with IterableWrapperTrait[A] with Serializable { override def equals(other: Any): Boolean = other match { - case that: IterableWrapper[_] => this.underlying == that.underlying + case that: IterableWrapper[?] => this.underlying == that.underlying case _ => false } override def hashCode(): Int = underlying.hashCode() @@ -91,7 +91,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { override def iterableFactory: mutable.ArrayBuffer.type = mutable.ArrayBuffer override def isEmpty: Boolean = !underlying.iterator().hasNext override def equals(other: Any): Boolean = other match { - case that: JIterableWrapper[_] => this.underlying == that.underlying + case that: JIterableWrapper[?] => this.underlying == that.underlying case _ => false } override def hashCode(): Int = underlying.hashCode() @@ -108,7 +108,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { override def isEmpty = underlying.isEmpty override def iterableFactory: mutable.ArrayBuffer.type = mutable.ArrayBuffer override def equals(other: Any): Boolean = other match { - case that: JCollectionWrapper[_] => this.underlying == that.underlying + case that: JCollectionWrapper[?] => this.underlying == that.underlying case _ => false } override def hashCode(): Int = underlying.hashCode() @@ -291,7 +291,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { } override def equals(other: Any) = other match { - case e: ju.Map.Entry[_, _] => k == e.getKey && v == e.getValue + case e: ju.Map.Entry[?, ?] => k == e.getKey && v == e.getValue case _ => false } } @@ -301,7 +301,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { prev match { case Some(k) => underlying match { - case mm: mutable.Map[a, _] => + case mm: mutable.Map[a, ?] => mm -= k prev = None case _ => @@ -548,7 +548,7 @@ private[collection] object JavaCollectionWrappers extends Serializable { } override def equals(other: Any): Boolean = other match { - case that: DictionaryWrapper[_, _] => this.underlying == that.underlying + case that: DictionaryWrapper[?, ?] => this.underlying == that.underlying case _ => false } diff --git a/library/src/scala/collection/generic/DefaultSerializationProxy.scala b/library/src/scala/collection/generic/DefaultSerializationProxy.scala index 3481241e6ccf..f848ee1328a8 100644 --- a/library/src/scala/collection/generic/DefaultSerializationProxy.scala +++ b/library/src/scala/collection/generic/DefaultSerializationProxy.scala @@ -80,9 +80,9 @@ private[collection] case object SerializeEnd transparent trait DefaultSerializable extends Serializable { this: scala.collection.Iterable[?]^ => protected def writeReplace(): AnyRef^{this} = { val f: Factory[Any, Any] = this match { - case it: scala.collection.SortedMap[_, _] => it.sortedMapFactory.sortedMapFactory[Any, Any](using it.ordering.asInstanceOf[Ordering[Any]]).asInstanceOf[Factory[Any, Any]] - case it: scala.collection.Map[_, _] => it.mapFactory.mapFactory[Any, Any].asInstanceOf[Factory[Any, Any]] - case it: scala.collection.SortedSet[_] => it.sortedIterableFactory.evidenceIterableFactory[Any](using it.ordering.asInstanceOf[Ordering[Any]]) + case it: scala.collection.SortedMap[?, ?] => it.sortedMapFactory.sortedMapFactory[Any, Any](using it.ordering.asInstanceOf[Ordering[Any]]).asInstanceOf[Factory[Any, Any]] + case it: scala.collection.Map[?, ?] => it.mapFactory.mapFactory[Any, Any].asInstanceOf[Factory[Any, Any]] + case it: scala.collection.SortedSet[?] => it.sortedIterableFactory.evidenceIterableFactory[Any](using it.ordering.asInstanceOf[Ordering[Any]]) case it => it.iterableFactory.iterableFactory } new DefaultSerializationProxy(f, this) diff --git a/library/src/scala/collection/immutable/ArraySeq.scala b/library/src/scala/collection/immutable/ArraySeq.scala index c1ff47f994ef..20beed1f9157 100644 --- a/library/src/scala/collection/immutable/ArraySeq.scala +++ b/library/src/scala/collection/immutable/ArraySeq.scala @@ -141,7 +141,7 @@ sealed abstract class ArraySeq[+A] } suffix match { - case that: ArraySeq[_] => + case that: ArraySeq[?] => val result = appendedAllArraySeq(that.asInstanceOf[ArraySeq[B]]) if (result == null) genericResult else result @@ -165,7 +165,7 @@ sealed abstract class ArraySeq[+A] } prefix match { - case that: ArraySeq[_] => + case that: ArraySeq[?] => val result = that.asInstanceOf[ArraySeq[B]].appendedAllArraySeq(this) if (result == null) genericResult else result @@ -334,7 +334,7 @@ object ArraySeq extends StrictOptimizedClassTagSeqFactory[ArraySeq] { self => def apply(i: Int): T = unsafeArray(i) override def hashCode() = MurmurHash3.arraySeqHash(unsafeArray) override def equals(that: Any): Boolean = that match { - case that: ofRef[_] => + case that: ofRef[?] => Array.equals( this.unsafeArray.asInstanceOf[Array[AnyRef]], that.unsafeArray.asInstanceOf[Array[AnyRef]]) diff --git a/library/src/scala/collection/immutable/HashMap.scala b/library/src/scala/collection/immutable/HashMap.scala index 4b60ee25447c..ae4642837953 100644 --- a/library/src/scala/collection/immutable/HashMap.scala +++ b/library/src/scala/collection/immutable/HashMap.scala @@ -279,7 +279,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode: override def equals(that: Any): Boolean = that match { - case map: HashMap[_, _] => (this eq map) || (this.rootNode == map.rootNode) + case map: HashMap[?, ?] => (this eq map) || (this.rootNode == map.rootNode) case _ => super.equals(that) } @@ -1313,13 +1313,13 @@ private final class BitmapIndexedMapNode[K, +V]( index += 1 } } - case _: HashCollisionMapNode[_, _] => + case _: HashCollisionMapNode[?, ?] => throw new RuntimeException("Cannot merge BitmapIndexedMapNode with HashCollisionMapNode") } override def equals(that: Any): Boolean = that match { - case node: BitmapIndexedMapNode[_, _] => + case node: BitmapIndexedMapNode[?, ?] => (this eq node) || (this.cachedJavaKeySetHashCode == node.cachedJavaKeySetHashCode) && (this.nodeMap == node.nodeMap) && @@ -1989,7 +1989,7 @@ private final class HashCollisionMapNode[K, +V ]( override def equals(that: Any): Boolean = that match { - case node: HashCollisionMapNode[_, _] => + case node: HashCollisionMapNode[?, ?] => (this eq node) || (this.hash == node.hash) && (this.content.length == node.content.length) && { diff --git a/library/src/scala/collection/immutable/HashSet.scala b/library/src/scala/collection/immutable/HashSet.scala index b74dbf91c6a0..f5c008104db7 100644 --- a/library/src/scala/collection/immutable/HashSet.scala +++ b/library/src/scala/collection/immutable/HashSet.scala @@ -204,7 +204,7 @@ final class HashSet[A] private[immutable](private[immutable] val rootNode: Bitma override def equals(that: Any): Boolean = that match { - case set: HashSet[_] => (this eq set) || (this.rootNode == set.rootNode) + case set: HashSet[?] => (this eq set) || (this.rootNode == set.rootNode) case _ => super.equals(that) } @@ -1394,7 +1394,7 @@ private final class BitmapIndexedSetNode[A]( override def equals(that: Any): Boolean = that match { - case node: BitmapIndexedSetNode[_] => + case node: BitmapIndexedSetNode[?] => (this eq node) || (this.cachedJavaKeySetHashCode == node.cachedJavaKeySetHashCode) && (this.nodeMap == node.nodeMap) && @@ -1824,7 +1824,7 @@ private final class HashCollisionSetNode[A](val originalHash: Int, val hash: Int override def equals(that: Any): Boolean = that match { - case node: HashCollisionSetNode[_] => + case node: HashCollisionSetNode[?] => (this eq node) || (this.hash == node.hash) && (this.content.size == node.content.size) && diff --git a/library/src/scala/collection/immutable/IntMap.scala b/library/src/scala/collection/immutable/IntMap.scala index 5e508360993c..028e2d26c01d 100644 --- a/library/src/scala/collection/immutable/IntMap.scala +++ b/library/src/scala/collection/immutable/IntMap.scala @@ -65,7 +65,7 @@ object IntMap { // careful handling. override def equals(that : Any) = that match { case _: this.type => true - case _: IntMap[_] => false // The only empty IntMaps are eq Nil + case _: IntMap[?] => false // The only empty IntMaps are eq Nil case _ => super.equals(that) } } diff --git a/library/src/scala/collection/immutable/List.scala b/library/src/scala/collection/immutable/List.scala index f105cefa4142..d402655989ba 100644 --- a/library/src/scala/collection/immutable/List.scala +++ b/library/src/scala/collection/immutable/List.scala @@ -603,7 +603,7 @@ sealed abstract class List[+A] } o match { - case that: List[_] => listEq(this, that) + case that: List[?] => listEq(this, that) case _ => super.equals(o) } } diff --git a/library/src/scala/collection/immutable/LongMap.scala b/library/src/scala/collection/immutable/LongMap.scala index a8634f4100b0..c765efc51ee4 100644 --- a/library/src/scala/collection/immutable/LongMap.scala +++ b/library/src/scala/collection/immutable/LongMap.scala @@ -67,7 +67,7 @@ object LongMap { // Important, don't remove this! See IntMap for explanation. override def equals(that : Any) = that match { case _: this.type => true - case _: LongMap[_] => false // The only empty LongMaps are eq Nil + case _: LongMap[?] => false // The only empty LongMaps are eq Nil case _ => super.equals(that) } } diff --git a/library/src/scala/collection/immutable/Map.scala b/library/src/scala/collection/immutable/Map.scala index 01f48eae857f..a71ad1a7593a 100644 --- a/library/src/scala/collection/immutable/Map.scala +++ b/library/src/scala/collection/immutable/Map.scala @@ -221,7 +221,7 @@ object Map extends MapFactory[Map] { def from[K, V](it: IterableOnce[(K, V)]^): Map[K, V] = (it: @unchecked) match { - case it: Iterable[_] if it.isEmpty => empty[K, V] + case it: Iterable[?] if it.isEmpty => empty[K, V] // Since IterableOnce[(K, V)] launders the variance of K, // identify only our implementations which can be soundly substituted. // For example, the ordering used by sorted maps would fail on widened key type. (scala/bug#12745) diff --git a/library/src/scala/collection/immutable/NumericRange.scala b/library/src/scala/collection/immutable/NumericRange.scala index 442bb2530c11..34a6ade99349 100644 --- a/library/src/scala/collection/immutable/NumericRange.scala +++ b/library/src/scala/collection/immutable/NumericRange.scala @@ -353,7 +353,7 @@ sealed class NumericRange[T]( override protected final def applyPreferredMaxLength: Int = Int.MaxValue override def equals(other: Any): Boolean = other match { - case x: NumericRange[_] => + case x: NumericRange[?] => (x canEqual this) && (length == x.length) && ( (isEmpty) || // all empty sequences are equal (start == x.start && last == x.last) // same length and same endpoints implies equality diff --git a/library/src/scala/collection/immutable/Seq.scala b/library/src/scala/collection/immutable/Seq.scala index 7bd3a9a540a8..f5b0954606f3 100644 --- a/library/src/scala/collection/immutable/Seq.scala +++ b/library/src/scala/collection/immutable/Seq.scala @@ -55,13 +55,13 @@ trait IndexedSeq[+A] extends Seq[A] final override def toIndexedSeq: IndexedSeq[A] = this override def canEqual(that: Any): Boolean = that match { - case otherIndexedSeq: IndexedSeq[_] => length == otherIndexedSeq.length && super.canEqual(that) + case otherIndexedSeq: IndexedSeq[?] => length == otherIndexedSeq.length && super.canEqual(that) case _ => super.canEqual(that) } override def sameElements[B >: A](o: IterableOnce[B]^): Boolean = o match { - case that: IndexedSeq[_] => + case that: IndexedSeq[?] => (this eq that) || { val length = this.length var equal = length == that.length diff --git a/library/src/scala/collection/immutable/SeqMap.scala b/library/src/scala/collection/immutable/SeqMap.scala index 64ac9bfc40c4..db79b5b647df 100644 --- a/library/src/scala/collection/immutable/SeqMap.scala +++ b/library/src/scala/collection/immutable/SeqMap.scala @@ -57,7 +57,7 @@ object SeqMap extends MapFactory[SeqMap] { case m: SeqMap2[K, V] => m case m: SeqMap3[K, V] => m case m: SeqMap4[K, V] => m - case it: Iterable[_] if it.isEmpty => empty[K, V] + case it: Iterable[?] if it.isEmpty => empty[K, V] case _ => (newBuilder[K, V] ++= it).result() } diff --git a/library/src/scala/collection/immutable/Set.scala b/library/src/scala/collection/immutable/Set.scala index 93fb55962626..6db1468378e1 100644 --- a/library/src/scala/collection/immutable/Set.scala +++ b/library/src/scala/collection/immutable/Set.scala @@ -109,7 +109,7 @@ object Set extends IterableFactory[Set] { case s: Set2[E] => s case s: Set3[E] => s case s: Set4[E] => s - case s: HashMap[E @unchecked, _]#HashKeySet => s + case s: HashMap[E @unchecked, ?]#HashKeySet => s case s: MapOps[E, Any, Map, Map[E, Any]]#LazyImmutableKeySet @unchecked => s // We also want `SortedSet` (and subclasses, such as `BitSet`) // to rebuild themselves, to avoid element type widening issues. diff --git a/library/src/scala/collection/immutable/TreeMap.scala b/library/src/scala/collection/immutable/TreeMap.scala index f807f9680456..007d323ef555 100644 --- a/library/src/scala/collection/immutable/TreeMap.scala +++ b/library/src/scala/collection/immutable/TreeMap.scala @@ -296,7 +296,7 @@ final class TreeMap[K, +V] private (private val tree: RB.Tree[K, V] | Null)(impl } } override def equals(obj: Any): Boolean = obj match { - case that: TreeMap[K @unchecked, _] if ordering == that.ordering => RB.entriesEqual(tree, that.tree) + case that: TreeMap[K @unchecked, ?] if ordering == that.ordering => RB.entriesEqual(tree, that.tree) case _ => super.equals(obj) } diff --git a/library/src/scala/collection/immutable/TreeSeqMap.scala b/library/src/scala/collection/immutable/TreeSeqMap.scala index b5420d1ee769..e2d7ba94efcb 100644 --- a/library/src/scala/collection/immutable/TreeSeqMap.scala +++ b/library/src/scala/collection/immutable/TreeSeqMap.scala @@ -427,7 +427,7 @@ object TreeSeqMap extends MapFactory[TreeSeqMap] { // careful handling. override def equals(that : Any): Boolean = that match { case _: this.type => true - case _: Ordering[_] => false // The only empty Orderings are eq Nil + case _: Ordering[?] => false // The only empty Orderings are eq Nil case _ => super.equals(that) } protected def format(sb: StringBuilder, prefix: String, subPrefix: String): Unit = sb ++= s"${prefix}Ø" diff --git a/library/src/scala/collection/immutable/TreeSet.scala b/library/src/scala/collection/immutable/TreeSet.scala index 896c920008b0..4a1e445a3561 100644 --- a/library/src/scala/collection/immutable/TreeSet.scala +++ b/library/src/scala/collection/immutable/TreeSet.scala @@ -281,7 +281,7 @@ object TreeSet extends SortedIterableFactory[TreeSet] { case ts: TreeSet[A] if ts.ordering == ordering => if (tree eq null) tree = ts.tree else tree = RB.union(beforePublish(tree), ts.tree)(using ordering) - case ts: TreeMap[A @unchecked, _] if ts.ordering == ordering => + case ts: TreeMap[A @unchecked, ?] if ts.ordering == ordering => if (tree eq null) tree = ts.tree0 else tree = RB.union(beforePublish(tree), ts.tree0)(using ordering) case _ => diff --git a/library/src/scala/collection/immutable/Vector.scala b/library/src/scala/collection/immutable/Vector.scala index 633922aebedc..6cb975998b2b 100644 --- a/library/src/scala/collection/immutable/Vector.scala +++ b/library/src/scala/collection/immutable/Vector.scala @@ -46,7 +46,7 @@ object Vector extends StrictOptimizedSeqFactory[Vector] { if (knownSize == 0) empty[E] else if (knownSize > 0 && knownSize <= WIDTH) { val a1: Arr1 = it match { - case as: ArraySeq.ofRef[_] if as.elemTag.runtimeClass == classOf[AnyRef] => + case as: ArraySeq.ofRef[?] if as.elemTag.runtimeClass == classOf[AnyRef] => as.unsafeArray.asInstanceOf[Arr1] case it: Iterable[E] => val a1 = new Arr1(knownSize) @@ -235,7 +235,7 @@ sealed abstract class Vector[+A] private[immutable] (private[immutable] final va if (k < tinyAppendLimit) { var v: Vector[B] = this suffix match { - case it: Iterable[_] => it.asInstanceOf[Iterable[B]].foreach(x => v = v.appended(x)) + case it: Iterable[?] => it.asInstanceOf[Iterable[B]].foreach(x => v = v.appended(x)) case _ => suffix.iterator.foreach(x => v = v.appended(x)) } v @@ -370,7 +370,7 @@ private object Vector0 extends BigVector[Nothing](empty1, empty1, 0) { override def equals(o: Any): Boolean = { if(this eq o.asInstanceOf[AnyRef]) true else o match { - case that: Vector[_] => false + case that: Vector[?] => false case o => super.equals(o) } } @@ -1579,12 +1579,12 @@ final class VectorBuilder[A] extends ReusableBuilder[A, Vector[A]] { throw new UnsupportedOperationException("A non-empty VectorBuilder cannot be aligned retrospectively. Please call .reset() or use a new VectorBuilder.") val (prefixLength, maxPrefixLength) = bigVector match { case Vector0 => (0, 1) - case v1: Vector1[_] => (0, 1) - case v2: Vector2[_] => (v2.len1, WIDTH) - case v3: Vector3[_] => (v3.len12, WIDTH2) - case v4: Vector4[_] => (v4.len123, WIDTH3) - case v5: Vector5[_] => (v5.len1234, WIDTH4) - case v6: Vector6[_] => (v6.len12345, WIDTH5) + case v1: Vector1[?] => (0, 1) + case v2: Vector2[?] => (v2.len1, WIDTH) + case v3: Vector3[?] => (v3.len12, WIDTH2) + case v4: Vector4[?] => (v4.len123, WIDTH3) + case v5: Vector5[?] => (v5.len1234, WIDTH4) + case v6: Vector6[?] => (v6.len12345, WIDTH5) } if (maxPrefixLength == 1) return this // does not really make sense to align for <= 32 element-vector val overallPrefixLength = (before + prefixLength) % maxPrefixLength @@ -1821,7 +1821,7 @@ final class VectorBuilder[A] extends ReusableBuilder[A, Vector[A]] { } override def addAll(xs: IterableOnce[A]^): this.type = xs match { - case v: Vector[_] => + case v: Vector[?] => if(len1 == 0 && lenRest == 0 && !prefixIsRightAligned) initFrom(v) else addVector(v.asInstanceOf[Vector[A]]) case _ => @@ -2190,7 +2190,7 @@ private object VectorStatics { } final def prepend1IfSpace(prefix1: Arr1, xs: IterableOnce[?]^): Arr1 | Null = xs match { - case it: Iterable[_] => + case it: Iterable[?] => if(it.sizeCompare(WIDTH-prefix1.length) <= 0) { it.size match { case 0 => null @@ -2215,7 +2215,7 @@ private object VectorStatics { } final def append1IfSpace(suffix1: Arr1, xs: IterableOnce[?]^): Arr1 | Null = xs match { - case it: Iterable[_] => + case it: Iterable[?] => if(it.sizeCompare(WIDTH-suffix1.length) <= 0) { it.size match { case 0 => null diff --git a/library/src/scala/collection/mutable/AnyRefMap.scala b/library/src/scala/collection/mutable/AnyRefMap.scala index dba331258098..cea929bb792e 100644 --- a/library/src/scala/collection/mutable/AnyRefMap.scala +++ b/library/src/scala/collection/mutable/AnyRefMap.scala @@ -582,7 +582,7 @@ object AnyRefMap { * @return a new `AnyRefMap` with the elements of `source` */ def from[K <: AnyRef, V](source: IterableOnce[(K, V)]^): AnyRefMap[K, V] = source match { - case source: AnyRefMap[_, _] => source.clone().asInstanceOf[AnyRefMap[K, V]] + case source: AnyRefMap[?, ?] => source.clone().asInstanceOf[AnyRefMap[K, V]] case _ => buildFromIterableOnce(source) } diff --git a/library/src/scala/collection/mutable/ArrayBuffer.scala b/library/src/scala/collection/mutable/ArrayBuffer.scala index 9877a8c0b5f5..412c30050264 100644 --- a/library/src/scala/collection/mutable/ArrayBuffer.scala +++ b/library/src/scala/collection/mutable/ArrayBuffer.scala @@ -150,7 +150,7 @@ class ArrayBuffer[A] private (initialElements: Array[AnyRef], initialSize: Int) // Overridden to use array copying for efficiency where possible. override def addAll(elems: IterableOnce[A]^): this.type = { elems match { - case elems: ArrayBuffer[_] => + case elems: ArrayBuffer[?] => val elemsLength = elems.size0 if (elemsLength > 0) { mutationCount += 1 diff --git a/library/src/scala/collection/mutable/ArrayBuilder.scala b/library/src/scala/collection/mutable/ArrayBuilder.scala index 1d93a46bf7d9..775914596204 100644 --- a/library/src/scala/collection/mutable/ArrayBuilder.scala +++ b/library/src/scala/collection/mutable/ArrayBuilder.scala @@ -149,7 +149,7 @@ object ArrayBuilder { } override def equals(other: Any): Boolean = other match { - case x: ofRef[_] => (size == x.size) && (elems == x.elems) + case x: ofRef[?] => (size == x.size) && (elems == x.elems) case _ => false } diff --git a/library/src/scala/collection/mutable/ArraySeq.scala b/library/src/scala/collection/mutable/ArraySeq.scala index 33792f1e33e0..731696a55ab1 100644 --- a/library/src/scala/collection/mutable/ArraySeq.scala +++ b/library/src/scala/collection/mutable/ArraySeq.scala @@ -82,7 +82,7 @@ sealed abstract class ArraySeq[T] } override def equals(other: Any): Boolean = other match { - case that: ArraySeq[_] if this.array.length != that.array.length => + case that: ArraySeq[?] if this.array.length != that.array.length => false case _ => super.equals(other) @@ -145,7 +145,7 @@ object ArraySeq extends StrictOptimizedClassTagSeqFactory[ArraySeq] { self => def update(index: Int, elem: T): Unit = { array(index) = elem } override def hashCode() = MurmurHash3.arraySeqHash(array) override def equals(that: Any) = that match { - case that: ofRef[_] => + case that: ofRef[?] => Array.equals( this.array.asInstanceOf[Array[AnyRef]], that.array.asInstanceOf[Array[AnyRef]]) diff --git a/library/src/scala/collection/mutable/LongMap.scala b/library/src/scala/collection/mutable/LongMap.scala index 73f6d1a95f8b..f7c920a79a12 100644 --- a/library/src/scala/collection/mutable/LongMap.scala +++ b/library/src/scala/collection/mutable/LongMap.scala @@ -637,7 +637,7 @@ object LongMap { * @return a new `LongMap` with the elements of `source` */ def from[V](source: IterableOnce[(Long, V)]^): LongMap[V] = source match { - case source: LongMap[_] => source.clone().asInstanceOf[LongMap[V]] + case source: LongMap[?] => source.clone().asInstanceOf[LongMap[V]] case _ => buildFromIterableOnce(source) } diff --git a/library/src/scala/collection/mutable/Map.scala b/library/src/scala/collection/mutable/Map.scala index 6ec68be311e3..b8eadfe456fa 100644 --- a/library/src/scala/collection/mutable/Map.scala +++ b/library/src/scala/collection/mutable/Map.scala @@ -177,7 +177,7 @@ transparent trait MapOps[K, V, +CC[X, Y] <: MapOps[X, Y, CC, ?], +C <: MapOps[K, */ def filterInPlace(p: (K, V) => Boolean): this.type = { if (!isEmpty) this match { - case tm: concurrent.Map[_, _] => tm.asInstanceOf[concurrent.Map[K, V]].filterInPlaceImpl(p) + case tm: concurrent.Map[?, ?] => tm.asInstanceOf[concurrent.Map[K, V]].filterInPlaceImpl(p) case _ => val array = this.toArray[Any] // scala/bug#7269 toArray avoids ConcurrentModificationException val arrayLength = array.length @@ -205,8 +205,8 @@ transparent trait MapOps[K, V, +CC[X, Y] <: MapOps[X, Y, CC, ?], +C <: MapOps[K, */ def mapValuesInPlace(f: (K, V) => V): this.type = { if (!isEmpty) this match { - case hm: mutable.HashMap[_, _] => hm.asInstanceOf[mutable.HashMap[K, V]].mapValuesInPlaceImpl(f) - case tm: concurrent.Map[_, _] => tm.asInstanceOf[concurrent.Map[K, V]].mapValuesInPlaceImpl(f) + case hm: mutable.HashMap[?, ?] => hm.asInstanceOf[mutable.HashMap[K, V]].mapValuesInPlaceImpl(f) + case tm: concurrent.Map[?, ?] => tm.asInstanceOf[concurrent.Map[K, V]].mapValuesInPlaceImpl(f) case _ => val array = this.toArray[Any] val arrayLength = array.length diff --git a/library/src/scala/concurrent/impl/Promise.scala b/library/src/scala/concurrent/impl/Promise.scala index 6cb0f340a5c3..9afa9e713309 100644 --- a/library/src/scala/concurrent/impl/Promise.scala +++ b/library/src/scala/concurrent/impl/Promise.scala @@ -146,7 +146,7 @@ private[concurrent] object Promise { val zipped = new DefaultPromise[R]() val thisF: Try[T] => Unit = { - case left: Success[_] => + case left: Success[?] => val right = buffer.getAndSet(left).asInstanceOf[Success[U]] if (right ne null) zipped.tryComplete(try Success(f(left.get, right.get)) catch { case e if NonFatal(e) => Failure(e) }) @@ -155,7 +155,7 @@ private[concurrent] object Promise { } val thatF: Try[U] => Unit = { - case right: Success[_] => + case right: Success[?] => val left = buffer.getAndSet(right).asInstanceOf[Success[T]] if (left ne null) zipped.tryComplete(try Success(f(left.get, right.get)) catch { case e if NonFatal(e) => Failure(e) }) diff --git a/library/src/scala/math/Equiv.scala b/library/src/scala/math/Equiv.scala index 39118b2a88ec..71179cd57777 100644 --- a/library/src/scala/math/Equiv.scala +++ b/library/src/scala/math/Equiv.scala @@ -88,7 +88,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: IterableEquiv[_, _] => this.eqv == that.eqv + case that: IterableEquiv[?, ?] => this.eqv == that.eqv case _ => false } override def hashCode(): Int = eqv.hashCode() * iterableSeed @@ -257,7 +257,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: OptionEquiv[_] => this.eqv == that.eqv + case that: OptionEquiv[?] => this.eqv == that.eqv case _ => false } override def hashCode(): Int = eqv.hashCode() * optionSeed @@ -274,7 +274,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple2Equiv[_, _] => + case that: Tuple2Equiv[?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 case _ => false @@ -295,7 +295,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple3Equiv[_, _, _] => + case that: Tuple3Equiv[?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 @@ -320,7 +320,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple4Equiv[_, _, _, _] => + case that: Tuple4Equiv[?, ?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 && @@ -348,7 +348,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple5Equiv[_, _, _, _, _] => + case that: Tuple5Equiv[?, ?, ?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 && @@ -379,7 +379,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple6Equiv[_, _, _, _, _, _] => + case that: Tuple6Equiv[?, ?, ?, ?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 && @@ -413,7 +413,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple7Equiv[_, _, _, _, _, _, _] => + case that: Tuple7Equiv[?, ?, ?, ?, ?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 && @@ -450,7 +450,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple8Equiv[_, _, _, _, _, _, _, _] => + case that: Tuple8Equiv[?, ?, ?, ?, ?, ?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 && @@ -490,7 +490,7 @@ object Equiv extends LowPriorityEquiv { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple9Equiv[_, _, _, _, _, _, _, _, _] => + case that: Tuple9Equiv[?, ?, ?, ?, ?, ?, ?, ?, ?] => this.eqv1 == that.eqv1 && this.eqv2 == that.eqv2 && this.eqv3 == that.eqv3 && diff --git a/library/src/scala/math/Ordering.scala b/library/src/scala/math/Ordering.scala index 3d779fc796f3..68e756873f6f 100644 --- a/library/src/scala/math/Ordering.scala +++ b/library/src/scala/math/Ordering.scala @@ -127,7 +127,7 @@ trait Ordering[T] extends Comparator[T] with PartialOrdering[T] with Serializabl * [[reverse]] as well. */ def isReverseOf(other: Ordering[?]): Boolean = other match { - case that: Ordering.Reverse[_] => that.outer == this + case that: Ordering.Reverse[?] => that.outer == this case _ => false } @@ -260,7 +260,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Reverse[_] => this.outer == that.outer + case that: Reverse[?] => this.outer == that.outer case _ => false } override def hashCode(): Int = outer.hashCode() * reverseSeed @@ -282,7 +282,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: IterableOrdering[_, _] => this.ord == that.ord + case that: IterableOrdering[?, ?] => this.ord == that.ord case _ => false } override def hashCode(): Int = ord.hashCode() * iterableSeed @@ -613,7 +613,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: OptionOrdering[_] => this.optionOrdering == that.optionOrdering + case that: OptionOrdering[?] => this.optionOrdering == that.optionOrdering case _ => false } override def hashCode(): Int = optionOrdering.hashCode() * optionSeed @@ -648,7 +648,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple2Ordering[_, _] => + case that: Tuple2Ordering[?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 case _ => false @@ -673,7 +673,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple3Ordering[_, _, _] => + case that: Tuple3Ordering[?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 @@ -703,7 +703,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple4Ordering[_, _, _, _] => + case that: Tuple4Ordering[?, ?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 && @@ -737,7 +737,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple5Ordering[_, _, _, _, _] => + case that: Tuple5Ordering[?, ?, ?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 && @@ -775,7 +775,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple6Ordering[_, _, _, _, _, _] => + case that: Tuple6Ordering[?, ?, ?, ?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 && @@ -817,7 +817,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple7Ordering[_, _, _, _, _, _, _] => + case that: Tuple7Ordering[?, ?, ?, ?, ?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 && @@ -863,7 +863,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple8Ordering[_, _, _, _, _, _, _, _] => + case that: Tuple8Ordering[?, ?, ?, ?, ?, ?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 && @@ -913,7 +913,7 @@ object Ordering extends LowPriorityOrderingImplicits { override def equals(obj: scala.Any): Boolean = obj match { case that: AnyRef if this eq that => true - case that: Tuple9Ordering[_, _, _, _, _, _, _, _, _] => + case that: Tuple9Ordering[?, ?, ?, ?, ?, ?, ?, ?, ?] => this.ord1 == that.ord1 && this.ord2 == that.ord2 && this.ord3 == that.ord3 && diff --git a/library/src/scala/reflect/ClassManifestDeprecatedApis.scala b/library/src/scala/reflect/ClassManifestDeprecatedApis.scala index 5fe52e7b4ba1..48f64b74ecd0 100644 --- a/library/src/scala/reflect/ClassManifestDeprecatedApis.scala +++ b/library/src/scala/reflect/ClassManifestDeprecatedApis.scala @@ -44,7 +44,7 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] { private def subargs(args1: List[OptManifest[?]], args2: List[OptManifest[?]]) = (args1 corresponds args2) { // !!! [Martin] this is wrong, need to take variance into account - case (x: ClassManifest[_], y: ClassManifest[_]) => x <:< y + case (x: ClassManifest[?], y: ClassManifest[?]) => x <:< y case (x, y) => (x eq NoManifest) && (y eq NoManifest) } @@ -91,7 +91,7 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] { that <:< this override def canEqual(other: Any) = other match { - case _: ClassManifest[_] => true + case _: ClassManifest[?] => true case _ => false } @@ -209,7 +209,7 @@ object ClassManifestFactory { def arrayType[T](arg: OptManifest[?]): ClassManifest[Array[T]] = (arg: @unchecked) match { case NoManifest => Object.asInstanceOf[ClassManifest[Array[T]]] - case m: ClassManifest[_] => m.asInstanceOf[ClassManifest[T]].arrayManifest + case m: ClassManifest[?] => m.asInstanceOf[ClassManifest[T]].arrayManifest } @SerialVersionUID(1L) diff --git a/library/src/scala/reflect/Manifest.scala b/library/src/scala/reflect/Manifest.scala index b1a23c8e4af0..2af957e6d886 100644 --- a/library/src/scala/reflect/Manifest.scala +++ b/library/src/scala/reflect/Manifest.scala @@ -55,14 +55,14 @@ trait Manifest[T] extends ClassManifest[T] with Equals { Manifest.classType[Array[T]](arrayClass[T](runtimeClass), this) override def canEqual(that: Any): Boolean = that match { - case _: Manifest[_] => true + case _: Manifest[?] => true case _ => false } /** Note: testing for erasure here is important, as it is many times * faster than <:< and rules out most comparisons. */ override def equals(that: Any): Boolean = that match { - case m: Manifest[_] => (m canEqual this) && (this.runtimeClass == m.runtimeClass) && (this <:< m) && (m <:< this) + case m: Manifest[?] => (m canEqual this) && (this.runtimeClass == m.runtimeClass) && (this <:< m) && (m <:< this) case _ => false } override def hashCode() = this.runtimeClass.## @@ -152,7 +152,7 @@ abstract class AnyValManifest[T <: AnyVal](override val toString: String) extend override def <:<(that: ClassManifest[?]): Boolean = (that eq this) || (that eq Manifest.Any) || (that eq Manifest.AnyVal) override def canEqual(other: Any) = other match { - case _: AnyValManifest[_] => true + case _: AnyValManifest[?] => true case _ => false } override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef] diff --git a/library/src/scala/runtime/ScalaRunTime.scala b/library/src/scala/runtime/ScalaRunTime.scala index 534c2fa0ae42..9969ebf10b4e 100644 --- a/library/src/scala/runtime/ScalaRunTime.scala +++ b/library/src/scala/runtime/ScalaRunTime.scala @@ -217,19 +217,19 @@ object ScalaRunTime { // When doing our own iteration is dangerous def useOwnToString(x: Any) = x match { // Range/NumericRange have a custom toString to avoid walking a gazillion elements - case _: Range | _: NumericRange[_] => true + case _: Range | _: NumericRange[?] => true // Sorted collections to the wrong thing (for us) on iteration - ticket #3493 - case _: SortedOps[_, _] => true + case _: SortedOps[?, ?] => true // StringBuilder(a, b, c) and similar not so attractive case _: StringView | _: StringOps | _: StringBuilder => true // Don't want to evaluate any elements in a view - case _: View[_] => true + case _: View[?] => true // Node extends NodeSeq extends Seq[Node] and MetaData extends Iterable[MetaData] // -> catch those by isXmlNode and isXmlMetaData. // Don't want to a) traverse infinity or b) be overly helpful with peoples' custom // collections which may have useful toString methods - ticket #3710 // or c) print AbstractFiles which are somehow also Iterable[AbstractFile]s. - case x: Iterable[_] => (!x.isInstanceOf[StrictOptimizedIterableOps[?, AnyConstr, ?]]) || !isScalaClass(x) || isScalaCompilerClass(x) || isXmlNode(x.getClass) || isXmlMetaData(x.getClass) + case x: Iterable[?] => (!x.isInstanceOf[StrictOptimizedIterableOps[?, AnyConstr, ?]]) || !isScalaClass(x) || isScalaCompilerClass(x) || isXmlNode(x.getClass) || isXmlMetaData(x.getClass) // Otherwise, nothing could possibly go wrong case _ => false } @@ -258,9 +258,9 @@ object ScalaRunTime { case x: String => if (x.head.isWhitespace || x.last.isWhitespace) "\"" + x + "\"" else x case x if useOwnToString(x) => x.toString case x: AnyRef if isArray(x) => arrayToString(x) - case x: scala.collection.Map[_, _] => x.iterator.take(maxElements).map(mapInner).mkString(x.collectionClassName + "(", ", ", ")") - case x: Iterable[_] => x.iterator.take(maxElements).map(inner).mkString(x.collectionClassName + "(", ", ", ")") - case x: Product1[_] if isTuple(x) => "(" + inner(x._1) + ",)" // that special trailing comma + case x: scala.collection.Map[?, ?] => x.iterator.take(maxElements).map(mapInner).mkString(x.collectionClassName + "(", ", ", ")") + case x: Iterable[?] => x.iterator.take(maxElements).map(inner).mkString(x.collectionClassName + "(", ", ", ")") + case x: Product1[?] if isTuple(x) => "(" + inner(x._1) + ",)" // that special trailing comma case x: Product if isTuple(x) => x.productIterator.map(inner).mkString("(", ",", ")") case x => x.toString } diff --git a/library/src/scala/util/hashing/MurmurHash3.scala b/library/src/scala/util/hashing/MurmurHash3.scala index c9efde2cbb81..b8853ccef706 100644 --- a/library/src/scala/util/hashing/MurmurHash3.scala +++ b/library/src/scala/util/hashing/MurmurHash3.scala @@ -403,8 +403,8 @@ object MurmurHash3 extends MurmurHash3 { /** To offer some potential for optimization. */ def seqHash(xs: scala.collection.Seq[?]): Int = xs match { - case xs: scala.collection.IndexedSeq[_] => indexedSeqHash(xs, seqSeed) - case xs: List[_] => listHash(xs, seqSeed) + case xs: scala.collection.IndexedSeq[?] => indexedSeqHash(xs, seqSeed) + case xs: List[?] => listHash(xs, seqSeed) case xs => orderedHash(xs, seqSeed) }