jdk/src/share/classes/java/lang/Error.java
changeset 4666 085aef3c09ff
parent 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
4665:d14dc3d9e1fa 4666:085aef3c09ff
    24  */
    24  */
    25 
    25 
    26 package java.lang;
    26 package java.lang;
    27 
    27 
    28 /**
    28 /**
    29  * An <code>Error</code> is a subclass of <code>Throwable</code>
    29  * An {@code Error} is a subclass of {@code Throwable}
    30  * that indicates serious problems that a reasonable application
    30  * that indicates serious problems that a reasonable application
    31  * should not try to catch. Most such errors are abnormal conditions.
    31  * should not try to catch. Most such errors are abnormal conditions.
    32  * The <code>ThreadDeath</code> error, though a "normal" condition,
    32  * The {@code ThreadDeath} error, though a "normal" condition,
    33  * is also a subclass of <code>Error</code> because most applications
    33  * is also a subclass of {@code Error} because most applications
    34  * should not try to catch it.
    34  * should not try to catch it.
    35  * <p>
    35  * <p>
    36  * A method is not required to declare in its <code>throws</code>
    36  * A method is not required to declare in its {@code throws}
    37  * clause any subclasses of <code>Error</code> that might be thrown
    37  * clause any subclasses of {@code Error} that might be thrown
    38  * during the execution of the method but not caught, since these
    38  * during the execution of the method but not caught, since these
    39  * errors are abnormal conditions that should never occur.
    39  * errors are abnormal conditions that should never occur.
    40  *
    40  *
       
    41  * That is, {@code Error} and its subclasses are regarded as unchecked
       
    42  * exceptions for the purposes of compile-time checking of exceptions.
       
    43  *
    41  * @author  Frank Yellin
    44  * @author  Frank Yellin
    42  * @see     java.lang.ThreadDeath
    45  * @see     java.lang.ThreadDeath
       
    46  * @jls3 11.2 Compile-Time Checking of Exceptions
    43  * @since   JDK1.0
    47  * @since   JDK1.0
    44  */
    48  */
    45 public class Error extends Throwable {
    49 public class Error extends Throwable {
    46     static final long serialVersionUID = 4980196508277280342L;
    50     static final long serialVersionUID = 4980196508277280342L;
    47 
    51 
    48     /**
    52     /**
    49      * Constructs a new error with <code>null</code> as its detail message.
    53      * Constructs a new error with {@code null} as its detail message.
    50      * The cause is not initialized, and may subsequently be initialized by a
    54      * The cause is not initialized, and may subsequently be initialized by a
    51      * call to {@link #initCause}.
    55      * call to {@link #initCause}.
    52      */
    56      */
    53     public Error() {
    57     public Error() {
    54         super();
    58         super();
    67     }
    71     }
    68 
    72 
    69     /**
    73     /**
    70      * Constructs a new error with the specified detail message and
    74      * Constructs a new error with the specified detail message and
    71      * cause.  <p>Note that the detail message associated with
    75      * cause.  <p>Note that the detail message associated with
    72      * <code>cause</code> is <i>not</i> automatically incorporated in
    76      * {@code cause} is <i>not</i> automatically incorporated in
    73      * this error's detail message.
    77      * this error's detail message.
    74      *
    78      *
    75      * @param  message the detail message (which is saved for later retrieval
    79      * @param  message the detail message (which is saved for later retrieval
    76      *         by the {@link #getMessage()} method).
    80      *         by the {@link #getMessage()} method).
    77      * @param  cause the cause (which is saved for later retrieval by the
    81      * @param  cause the cause (which is saved for later retrieval by the