Is there a way to recognise scala classes in Java refection?

Hi,
I’ve been involved in maintaining jackson-module-scala for a few months. It uses Java reflection for historic reasons and rewriting it to use Scala reflection would take a fair amount of effort.
There are issues where jackson-module-scala interferes with Java classes because it is registered in the ObjectMapper and it would be great if it was possible to get the scala module to ignore Java classes (and just affect scala-compiled classes).
Would anyone have any suggestions as to how this could achieved?

Thanks,
PJ

I think that all Scala classes should be annotated with a ScalaSignature or ScalaLongSignature annotation.

Thanks Jasper. I’ll try that.

scala.reflect.runtime.universe.Symbol has method isJava.

typeOf[Object].typeSymbol.isJava // true
typeOf[Any].typeSymbol.isJava // false
1 Like