Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4098033

Cloneable doesn't define .clone

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.5.1, solaris_2.6, windows_nt, windows_xp

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sseligmasunw Scott Seligman (Inactive)
              Reporter:
              miflemi Mick Fleming (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: