I'm writing a custom JUnit runner that will have to collect some metadata for the test case under execution. At execution time, we access the test case object via reflection getting a Class object. This runner will be used in Scala, Java, and Kotlin test suites. How do I find which was the source code language that gave origin to a given Class object?
1
votes
1 Answers
3
votes
For Scala, you can check if the class is annotated with scala.reflect.ScalaSignature or scala.reflect.ScalaLongSignature. Kotlin uses kotlin.Metadata for the same.
javap. - Joop Eggen