0

Is there a way to find a method by it's bytecode name?

For example, I would like to find a reference to println(Object) by string "_root_.scala.Predef.println(Ljava/lang/Object;)V."

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
  • I'm curious how you got into this situation (of needing or wanting to do this). – Seth Tisue Jul 11 '17 at 16:26
  • @SethTisue, I am working with **both** scalameta semantic api and scala-reflect and I'm currently in a situation where I have a `scala.meta.Symbol`, but want to call a scala-reflect API with it. I didn't find any straightforward way to convert `scala.meta.Symbol` to something what scala-reflect can understand easily. That is why I'm asking this. – Daniyar Itegulov Jul 11 '17 at 17:17

1 Answers1

1

There is no direct way to do it.

You have to parse string to extract class name. Load class by name and iterate thru its method to find required method.

talex
  • 17,973
  • 3
  • 29
  • 66