public static void main(String[] argv) throws Exception {
JavaClass clazz;
if ((clazz = Repository.lookupClass(argv[0])) == null) {
clazz = new ClassParser(argv[0]).parse(); // May throw IOException
}
ClassGen cg = new ClassGen(clazz);
for (Method method : clazz.getMethods()) {
MethodGen mg = new MethodGen(method, cg.getClassName(), cg.getConstantPool());
cg.replaceMethod(method, mg.getMethod());
}
for (Field field : clazz.getFields()) {
FieldGen fg = new FieldGen(field, cg.getConstantPool());
cg.replaceField(field, fg.getField());
}
cg.getJavaClass().dump(clazz.getClassName() + ".clazz");
}
|