-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
1.1.4, 1.1.5, 1.2.0, 1.3.0, 5.0
-
generic, x86, sparc
-
generic, solaris_2.5.1, solaris_2.6, windows_nt, windows_xp
Name: mf23781 Date: 12/09/97
Cloneable doesn't define clone. This means that programmers cannot
polymorphically clone objects, such as in:
for (int i = 0; i < myVector.size(); i++) {
result.myVector.setElementAt(
((Cloneable) myVector.elementAt()).clone(), i);
}
Secondly, programmers have no idea whether clones are deep or shallow.
Since interfaces cannot be changed, suggested solution:
add an interface for deep clones:
public interface interface Copyable {
public Object clone(); // guarantees deep clone
}
###@###.### 11/3/04 21:17 GMT
Cloneable doesn't define clone. This means that programmers cannot
polymorphically clone objects, such as in:
for (int i = 0; i < myVector.size(); i++) {
result.myVector.setElementAt(
((Cloneable) myVector.elementAt()).clone(), i);
}
Secondly, programmers have no idea whether clones are deep or shallow.
Since interfaces cannot be changed, suggested solution:
add an interface for deep clones:
public interface interface Copyable {
public Object clone(); // guarantees deep clone
}
###@###.### 11/3/04 21:17 GMT
- duplicates
-
JDK-4103477 rfe: Need support for deep copying of Object
- Closed
- relates to
-
JDK-1234712 Cloneable is misspelled
- Closed