RuntimeException.java revision 4116
869N/A * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. 869N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 869N/A * This code is free software; you can redistribute it and/or modify it 869N/A * under the terms of the GNU General Public License version 2 only, as 869N/A * published by the Free Software Foundation. Oracle designates this 869N/A * particular file as subject to the "Classpath" exception as provided 869N/A * by Oracle in the LICENSE file that accompanied this code. 869N/A * This code is distributed in the hope that it will be useful, but WITHOUT 869N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 869N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 869N/A * version 2 for more details (a copy is included in the LICENSE file that 869N/A * accompanied this code). 869N/A * You should have received a copy of the GNU General Public License version 873N/A * 2 along with this work; if not, write to the Free Software Foundation, 869N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 869N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 869N/A * or visit www.oracle.com if you need additional information or have any 0N/A * {@code RuntimeException} is the superclass of those 0N/A * exceptions that can be thrown during the normal operation of the 0N/A * Java Virtual Machine. 0N/A * <p>{@code RuntimeException} and its subclasses are <em>unchecked 0N/A * exceptions</em>. Unchecked exceptions do <em>not</em> need to be 0N/A * declared in a method or constructor's {@code throws} clause if they 869N/A * can be thrown by the execution of the method or constructor and 0N/A * propagate outside the method or constructor boundary. 0N/A * @author Frank Yellin 869N/A * @jls 11.2 Compile-Time Checking of Exceptions 869N/A /** Constructs a new runtime exception with {@code null} as its 0N/A * detail message. The cause is not initialized, and may subsequently be 869N/A * initialized by a call to {@link #initCause}. 3103N/A /** Constructs a new runtime exception with the specified detail message. 3127N/A * The cause is not initialized, and may subsequently be initialized by a 3679N/A * call to {@link #initCause}. 1954N/A * @param message the detail message. The detail message is saved for 1954N/A * later retrieval by the {@link #getMessage()} method. 4306N/A * Constructs a new runtime exception with the specified detail message and 1954N/A * cause. <p>Note that the detail message associated with 1954N/A * {@code cause} is <i>not</i> automatically incorporated in 1954N/A * this runtime exception's detail message. 5221N/A * @param message the detail message (which is saved for later retrieval 0N/A * by the {@link #getMessage()} method). 0N/A * @param cause the cause (which is saved for later retrieval by the 869N/A * {@link #getCause()} method). (A <tt>null</tt> value is 868N/A * permitted, and indicates that the cause is nonexistent or 2980N/A /** Constructs a new runtime exception with the specified cause and a 2963N/A * detail message of <tt>(cause==null ? null : cause.toString())</tt> 1503N/A * (which typically contains the class and detail message of 2915N/A * <tt>cause</tt>). This constructor is useful for runtime exceptions 869N/A * that are little more than wrappers for other throwables. 2624N/A * @param cause the cause (which is saved for later retrieval by the 0N/A * {@link #getCause()} method). (A <tt>null</tt> value is 2270N/A * permitted, and indicates that the cause is nonexistent or 868N/A * Constructs a new runtime exception with the specified detail 0N/A * message, cause, suppression enabled or disabled, and writable 0N/A * stack trace enabled or disabled. 869N/A * @param message the detail message. 868N/A * @param cause the cause. (A {@code null} value is permitted, 65N/A * and indicates that the cause is nonexistent or unknown.) 869N/A * @param enableSuppression whether or not suppression is enabled 2624N/A * @param writableStackTrace whether or not the stack trace should