• Icon: Sub-task Sub-task
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • None
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      The clone-method has no benefits over a copy-constructor and some severe drawbacks. You can *allways* implement clone() with a copy-constructor by simply calling it in the clone-method on yourself for the new object, but you cant do it vice versa, because clone() doesnt work on an object (something like a.cloneTo(Object b) would at least have some use), but instead returns a freshly created object of an already set class.



      JUSTIFICATION :
      The following can be easily implemented if copy-constructors have been used by the superclasses, but it is not implementable without simulating the copy-constructor of the superclass in your derived class:

      class derived1 extends base;
      class derived2 extends base;

      derived1 a = new derived1();
      derived2 b = new derived2(a);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Either change to a.cloneTo(Cloneable b), whitch would also have some benefits over a copy-constructor, or remove it (after a reasonable deprecation tme) completely from the language.
      ACTUAL -
      The clone()-Method gives you a clone, whitch is nice if you want a clone. But it let also to tons of java-code without a copy-constructor – and that is a huge drawback for the language at all.

      ---------- BEGIN SOURCE ----------
      unnecessary
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      unnecessary

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: