/** * @return deep copy of this class */ public JavaClass copy() { JavaClass c = null; try { c = (JavaClass)clone(); } catch(CloneNotSupportedException e) {} c.constant_pool = constant_pool.copy(); c.interfaces = (int[])interfaces.clone(); c.interface_names = (String[])interface_names.clone(); c.fields = new Field[fields.length]; for(int i=0; i < fields.length; i++) c.fields[i] = fields[i].copy(c.constant_pool); c.methods = new Method[methods.length]; for(int i=0; i < methods.length; i++) c.methods[i] = methods[i].copy(c.constant_pool); c.attributes = new Attribute[attributes.length]; for(int i=0; i < attributes.length; i++) c.attributes[i] = attributes[i].copy(c.constant_pool); return c; }
/** * @return deep copy of this class */ public JavaClass copy() { JavaClass c = null; try { c = (JavaClass) clone(); c.constant_pool = constant_pool.copy(); c.interfaces = interfaces.clone(); c.interface_names = interface_names.clone(); c.fields = new Field[fields.length]; for (int i = 0; i < fields.length; i++) { c.fields[i] = fields[i].copy(c.constant_pool); } c.methods = new Method[methods.length]; for (int i = 0; i < methods.length; i++) { c.methods[i] = methods[i].copy(c.constant_pool); } c.attributes = new Attribute[attributes.length]; for (int i = 0; i < attributes.length; i++) { c.attributes[i] = attributes[i].copy(c.constant_pool); } } catch (final CloneNotSupportedException e) { // TODO should this throw? } return c; }