javidz wrote:
There is a private object in a closed-source class that I need to get
access to.
Is there any tips or tricks to accomplish that?
First of all you should contact the autor of the code. He/She has a
reason to make that private, and should provide a way for you to use
that object if it is suposed to be like that. Maybe he/she could
provide you either a way or a patch.
Still as some1 said you could work with java.lang.reflect, I had
something similar to this. But it was my code, and I still wanted to
let them as private fields. What i did was making my second class be in
the same package, and that let me use reflection a little, and i manage
to acomplish what i wanted. I don't know what you need so i can't give
more details.
BUT remenber the 1st thing you should do is find a "proper way", use
reflection as your last resource, since it's real purpose is to create
objects in runtime from which you don't know the type in compile time.