I'm trying to convert a project over to scala 2.8 from 2.7 and I've run into some difficulty in the code that interacts with Java. Below is a slightly convoluted piece of sample code displaying the problem. Essentially I have class with a member variable of type mutable.Map[K,V]
and I can't find a way to pass that through to a method that expects a java.util.Map[K,V]
. Any help would be great.
scala> import scala.collection.JavaConversions._
import scala.collection.JavaConversions._
scala> class A[K,V](m : collection.mutable.Map[K,V]) {
| def asJava : java.util.Map[K,V] = m
| }
<console>:9: error: could not find implicit value for parameter ma: scala.reflect.ClassManifest[K]
def asJava : java.util.Map[K,V] = m