Is it possible for me to get the class file of dynamically generated proxy class?

B

billdavidcn

I come to the proxy class when I am debugging my application, but I
can't get into it. Is is possible for me to get the class file of
dynamically generated proxy class so that I can decompile and dig into
it?

In my memory, we can write any class in classpath into a file. But I
forget how to do it.
 
D

Daniel Pitts

I come to the proxy class when I am debugging my application, but I
can't get into it. Is is possible for me to get the class file of
dynamically generated proxy class so that I can decompile and dig into
it?

In my memory, we can write any class in classpath into a file. But I
forget how to do it.

Proxy classes are generated at runtime, and there really isn't much to
know about them. They intercept all calls, and pass it to the
InvocationHandler to handle. If your proxy class ultimately delegates
to another class, then set a breakpoint inside that other class. If
you are trying to debug what happens after the call, before the
delegation, then set a breakpoint inside the InvocationHandler.
 
T

Twisted

Proxy classes are generated at runtime, and there really isn't much to
know about them. They intercept all calls, and pass it to the
InvocationHandler to handle. If your proxy class ultimately delegates
to another class, then set a breakpoint inside that other class. If
you are trying to debug what happens after the call, before the
delegation, then set a breakpoint inside the InvocationHandler.

If you can get ahold of an instance programmatically, you can use
getClass(), and then seriously reflective stuff (probably starting
with getting the ClassLoader), and wind up being able to access the
class binary representation as a byte array. Dump this to a file and
use javap.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top