Search code examples
swingscalapattern-matchingtype-erasure

Type erasure in swing.event.ListSelectionChanged


Why do I get a pattern matcher warning regarding type erasure with the following Scala Swing code:

import scala.swing._

object Test extends ListView(Seq(1, 2, 3)) {
  listenTo(selection)
  reactions += {
    case event.ListSelectionChanged(_, range, _) => println(range)
  }
}

The warning is:

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)
                                            ^

Is this just horrible design of Scala Swing, or am I doing something wrong?


Solution

  • This issue has disappeared with the new Scala 2.10 pattern matcher.