class file transformation questions

Mark Roberts markro at cs.washington.edu
Fri Nov 15 19:42:11 UTC 2024


Several of our tools use the java.lang.instrument package to instrument
class files when they are loaded.  We currently use BCEL to do the
instrumentation, but would like to move to the new java.lang.classfile
package.  I have gotten some basic transforms working in this environment
and I see how to modify existing instructions.   However, we need to
perform some larger modifications to the classes we instrument.



There are three basic transforms we need to perform (all on the same class
file):



   1. Injecting code into an existing method
   2. Adding new methods
   3. Duplicating an existing method with some changes



Any suggestions as to how to accomplish these tasks would be much
appreciated.



Thank you,

Mark Roberts
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20241115/af845e93/attachment.htm>


More information about the classfile-api-dev mailing list