How can we check value of variable defined and used in some method. One way is to print that value, but I want to do it programmatically without modifying original code(which actually is third party java library so I shouldn't)
Why not IDE debugger, Why I want it : I am trying to write a test program which can check and compare certain variables at runtime for 2 versions of API. Whenever new version of particular java API(in some cases I am writing that API) is released I would like to run this program to test recent API changes are not impacting more than desired variables. I can write junit test cases to test all input output combinations, but after checking variable values this test program will be able to tell where exactly we have problem in code.
Can java agent give me that information, if yes a sample code would be great. I tried to search java agent related articles but couldn't find specific for my use case. Most of the articles talk about how to write it at basic level.