I am running a huge scala program but I am only interested in a small portion of it. I want to now the primitive variable with known value that has been used.
For example, lazy val func = (x: String, y=Int) => println(s“Hello $x, you are $y year(s)old”)
(Somewhere in the code, the function is called. But at this point “name” and “age” are not yet known. The func() will not be evaluated) func(name, age)
At certain point in runtime, the “name”and “age” will eventually got a value, say “John” and “16”. Then the func(name, age) will be evaluated to “Hello John, you are 16 year(s) old”. I want to get down to the bottom that what primitive type variables have been accessed to eventually got func(x, y) evaluated. (Well, the String may not be exactly primitive type. But you got the idea)
While code coverage tool may have some help, it will not give me exactly what I want. I know I may have to use the runtime reflection to achieve my goal but have no idea exactly how. Any help will be appreciated.
Aucun commentaire:
Enregistrer un commentaire