There is a library that calls my method with several arguments. I would like to get another argument, but the library does not provide it to the method that it calls.
By decompiling the library, I see that it has an argument and is assigned to the instance variable (not private, but not public). I know that I can get a variable using reflection if I have an instance, but I don't have an instance either.
Is there any way to get an instance? SecurityManager has getClassContext () , but it just gives me an instance class - I want the instance itself.
As a quick example of what I want:
public class A { int b; public A(int b, int c) { this.b = b; D(c); } } public class D { public D(int c) {
Alternatively ... I know that b used as an argument in callstack. Therefore, if someone knows how I could access b , which was passed to constructor A , that would be acceptable.
If none of them is feasible ... I can decompile A and compile it the way I want, and then I will either need to do some skill in loading classes, or I will have to modify the contents of the jar, None of these sounds is not desirable, so I hope someone knows how to access instance A or argument b from the call stack.
source share