mardi 19 juillet 2016

What's the easiest way to convert a Scala reflection MethodSymbol/MethodSignature to a Java Method?

Scala reflection is designed for both compilation time and run time. So it can identify polymorphic method more effectively than Java (see my previous post In Scala Reflection, How to get generic type parameter of a concrete subclass?), which suffers from type erasure.

However, this method can only be invoked using Scala reflection's mirror, which is slightly slower than its java counterpart, I would like to know if there is an easy way to convert Scala MethodSymbol, which is returned directly by Type.members, or MethodSignature, which is returned by Type.member.SignatureIn(Type) to a Java method that can be directly invoked through Java reflection API.

Is it possible?





Aucun commentaire:

Enregistrer un commentaire