/[classpath]/classpath/java/lang/Cloneable.java
ViewVC logotype

Diff of /classpath/java/lang/Cloneable.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by jewel, Fri Jul 13 16:46:44 2001 UTC revision 1.8 by ericb, Sun Sep 9 06:30:42 2001 UTC
# Line 1  Line 1 
1  /* Cloneable.java -- Interface for implementing a method to override  /* Cloneable.java -- Interface for marking objects cloneable by Object.clone()
2     Object.clone()comparaing objects to obtain an ordering     Copyright (C) 1998, 2001 Free Software Foundation, Inc.
    Copyright (C) 1998 Free Software Foundation, Inc.  
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 30  package java.lang; Line 29  package java.lang;
29    
30  /**  /**
31   * This interface should be implemented by classes wishing to   * This interface should be implemented by classes wishing to
32   * support or override Object.clone().  Cloning an object generally   * support of override <code>Object.clone()</code>.  The default
33   * results in a deep copy of that object.  If Object.clone() is called   * behaviour of <code>clone()</code> performs a shallow copy, but
34   * on an object which does not implement the Cloneable interface,   * subclasses often change this to perform a deep copy.  Therefore,
35   * a CloneNotSupportedException will be thrown.   * it is a good idea to document how deep your clone will go.
36     * If <code>clone()</code> is called on an object which does not
37     * implement this interface, a <code>CloneNotSupportedException</code>
38     * will be thrown.
39     * <p>
40   *   *
41   * @since JDK1.0   * This interface is simply a tagging interface; it carries no
42     * requirements on methods to implement.  However, it is typical for
43     * a Cloneable class to implement at least <code>equals</code>,
44     * <code>hashCode</code>, and <code>clone</code>, sometimes
45     * increasing the accessibility of clone to be public. The typical
46     * implementation of <code>clone</code> invokes <code>super.clone()</code>
47     * rather than a constructor, but this is not a requirement.
48     * <p>
49     *
50     * If an object that implement Cloneable should not be cloned,
51     * simply override the <code>clone</code> method to throw a
52     * <code>CloneNotSupportedException</code>.
53     * <p>
54     *
55     * All array types implement Cloneable, and have a public
56     * <code>clone</code> method that will never fail with a
57     * <code>CloneNotSupportedException</code>.
58     *
59     * @since 1.0
60   * @author Paul Fisher   * @author Paul Fisher
61     * @author Eric Blake <ebb9@email.byu.edu>
62   *   *
63   * @see java.lang.Object#clone   * @see Object#clone()
64   * @see java.lang.CloneNotSupportedException   * @see CloneNotSupportedException
65   */   */
66  public interface Cloneable { }  public interface Cloneable
67    {
68      // Tagging interface only.
69    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26