1 |
/* CloneNotSupportedException.java -- exception thrown to indicate that |
/* CloneNotSupportedException.java -- thrown when an object cannot be cloned |
2 |
the object calling the clone method of Object does not implement the |
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
|
Cloneable interface. |
|
|
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
|
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
any later version. |
10 |
|
|
11 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
38 |
|
|
39 |
package java.lang; |
package java.lang; |
40 |
|
|
|
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 |
|
|
* "The Java Language Specification", ISBN 0-201-63451-1 |
|
|
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com. |
|
|
* Status: Believed complete and correct. |
|
|
*/ |
|
|
|
|
41 |
/** |
/** |
42 |
* Thrown to indicate an object should not or could not be cloned. This |
* Thrown to indicate an object should not or could not be cloned. This |
43 |
* includes the case when {@link Object#clone()} is called on an object |
* includes the case when {@link Object#clone()} is called on an object |
44 |
* which does not implement the {@link Cloneable} interface. |
* which does not implement the {@link Cloneable} interface. For example:<br> |
45 |
* <p> |
* <pre> |
46 |
|
* void m() throws CloneNotSupportedException |
47 |
|
* { |
48 |
|
* clone(); |
49 |
|
* } |
50 |
|
* </pre> |
51 |
* |
* |
52 |
* Notice that calling <code>clone()</code> on an array will never produce |
* <p>Notice that calling <code>clone()</code> on an array will never produce |
53 |
* this exception, as the VM will always succeed in copying the array, or |
* this exception, as the VM will always succeed in copying the array, or |
54 |
* cause an OutOfMemoryError first. |
* cause an OutOfMemoryError first. For example:<br> |
55 |
|
* <pre> |
56 |
|
* void m(int[] array) |
57 |
|
* { |
58 |
|
* int[] copy = (int[]) array.clone(); |
59 |
|
* } |
60 |
|
* </pre> |
61 |
* |
* |
62 |
* @author Brian Jones |
* @author Brian Jones |
63 |
* @author Warren Levy <warrenl@cygnus.com> |
* @author Warren Levy <warrenl@cygnus.com> |
64 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake <ebb9@email.byu.edu> |
|
* @since 1.0 |
|
65 |
* @see Cloneable |
* @see Cloneable |
66 |
* @see Object#clone() |
* @see Object#clone() |
67 |
|
* @status updated to 1.4 |
68 |
*/ |
*/ |
69 |
public class CloneNotSupportedException extends Exception |
public class CloneNotSupportedException extends Exception |
70 |
{ |
{ |
71 |
/** |
/** |
72 |
* compatible with JDK 1.0+ |
* Compatible with JDK 1.0+. |
73 |
*/ |
*/ |
74 |
private static final long serialVersionUID = 5195511250079656443L; |
private static final long serialVersionUID = 5195511250079656443L; |
75 |
|
|
82 |
|
|
83 |
/** |
/** |
84 |
* Create an exception with a message. |
* Create an exception with a message. |
85 |
|
* |
86 |
* @param s the error message |
* @param s the error message |
87 |
*/ |
*/ |
88 |
public CloneNotSupportedException(String s) |
public CloneNotSupportedException(String s) |