rt/emul/compact/src/main/java/java/lang/Cloneable.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 13 Sep 2014 18:33:05 +0200
changeset 1688 e709c530c227
parent 772 d382dacfd73f
parent 1675 cd50c1894ce5
permissions -rw-r--r--
Lambda's work OK in AOT mode. Defender methods work OK. Merging.
jaroslav@1675
     1
/*
jaroslav@1675
     2
 * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
jaroslav@1675
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@1675
     4
 *
jaroslav@1675
     5
 * This code is free software; you can redistribute it and/or modify it
jaroslav@1675
     6
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@1675
     7
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@1675
     8
 * particular file as subject to the "Classpath" exception as provided
jaroslav@1675
     9
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@1675
    10
 *
jaroslav@1675
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@1675
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@1675
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@1675
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@1675
    15
 * accompanied this code).
jaroslav@1675
    16
 *
jaroslav@1675
    17
 * You should have received a copy of the GNU General Public License version
jaroslav@1675
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@1675
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@1675
    20
 *
jaroslav@1675
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@1675
    22
 * or visit www.oracle.com if you need additional information or have any
jaroslav@1675
    23
 * questions.
jaroslav@1675
    24
 */
jaroslav@1675
    25
jaroslav@1675
    26
package java.lang;
jaroslav@1675
    27
jaroslav@1675
    28
/**
jaroslav@1675
    29
 * A class implements the <code>Cloneable</code> interface to
jaroslav@1675
    30
 * indicate to the {@link java.lang.Object#clone()} method that it
jaroslav@1675
    31
 * is legal for that method to make a
jaroslav@1675
    32
 * field-for-field copy of instances of that class.
jaroslav@1675
    33
 * <p>
jaroslav@1675
    34
 * Invoking Object's clone method on an instance that does not implement the
jaroslav@1675
    35
 * <code>Cloneable</code> interface results in the exception
jaroslav@1675
    36
 * <code>CloneNotSupportedException</code> being thrown.
jaroslav@1675
    37
 * <p>
jaroslav@1675
    38
 * By convention, classes that implement this interface should override
jaroslav@1675
    39
 * <tt>Object.clone</tt> (which is protected) with a public method.
jaroslav@1675
    40
 * See {@link java.lang.Object#clone()} for details on overriding this
jaroslav@1675
    41
 * method.
jaroslav@1675
    42
 * <p>
jaroslav@1675
    43
 * Note that this interface does <i>not</i> contain the <tt>clone</tt> method.
jaroslav@1675
    44
 * Therefore, it is not possible to clone an object merely by virtue of the
jaroslav@1675
    45
 * fact that it implements this interface.  Even if the clone method is invoked
jaroslav@1675
    46
 * reflectively, there is no guarantee that it will succeed.
jaroslav@1675
    47
 *
jaroslav@1675
    48
 * @author  unascribed
jaroslav@1675
    49
 * @see     java.lang.CloneNotSupportedException
jaroslav@1675
    50
 * @see     java.lang.Object#clone()
jaroslav@1675
    51
 * @since   JDK1.0
jaroslav@1675
    52
 */
jaroslav@1675
    53
public interface Cloneable {
jaroslav@1675
    54
}