I want to do something line by line (note that I know this does not work, but my question is whether it can be made to work):
object O {
def main(args: Array[String]) {
val clazzname = classOf[System].getName
val c = Class.forName(clazzname).asInstanceOf[{def currentTimeMillis: Long}]
c.currentTimeMillis
}
}
Is it possible? (without using reflection)
The real use case is for reading serialized protobuf messages.
source
share