I am trying to call a method:
def doSomething[A <: Super : ClassTag] : B = { ... }
The method only takes a type parameter.
I have an AnyRef
object and I've recovered its class at runtime. I know that the class of the object is a subclass of Super
and I want to call doSomething
.
Is there a way to call doSomething
with the object's class as the parameter? Can I assert to the compiler that the class I recover at runtime is a subclass of Super
?
I am not concerned about this failing at runtime in the case where my object is not a subclass of Super
for some reason.
Aucun commentaire:
Enregistrer un commentaire