@@ -122,7 +122,7 @@ object Predef extends LowPriorityImplicits {
122122 * @return The runtime [[Class ]] representation of type `T`.
123123 * @group utilities
124124 */
125- def classOf [T ]: Class [T ] = null // This is a stub method. The actual implementation is filled in by the compiler.
125+ def classOf [T ]: Class [T ] = null . asInstanceOf [ Class [ T ]] // This is a stub method. The actual implementation is filled in by the compiler.
126126
127127 /**
128128 * Retrieve the single value of a type with a unique inhabitant.
@@ -286,12 +286,12 @@ object Predef extends LowPriorityImplicits {
286286 to be available at runtime.
287287 To achieve this, we keep the Scala 3 signature publicly available.
288288 We rely on the fact that it is `inline` and will not be visible in the bytecode.
289- To add the required Scala 2 ones, we define the `scala2Assert`, we use:
290- - `@targetName` to swap the name in the generated code to `assert`
289+ To add the required Scala 2 ones, we define the `scala2Assert`, we use:
290+ - `@targetName` to swap the name in the generated code to `assert`
291291 - `@publicInBinary` to make it available during runtime.
292292 As such, we would successfully hijack the definitions of `assert` such as:
293293 - At compile time, we would have the definitions of `assert`
294- - At runtime, the definitions of `scala2Assert` as `assert`
294+ - At runtime, the definitions of `scala2Assert` as `assert`
295295 NOTE: Tasty-Reader in Scala 2 will have to learn about this swapping if we are to
296296 allow loading the full Scala 3 library by it.
297297 */
@@ -426,7 +426,7 @@ object Predef extends LowPriorityImplicits {
426426 @ inline def formatted (fmtstr : String ): String = fmtstr format self
427427 }
428428
429- /** Injects String concatenation operator `+` to any classes.
429+ /** Injects String concatenation operator `+` to any classes.
430430 * @group implicit-classes-any
431431 */
432432 @ (deprecated @ companionMethod)(" Implicit injection of + is deprecated. Convert to String to call +" , " 2.13.0" )
@@ -658,46 +658,46 @@ private[scala] abstract class LowPriorityImplicits extends LowPriorityImplicits2
658658 @ inline implicit def booleanWrapper (x : Boolean ): runtime.RichBoolean = new runtime.RichBoolean (x)
659659
660660 /** @group conversions-array-to-wrapped-array */
661- implicit def genericWrapArray [T ](xs : Array [T ]): ArraySeq [T ] =
661+ implicit def genericWrapArray [T ](xs : Array [T ] | Null ): ArraySeq [T ] | Null =
662662 if (xs eq null ) null
663663 else ArraySeq .make(xs)
664664
665665 // Since the JVM thinks arrays are covariant, one 0-length Array[AnyRef]
666666 // is as good as another for all T <: AnyRef. Instead of creating 100,000,000
667667 // unique ones by way of this implicit, let's share one.
668668 /** @group conversions-array-to-wrapped-array */
669- implicit def wrapRefArray [T <: AnyRef ](xs : Array [T ]): ArraySeq .ofRef[T ] = {
669+ implicit def wrapRefArray [T <: AnyRef ](xs : Array [T ] | Null ): ArraySeq .ofRef[T ] | Null = {
670670 if (xs eq null ) null
671671 else if (xs.length == 0 ) ArraySeq .empty[AnyRef ].asInstanceOf [ArraySeq .ofRef[T ]]
672672 else new ArraySeq .ofRef[T ](xs)
673673 }
674674
675675 /** @group conversions-array-to-wrapped-array */
676- implicit def wrapIntArray (xs : Array [Int ]): ArraySeq .ofInt = if (xs ne null ) new ArraySeq .ofInt(xs) else null
676+ implicit def wrapIntArray (xs : Array [Int ] | Null ): ArraySeq .ofInt | Null = if (xs ne null ) new ArraySeq .ofInt(xs) else null
677677 /** @group conversions-array-to-wrapped-array */
678- implicit def wrapDoubleArray (xs : Array [Double ]): ArraySeq .ofDouble = if (xs ne null ) new ArraySeq .ofDouble(xs) else null
678+ implicit def wrapDoubleArray (xs : Array [Double ] | Null ): ArraySeq .ofDouble | Null = if (xs ne null ) new ArraySeq .ofDouble(xs) else null
679679 /** @group conversions-array-to-wrapped-array */
680- implicit def wrapLongArray (xs : Array [Long ]): ArraySeq .ofLong = if (xs ne null ) new ArraySeq .ofLong(xs) else null
680+ implicit def wrapLongArray (xs : Array [Long ] | Null ): ArraySeq .ofLong | Null = if (xs ne null ) new ArraySeq .ofLong(xs) else null
681681 /** @group conversions-array-to-wrapped-array */
682- implicit def wrapFloatArray (xs : Array [Float ]): ArraySeq .ofFloat = if (xs ne null ) new ArraySeq .ofFloat(xs) else null
682+ implicit def wrapFloatArray (xs : Array [Float ] | Null ): ArraySeq .ofFloat | Null = if (xs ne null ) new ArraySeq .ofFloat(xs) else null
683683 /** @group conversions-array-to-wrapped-array */
684- implicit def wrapCharArray (xs : Array [Char ]): ArraySeq .ofChar = if (xs ne null ) new ArraySeq .ofChar(xs) else null
684+ implicit def wrapCharArray (xs : Array [Char ] | Null ): ArraySeq .ofChar | Null = if (xs ne null ) new ArraySeq .ofChar(xs) else null
685685 /** @group conversions-array-to-wrapped-array */
686- implicit def wrapByteArray (xs : Array [Byte ]): ArraySeq .ofByte = if (xs ne null ) new ArraySeq .ofByte(xs) else null
686+ implicit def wrapByteArray (xs : Array [Byte ] | Null ): ArraySeq .ofByte | Null = if (xs ne null ) new ArraySeq .ofByte(xs) else null
687687 /** @group conversions-array-to-wrapped-array */
688- implicit def wrapShortArray (xs : Array [Short ]): ArraySeq .ofShort = if (xs ne null ) new ArraySeq .ofShort(xs) else null
688+ implicit def wrapShortArray (xs : Array [Short ] | Null ): ArraySeq .ofShort | Null = if (xs ne null ) new ArraySeq .ofShort(xs) else null
689689 /** @group conversions-array-to-wrapped-array */
690- implicit def wrapBooleanArray (xs : Array [Boolean ]): ArraySeq .ofBoolean = if (xs ne null ) new ArraySeq .ofBoolean(xs) else null
690+ implicit def wrapBooleanArray (xs : Array [Boolean ] | Null ): ArraySeq .ofBoolean | Null = if (xs ne null ) new ArraySeq .ofBoolean(xs) else null
691691 /** @group conversions-array-to-wrapped-array */
692- implicit def wrapUnitArray (xs : Array [Unit ]): ArraySeq .ofUnit = if (xs ne null ) new ArraySeq .ofUnit(xs) else null
692+ implicit def wrapUnitArray (xs : Array [Unit ] | Null ): ArraySeq .ofUnit | Null = if (xs ne null ) new ArraySeq .ofUnit(xs) else null
693693
694694 /** @group conversions-string */
695- implicit def wrapString (s : String ): WrappedString = if (s ne null ) new WrappedString (s) else null
695+ implicit def wrapString (s : String | Null ): WrappedString | Null = if (s ne null ) new WrappedString (s) else null
696696}
697697
698698private [scala] abstract class LowPriorityImplicits2 {
699699 @ deprecated(" implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray" , since= " 2.13.0" )
700- implicit def copyArrayToImmutableIndexedSeq [T ](xs : Array [T ]): IndexedSeq [T ] =
700+ implicit def copyArrayToImmutableIndexedSeq [T ](xs : Array [T ] | Null ): IndexedSeq [T ] | Null =
701701 if (xs eq null ) null
702702 else new ArrayOps (xs).toIndexedSeq
703703}
0 commit comments