为什么我会使用以下 Scala Swing 代码收到关于类型擦除的模式匹配器警告:
import scala.swing._
object Test extends ListView(Seq(1, 2, 3)) {
listenTo(selection)
reactions += {
case event.ListSelectionChanged(_, range, _) => println(range)
}
}
警告是:
warning: non variable type-argument A in type pattern
scala.swing.event.ListSelectionChanged[A] is unchecked
since it is eliminated by erasure
case event.ListSelectionChanged(_, range, _) => println(range)
^
这只是 Scala Swing 的可怕设计,还是我做错了什么?