Check out the new USENIX Web site. next up previous
Next: Bytecode Modification Up: The JOIE Environment Previous: Load-time Reflection

Class Modification

Transformers call upon the JOIE API not only to discover elements of classes through reflection, but also to change or modify those elements. That is, given access to a class (ClassInfo) or a member of a class, a transformer can change aspects of the class implementation. For example, transformers can: set or unset modifiers; add, remove, or rename fields or methods; change method signatures or field types; adjust the list of interfaces implemented by the class; adjust references to fields or methods to point to new fields or methods; adjust the value of embedded constants; or manipulate the inheritance hierarchy.

The structure of Java classfiles allows the JOIE toolkit to implement a wide range of class modifications without the need to modify other classes that refer to the target class. This is because all references to class members, including external references, are symbolic and stored in a Constant Pool. Section 4.1 discusses implementation issues for class modification in JOIE.



Geoff Alex Cohen
Tue Apr 28 14:31:49 EDT 1998