ClassDefinition[] changes = new ClassDefinition[changeSet.getElements().size()];
int index = 0;
for (Iterator it = changeSet.getElements().iterator(); it.hasNext(); index++) {
ChangeSet.Element changeSetElement = (ChangeSet.Element) it.next();
final byte[] bytecode = JoinPointFactory.redefineJoinPoint(changeSetElement.getCompilationInfo());
changes[index] = new ClassDefinition(changeSetElement.getJoinPointInfo().getJoinPointClass(), bytecode);
}
try {
Agent.getInstrumentation().redefineClasses(changes);
} catch (Exception e) {
throw new WrappedRuntimeException(e);