emul/src/main/java/java/lang/RuntimeException.java
branchjdk7-b147
changeset 52 94c1a17117f3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/emul/src/main/java/java/lang/RuntimeException.java	Sat Sep 29 06:38:34 2012 +0200
     1.3 @@ -0,0 +1,119 @@
     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 + * {@code RuntimeException} is the superclass of those
    1.33 + * exceptions that can be thrown during the normal operation of the
    1.34 + * Java Virtual Machine.
    1.35 + *
    1.36 + * <p>{@code RuntimeException} and its subclasses are <em>unchecked
    1.37 + * exceptions</em>.  Unchecked exceptions do <em>not</em> need to be
    1.38 + * declared in a method or constructor's {@code throws} clause if they
    1.39 + * can be thrown by the execution of the method or constructor and
    1.40 + * propagate outside the method or constructor boundary.
    1.41 + *
    1.42 + * @author  Frank Yellin
    1.43 + * @jls 11.2 Compile-Time Checking of Exceptions
    1.44 + * @since   JDK1.0
    1.45 + */
    1.46 +public class RuntimeException extends Exception {
    1.47 +    static final long serialVersionUID = -7034897190745766939L;
    1.48 +
    1.49 +    /** Constructs a new runtime exception with {@code null} as its
    1.50 +     * detail message.  The cause is not initialized, and may subsequently be
    1.51 +     * initialized by a call to {@link #initCause}.
    1.52 +     */
    1.53 +    public RuntimeException() {
    1.54 +        super();
    1.55 +    }
    1.56 +
    1.57 +    /** Constructs a new runtime exception with the specified detail message.
    1.58 +     * The cause is not initialized, and may subsequently be initialized by a
    1.59 +     * call to {@link #initCause}.
    1.60 +     *
    1.61 +     * @param   message   the detail message. The detail message is saved for
    1.62 +     *          later retrieval by the {@link #getMessage()} method.
    1.63 +     */
    1.64 +    public RuntimeException(String message) {
    1.65 +        super(message);
    1.66 +    }
    1.67 +
    1.68 +    /**
    1.69 +     * Constructs a new runtime exception with the specified detail message and
    1.70 +     * cause.  <p>Note that the detail message associated with
    1.71 +     * {@code cause} is <i>not</i> automatically incorporated in
    1.72 +     * this runtime exception's detail message.
    1.73 +     *
    1.74 +     * @param  message the detail message (which is saved for later retrieval
    1.75 +     *         by the {@link #getMessage()} method).
    1.76 +     * @param  cause the cause (which is saved for later retrieval by the
    1.77 +     *         {@link #getCause()} method).  (A <tt>null</tt> value is
    1.78 +     *         permitted, and indicates that the cause is nonexistent or
    1.79 +     *         unknown.)
    1.80 +     * @since  1.4
    1.81 +     */
    1.82 +    public RuntimeException(String message, Throwable cause) {
    1.83 +        super(message, cause);
    1.84 +    }
    1.85 +
    1.86 +    /** Constructs a new runtime exception with the specified cause and a
    1.87 +     * detail message of <tt>(cause==null ? null : cause.toString())</tt>
    1.88 +     * (which typically contains the class and detail message of
    1.89 +     * <tt>cause</tt>).  This constructor is useful for runtime exceptions
    1.90 +     * that are little more than wrappers for other throwables.
    1.91 +     *
    1.92 +     * @param  cause the cause (which is saved for later retrieval by the
    1.93 +     *         {@link #getCause()} method).  (A <tt>null</tt> value is
    1.94 +     *         permitted, and indicates that the cause is nonexistent or
    1.95 +     *         unknown.)
    1.96 +     * @since  1.4
    1.97 +     */
    1.98 +    public RuntimeException(Throwable cause) {
    1.99 +        super(cause);
   1.100 +    }
   1.101 +
   1.102 +    /**
   1.103 +     * Constructs a new runtime exception with the specified detail
   1.104 +     * message, cause, suppression enabled or disabled, and writable
   1.105 +     * stack trace enabled or disabled.
   1.106 +     *
   1.107 +     * @param  message the detail message.
   1.108 +     * @param cause the cause.  (A {@code null} value is permitted,
   1.109 +     * and indicates that the cause is nonexistent or unknown.)
   1.110 +     * @param enableSuppression whether or not suppression is enabled
   1.111 +     *                          or disabled
   1.112 +     * @param writableStackTrace whether or not the stack trace should
   1.113 +     *                           be writable
   1.114 +     *
   1.115 +     * @since 1.7
   1.116 +     */
   1.117 +    protected RuntimeException(String message, Throwable cause,
   1.118 +                               boolean enableSuppression,
   1.119 +                               boolean writableStackTrace) {
   1.120 +        super(message, cause, enableSuppression, writableStackTrace);
   1.121 +    }
   1.122 +}