I’m trying to do something like this:
import scala.swing
class componentMapper {
val map = Map[Class[_], Componenet]()
def apply(c: Class[_], component: Component) = map += (c -> componenet)
}
class Render extends ComponentMapper {
def getRenderer(value: AnyRef) = map(value.getClass)
}
This doesn’t seem to work. What type parameter should I be using for Class?
I’m not entirely sure what the core problem is, but it’s not the type parameter for class. It appears to be some weird type inference issue with “->”. The following compiles and works just fine.
Note that I had to make many small corrections to your code to even find what problem you were talking about.
I’ve filed a ticket in case in hopes that it’s something fixable: https://lampsvn.epfl.ch/trac/scala/ticket/1974.