What I am trying to do is to make a function that would take a generic class and use a static method in it (sorry for Java language, I mean method of its companion object).<
Based on the answer by Miquel, here's a method that gets the type reference of the companion object of the specified class object:
/**
* Returns the companion object type reference for the specified class
*
* @param clazz The class whose companion is required
* @tparam CT Type of the companion object
* @return The type of the relevant companion object
*/
def companionOf[CT](clazz: Class[_]): CT = {
import scala.reflect.runtime.{currentMirror => cm}
Try[CT] {
val companionModule = cm.classSymbol(clazz).companion.asModule
cm.reflectModule(companionModule).instance.asInstanceOf[CT]
}.getOrElse(throw new RuntimeException(s"Could not get companion object for $clazz"))
}