erasurehas a type java.lang.Class, so you can use constructors (in any case, you do not need a manifest in this simple case - you can just use it classOf[C]). Instead of calling directly, newinstanceyou can first find the correspondence constructor using the method getConstructor(with the corresponding argument types), and then simply call newinstanceon it:
classOf[C].getConstructor(classOf[String]).newInstance("string")
source
share