How can I pass a parameter to a Java method with a raw type in its method signature? My example API is as follows:
class P<T> {}
class Q {
public void f(P p[]) {}
}
And my attempt to call it from Scala looks like this:
val q = new Q()
val p = new P()
val p_array = Array(p)
q.f(p_array)
Which generates the following compiler error:
type mismatch;
found : Array[P[Nothing]]
required: Array[P[_]]
q.f(p_array)
Parameterizing p as type P[Any] doesn't help either. I'm using 2.8 RC6.
By way of background, the API which has caused me this problem is something called org.teleal.cling.model.meta.LocalDevice The constructor looks like it takes a parameterized argument 'deviceServices'. However, the type parameter 'LocalService' also takes a parameter, not supplied, resulting in the awkward method signature.