Scala Programming Language
  1. Scala Programming Language
  2. SI-7453

Array[Null] and Array[Nothing] should be disallowed

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.12.0-M1
    • Component/s: Collections, Type Checker
    • Labels:
      None

      Description

      See the discussion of https://issues.scala-lang.org/browse/SI-5353 for motivation.

        Activity

        Hide
        Jason Zaugg added a comment -

        From SI-8487

        scala> if (false) Array("") else Array.empty
         
        java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
        
        Show
        Jason Zaugg added a comment - From SI-8487 scala> if (false) Array("") else Array.empty java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
        Hide
        杨博 added a comment -
        scala> Array.empty[Nothing]: Array[_ <: String]
        java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
        
        Show
        杨博 added a comment - scala> Array.empty[Nothing]: Array[_ <: String] java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;

          People

          • Assignee:
            Unassigned
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development