* dynamicaly wrapped.
*/
public void convertProcessedClasses(HotSwapper hotSwapper, CtClass clazz,
Collection fieldReads, Collection fieldWrites, boolean constructor)
{
AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
CodeConverter codeConverter = new CodeConverter();
for (Iterator iterator = fieldReads.iterator(); iterator.hasNext(); )
{
CtField field = (CtField) iterator.next();
codeConverter.replaceFieldRead(field, clazz, fieldAccessTransformer.fieldRead(field.getName()));
}
for (Iterator iterator = fieldWrites.iterator(); iterator.hasNext(); )
{
CtField field = (CtField) iterator.next();
codeConverter.replaceFieldWrite(field, clazz, fieldAccessTransformer.fieldWrite(field.getName()));
}
if (constructor)
{
codeConverter.replaceNew(clazz, clazz, ConstructorExecutionTransformer.constructorFactory(clazz.getSimpleName()));
}
synchronized(processedClasses)
{
for (Iterator iterator = processedClasses.iterator(); iterator.hasNext();)
{
CtClass processedClass = (CtClass) iterator.next();
if (processedClass == clazz)
continue;
if (processedClass.getRefClasses() == null ||
! clazz.getRefClasses().contains(clazz.getName()))
{
continue;
}
try
{
processedClass.defrost();
byte[] previousByteCode = processedClass.toBytecode();
processedClass.defrost();
processedClass.instrument(codeConverter);
byte[] updatedByteCode = processedClass.toBytecode();
if (!java.util.Arrays.equals(updatedByteCode, previousByteCode))
{
hotSwapper.registerChange(classPool.getClassLoader().loadClass(processedClass.getName()), updatedByteCode);
}
processedClass.defrost();
}
catch (Exception e)
{