Retransform the supplied set of classes.
This function facilitates the instrumentation
of already loaded classes.
When classes are initially loaded or when they are
the initial class file bytes can be transformed with the
This function reruns the transformation process
(whether or not a transformation has previously occurred).
This retransformation follows these steps:
canRetransformfalse, the bytes returned by
transformduring the last class load or redefine are reused as the output of the transformation; note that this is equivalent to reapplying the previous transformation, unaltered; except that
transformis not called
transformmethod is called in these transformers
The order of transformation is described in the
This same order is used in the automatic reapplication of retransformation
The initial class file bytes represent the bytes passed to
(before any transformations
were applied), however they might not exactly match them.
The constant pool might not have the same layout or contents.
The constant pool may have more or fewer entries.
Constant pool entries may be in a different order; however,
constant pool indices in the bytecodes of methods will correspond.
Some attributes may not be present.
Where order is not meaningful, for example the order of methods,
order might not be preserved.
This method operates on a set in order to allow interdependent changes to more than one class at the same time (a retransformation of class A can require a retransformation of class B).
If a retransformed method has active stack frames, those active frames continue to run the bytecodes of the original method. The retransformed method will be used on new invokes.
This method does not cause any initialization except that which would occur under the customary JVM semantics. In other words, redefining a class does not cause its initializers to be run. The values of static variables will remain as they were prior to the call.
Instances of the retransformed class are not affected.
The retransformation may change method bodies, the constant pool and attributes. The retransformation must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. These restrictions maybe be lifted in future versions. The class file bytes are not checked, verified and installed until after the transformations have been applied, if the resultant bytes are in error this method will throw an exception.
If this method throws an exception, no classes have been retransformed.
This method is intended for use in instrumentation, as described in the class specification.
|array of classes to retransform; a zero-length array is allowed, in this case, this method does nothing|
| if a specified class cannot be modified
| if the current configuration of the JVM does not allow
|if the data did not contain a valid class|
|if the name in the class file is not equal to the name of the class|
|if the class file version numbers are not supported|
|if the new classes contain a circularity|
|if a linkage error occurs|
| if the supplied classes array or any of its components