openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Cool debug tip for writing generated classes
Date Fri, 05 Mar 2010 20:55:14 GMT
Numerous times I've wanted to see the contents of OpenJPA generated byte
code and it was always a painful process. Today I came across some code that
I found to be very useful.

Code:
System.setProperty("org.apache.openjpa.enhance.ManagedClassSubclasser.dumpBytecodes",
"true");
Project p = new Project();
ManagedClassSubclasser.debugBytecodes(p.loadClass(object.getClass()));

SystemOut:
Writing to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\.....class

This will result in a .class file being dumped which then can be decompiled.
Note, I had to make ManagedClassSubclasser.debugBytecodes a public method
for this to work...
-- 
Thanks,
Rick

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message