debugging - Java: how to get arguments passed to method that called this method? -
in java, possible class , method called current method (the method in stacktrace).
my question is, can arguments passed method called method?
i need debugging purposes.
eg:
baseclass { initialfunc(input) { var modifiedinput = input + " modified you"; otherclass.dosomething(modifiedinput); } } otherclass { dosomething(input) { //get arguments passed method of class called method } }
can 1 information stacktrace, or there other means?
(note need able in runtime , cannot change source of baseclass, going feature of debugging class not know source beforehand)
thanks.
i don't believe possible using standard java api.
what use aspectj, place point-cut @ calling method, save arguments, place point-cut @ called method , pass on arguments.
another option (slightly more advanced) use custom, bytecode-rewriting, class loader saves original arguments, , passes them on arguments next method. take day or 2 implement. suitable frameworks bcel or asm.
Comments
Post a Comment