I was tring to use getDatasID
from Factory.java
in test.scala
.
//Factory.java
class Factory {
...
public <K, V, T extends Datas<K, V>> DatasID<T> getDatasID(Class <T> dataClass) ...
}
// C.java
public class C extends Datas<Key, Value> { ... }
I used two class in scala to run getDatasID
//Test.scala
abstract class A[K, V, T[K, V] <: Datas[K, V]]
abstract class B extends Datas[Key, Value]
val targetA = new Factory()
.getDatasID(
classOf[A
[Key, Value, ({type T[K, V]=Datas[Key, Value})#T]
])
val targetB = new Factory()
.getDatasID(classOf[B])
Both class showed same error.
- inferred type arguments
[Nothing, Nothing A[Key, Value, [K, V]Datas[Key, Value]]]
do not conform ...[K,V,T <: Datas[K,V]]
type mismatch
- found:
class[A[Key, Value, [K,V]Datas[Key, Value]]](classOf[A])
- required:
Class[T]
- found:
I would like to match class[Key, Value, Datas[Key, Value]]. The best case will be
val targetB = new Factory()
.getDatasID(classOf[B])
Above code works.