* dynamicaly wrapped.
*/
public void convertProcessedClasses(HotSwapper hotSwapper, CtClass clazz,
Collection<CtField> fieldReads, Collection<CtField> fieldWrites, boolean constructor)
{
AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
CodeConverter codeConverter = new CodeConverter();
for (CtField field : fieldReads)
{
codeConverter.replaceFieldRead(field, clazz, FieldAccessTransformer.fieldRead(field.getName()));
}
for (CtField field : fieldWrites)
{
codeConverter.replaceFieldWrite(field, clazz, FieldAccessTransformer.fieldWrite(field.getName()));
}
if (constructor)
{
codeConverter.replaceNew(clazz, clazz, ConstructorExecutionTransformer.constructorFactory(clazz.getSimpleName()));
}
synchronized(processedClasses)
{
for (CtClass processedClass : processedClasses)
{
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)
{