0

How/am I able, using introspection or reflection get the parameters a method 1 level up in the call stack and it's values ?

Maxim Veksler
  • 29,272
  • 38
  • 131
  • 151
  • possible duplicate of http://stackoverflow.com/questions/1359044/getting-local-variables-from-a-stack-frame-on-the-jvm – finnw Apr 21 '10 at 09:30
  • Linked question does not discuss parameter values, I think both questions could be merged. – Maxim Veksler Apr 21 '10 at 10:26

1 Answers1

2

Only through the debugging interface, not from within the Java code.

Why do you want to do that anyway? As part of productive code, it would violate all kinds of design principles.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720
  • Or my case: injection of logging code for gathering performance statistics in format method+arguments:performance. – setec Jul 08 '11 at 14:33
  • @setec: That's exactly what AOP is meant for; doesn't even require calling a "logging method" from the method to be benchmarked, which I suppose is what you're trying to do. – Michael Borgwardt Jul 09 '11 at 09:26