rt/emul/mini/src/main/java/java/lang/Error.java
changeset 772 d382dacfd73f
parent 554 05224402145d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Error.java	Tue Feb 26 16:54:16 2013 +0100
     1.3 @@ -0,0 +1,128 @@
     1.4 +/*
     1.5 + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package java.lang;
    1.30 +
    1.31 +/**
    1.32 + * An {@code Error} is a subclass of {@code Throwable}
    1.33 + * that indicates serious problems that a reasonable application
    1.34 + * should not try to catch. Most such errors are abnormal conditions.
    1.35 + * The {@code ThreadDeath} error, though a "normal" condition,
    1.36 + * is also a subclass of {@code Error} because most applications
    1.37 + * should not try to catch it.
    1.38 + * <p>
    1.39 + * A method is not required to declare in its {@code throws}
    1.40 + * clause any subclasses of {@code Error} that might be thrown
    1.41 + * during the execution of the method but not caught, since these
    1.42 + * errors are abnormal conditions that should never occur.
    1.43 + *
    1.44 + * That is, {@code Error} and its subclasses are regarded as unchecked
    1.45 + * exceptions for the purposes of compile-time checking of exceptions.
    1.46 + *
    1.47 + * @author  Frank Yellin
    1.48 + * @see     java.lang.ThreadDeath
    1.49 + * @jls 11.2 Compile-Time Checking of Exceptions
    1.50 + * @since   JDK1.0
    1.51 + */
    1.52 +public class Error extends Throwable {
    1.53 +    static final long serialVersionUID = 4980196508277280342L;
    1.54 +
    1.55 +    /**
    1.56 +     * Constructs a new error with {@code null} as its detail message.
    1.57 +     * The cause is not initialized, and may subsequently be initialized by a
    1.58 +     * call to {@link #initCause}.
    1.59 +     */
    1.60 +    public Error() {
    1.61 +        super();
    1.62 +    }
    1.63 +
    1.64 +    /**
    1.65 +     * Constructs a new error with the specified detail message.  The
    1.66 +     * cause is not initialized, and may subsequently be initialized by
    1.67 +     * a call to {@link #initCause}.
    1.68 +     *
    1.69 +     * @param   message   the detail message. The detail message is saved for
    1.70 +     *          later retrieval by the {@link #getMessage()} method.
    1.71 +     */
    1.72 +    public Error(String message) {
    1.73 +        super(message);
    1.74 +    }
    1.75 +
    1.76 +    /**
    1.77 +     * Constructs a new error with the specified detail message and
    1.78 +     * cause.  <p>Note that the detail message associated with
    1.79 +     * {@code cause} is <i>not</i> automatically incorporated in
    1.80 +     * this error's detail message.
    1.81 +     *
    1.82 +     * @param  message the detail message (which is saved for later retrieval
    1.83 +     *         by the {@link #getMessage()} method).
    1.84 +     * @param  cause the cause (which is saved for later retrieval by the
    1.85 +     *         {@link #getCause()} method).  (A {@code null} value is
    1.86 +     *         permitted, and indicates that the cause is nonexistent or
    1.87 +     *         unknown.)
    1.88 +     * @since  1.4
    1.89 +     */
    1.90 +    public Error(String message, Throwable cause) {
    1.91 +        super(message, cause);
    1.92 +    }
    1.93 +
    1.94 +    /**
    1.95 +     * Constructs a new error with the specified cause and a detail
    1.96 +     * message of {@code (cause==null ? null : cause.toString())} (which
    1.97 +     * typically contains the class and detail message of {@code cause}).
    1.98 +     * This constructor is useful for errors that are little more than
    1.99 +     * wrappers for other throwables.
   1.100 +     *
   1.101 +     * @param  cause the cause (which is saved for later retrieval by the
   1.102 +     *         {@link #getCause()} method).  (A {@code null} value is
   1.103 +     *         permitted, and indicates that the cause is nonexistent or
   1.104 +     *         unknown.)
   1.105 +     * @since  1.4
   1.106 +     */
   1.107 +    public Error(Throwable cause) {
   1.108 +        super(cause);
   1.109 +    }
   1.110 +
   1.111 +    /**
   1.112 +     * Constructs a new error with the specified detail message,
   1.113 +     * cause, suppression enabled or disabled, and writable stack
   1.114 +     * trace enabled or disabled.
   1.115 +     *
   1.116 +     * @param  message the detail message.
   1.117 +     * @param cause the cause.  (A {@code null} value is permitted,
   1.118 +     * and indicates that the cause is nonexistent or unknown.)
   1.119 +     * @param enableSuppression whether or not suppression is enabled
   1.120 +     *                          or disabled
   1.121 +     * @param writableStackTrace whether or not the stack trace should
   1.122 +     *                           be writable
   1.123 +     *
   1.124 +     * @since 1.7
   1.125 +     */
   1.126 +    protected Error(String message, Throwable cause,
   1.127 +                    boolean enableSuppression,
   1.128 +                    boolean writableStackTrace) {
   1.129 +        super(message, cause, enableSuppression, writableStackTrace);
   1.130 +    }
   1.131 +}