jaroslav@52: /* jaroslav@52: * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. jaroslav@52: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@52: * jaroslav@52: * This code is free software; you can redistribute it and/or modify it jaroslav@52: * under the terms of the GNU General Public License version 2 only, as jaroslav@52: * published by the Free Software Foundation. Oracle designates this jaroslav@52: * particular file as subject to the "Classpath" exception as provided jaroslav@52: * by Oracle in the LICENSE file that accompanied this code. jaroslav@52: * jaroslav@52: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@52: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@52: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@52: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@52: * accompanied this code). jaroslav@52: * jaroslav@52: * You should have received a copy of the GNU General Public License version jaroslav@52: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@52: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@52: * jaroslav@52: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@52: * or visit www.oracle.com if you need additional information or have any jaroslav@52: * questions. jaroslav@52: */ jaroslav@52: jaroslav@52: package java.lang; jaroslav@52: jaroslav@52: /** jaroslav@52: * {@code RuntimeException} is the superclass of those jaroslav@52: * exceptions that can be thrown during the normal operation of the jaroslav@52: * Java Virtual Machine. jaroslav@52: * jaroslav@52: *

{@code RuntimeException} and its subclasses are unchecked jaroslav@52: * exceptions. Unchecked exceptions do not need to be jaroslav@52: * declared in a method or constructor's {@code throws} clause if they jaroslav@52: * can be thrown by the execution of the method or constructor and jaroslav@52: * propagate outside the method or constructor boundary. jaroslav@52: * jaroslav@52: * @author Frank Yellin jaroslav@52: * @jls 11.2 Compile-Time Checking of Exceptions jaroslav@52: * @since JDK1.0 jaroslav@52: */ jaroslav@52: public class RuntimeException extends Exception { jaroslav@52: static final long serialVersionUID = -7034897190745766939L; jaroslav@52: jaroslav@52: /** Constructs a new runtime exception with {@code null} as its jaroslav@52: * detail message. The cause is not initialized, and may subsequently be jaroslav@52: * initialized by a call to {@link #initCause}. jaroslav@52: */ jaroslav@52: public RuntimeException() { jaroslav@52: super(); jaroslav@52: } jaroslav@52: jaroslav@52: /** Constructs a new runtime exception with the specified detail message. jaroslav@52: * The cause is not initialized, and may subsequently be initialized by a jaroslav@52: * call to {@link #initCause}. jaroslav@52: * jaroslav@52: * @param message the detail message. The detail message is saved for jaroslav@52: * later retrieval by the {@link #getMessage()} method. jaroslav@52: */ jaroslav@52: public RuntimeException(String message) { jaroslav@52: super(message); jaroslav@52: } jaroslav@52: jaroslav@52: /** jaroslav@52: * Constructs a new runtime exception with the specified detail message and jaroslav@52: * cause.

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