VmType old_type = VmType.fromClass(oldClass);
VmClassLoader loader = VmType.fromClass(oldClass).getLoader();
ProtectionDomain pd = oldClass.getProtectionDomain();
VmType new_type = ClassDecoder.defineClass(name, ByteBuffer.wrap(classData), false, loader, pd);
for(int i = 0; i < old_type.getNoDeclaredMethods(); i++){
VmMethod old_method = old_type.getDeclaredMethod(i);
if (!old_method.isNative()) {
VmMethod new_method = new_type.getDeclaredMethod(old_method.getName(), old_method.getSignature());
if(new_method == null) continue;
old_method.setBytecode(new_method.getBytecode());
old_method.resetOptLevel();
old_method.recompile();
System.out.println("Redefined method: " + old_method.getFullName());
}
}