가능한 중복은 :스칼라 유형 삭제?
scala> var s = new Stack()push(1) s: scalatest.Stack[Int] = 1 scala> s match { case s : Stack[String] => print("Hello")} <console>:12: warning: non variable type-argument String in type pattern scalatest.Stack[String] is unchecked since it is eliminated by erasure s match { case s : Stack[String] => print("Hello") }
스택 http://www.scala-lang.org/node/129에서 가져온 클래스 :
How do I get around type erasure on Scala? Or, why can't I get the type parameter of my collections?
-unchecked
플래그없이이 코드를 실행하면 "Hello"가 인쇄됩니다. 왜 그런 경우입니까?
컴파일러에서 문제가 있음을 알리고 그게 무엇입니까? 왜 여기서 물어 보는거야? –