jaroslav@70: /* jaroslav@70: * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. jaroslav@70: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@70: * jaroslav@70: * This code is free software; you can redistribute it and/or modify it jaroslav@70: * under the terms of the GNU General Public License version 2 only, as jaroslav@70: * published by the Free Software Foundation. Oracle designates this jaroslav@70: * particular file as subject to the "Classpath" exception as provided jaroslav@70: * by Oracle in the LICENSE file that accompanied this code. jaroslav@70: * jaroslav@70: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@70: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@70: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@70: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@70: * accompanied this code). jaroslav@70: * jaroslav@70: * You should have received a copy of the GNU General Public License version jaroslav@70: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@70: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@70: * jaroslav@70: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@70: * or visit www.oracle.com if you need additional information or have any jaroslav@70: * questions. jaroslav@70: */ jaroslav@70: jaroslav@70: package java.lang; jaroslav@70: jaroslav@70: /** jaroslav@70: * An {@code Error} is a subclass of {@code Throwable} jaroslav@70: * that indicates serious problems that a reasonable application jaroslav@70: * should not try to catch. Most such errors are abnormal conditions. jaroslav@70: * The {@code ThreadDeath} error, though a "normal" condition, jaroslav@70: * is also a subclass of {@code Error} because most applications jaroslav@70: * should not try to catch it. jaroslav@70: *

jaroslav@70: * A method is not required to declare in its {@code throws} jaroslav@70: * clause any subclasses of {@code Error} that might be thrown jaroslav@70: * during the execution of the method but not caught, since these jaroslav@70: * errors are abnormal conditions that should never occur. jaroslav@70: * jaroslav@70: * That is, {@code Error} and its subclasses are regarded as unchecked jaroslav@70: * exceptions for the purposes of compile-time checking of exceptions. jaroslav@70: * jaroslav@70: * @author Frank Yellin jaroslav@70: * @see java.lang.ThreadDeath jaroslav@70: * @jls 11.2 Compile-Time Checking of Exceptions jaroslav@70: * @since JDK1.0 jaroslav@70: */ jaroslav@70: public class Error extends Throwable { jaroslav@70: static final long serialVersionUID = 4980196508277280342L; jaroslav@70: jaroslav@70: /** jaroslav@70: * Constructs a new error with {@code null} as its detail message. jaroslav@70: * The cause is not initialized, and may subsequently be initialized by a jaroslav@70: * call to {@link #initCause}. jaroslav@70: */ jaroslav@70: public Error() { jaroslav@70: super(); jaroslav@70: } jaroslav@70: jaroslav@70: /** jaroslav@70: * Constructs a new error with the specified detail message. The jaroslav@70: * cause is not initialized, and may subsequently be initialized by jaroslav@70: * a call to {@link #initCause}. jaroslav@70: * jaroslav@70: * @param message the detail message. The detail message is saved for jaroslav@70: * later retrieval by the {@link #getMessage()} method. jaroslav@70: */ jaroslav@70: public Error(String message) { jaroslav@70: super(message); jaroslav@70: } jaroslav@70: jaroslav@70: /** jaroslav@70: * Constructs a new error with the specified detail message and jaroslav@70: * cause.

Note that the detail message associated with jaroslav@70: * {@code cause} is not automatically incorporated in jaroslav@70: * this error's detail message. jaroslav@70: * jaroslav@70: * @param message the detail message (which is saved for later retrieval jaroslav@70: * by the {@link #getMessage()} method). jaroslav@70: * @param cause the cause (which is saved for later retrieval by the jaroslav@70: * {@link #getCause()} method). (A {@code null} value is jaroslav@70: * permitted, and indicates that the cause is nonexistent or jaroslav@70: * unknown.) jaroslav@70: * @since 1.4 jaroslav@70: */ jaroslav@70: public Error(String message, Throwable cause) { jaroslav@70: super(message, cause); jaroslav@70: } jaroslav@70: jaroslav@70: /** jaroslav@70: * Constructs a new error with the specified cause and a detail jaroslav@70: * message of {@code (cause==null ? null : cause.toString())} (which jaroslav@70: * typically contains the class and detail message of {@code cause}). jaroslav@70: * This constructor is useful for errors that are little more than jaroslav@70: * wrappers for other throwables. jaroslav@70: * jaroslav@70: * @param cause the cause (which is saved for later retrieval by the jaroslav@70: * {@link #getCause()} method). (A {@code null} value is jaroslav@70: * permitted, and indicates that the cause is nonexistent or jaroslav@70: * unknown.) jaroslav@70: * @since 1.4 jaroslav@70: */ jaroslav@70: public Error(Throwable cause) { jaroslav@70: super(cause); jaroslav@70: } jaroslav@70: jaroslav@70: /** jaroslav@70: * Constructs a new error with the specified detail message, jaroslav@70: * cause, suppression enabled or disabled, and writable stack jaroslav@70: * trace enabled or disabled. jaroslav@70: * jaroslav@70: * @param message the detail message. jaroslav@70: * @param cause the cause. (A {@code null} value is permitted, jaroslav@70: * and indicates that the cause is nonexistent or unknown.) jaroslav@70: * @param enableSuppression whether or not suppression is enabled jaroslav@70: * or disabled jaroslav@70: * @param writableStackTrace whether or not the stack trace should jaroslav@70: * be writable jaroslav@70: * jaroslav@70: * @since 1.7 jaroslav@70: */ jaroslav@70: protected Error(String message, Throwable cause, jaroslav@70: boolean enableSuppression, jaroslav@70: boolean writableStackTrace) { jaroslav@70: super(message, cause, enableSuppression, writableStackTrace); jaroslav@70: } jaroslav@70: }