for (RubyModule p = module.getSuperClass(); p != null; p = p.getSuperClass())
nestedModuleCount++;
IncludedModuleWrapper[] nestedModules = new IncludedModuleWrapper[nestedModuleCount];
IncludedModuleWrapper nestedModule = (IncludedModuleWrapper)module.getSuperClass();
for(int index = 0; index < nestedModules.length; index++){
nestedModules[index] = nestedModule;
nestedModule = (IncludedModuleWrapper)nestedModule.getSuperClass();
}
for(int index = nestedModules.length; index > 0; index--) {
add_module(klass, nestedModules[index-1].getNonIncludedClass());
}