emul/mini/src/main/java/java/lang/RuntimeException.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 26 Jan 2013 08:47:05 +0100
changeset 592 5e13b1ac2886
parent 52 94c1a17117f3
permissions -rw-r--r--
In order to support fields of the same name in subclasses we are now prefixing them with name of the class that defines them. To provide convenient way to access them from generated bytecode and also directly from JavaScript, there is a getter/setter function for each field. It starts with _ followed by the field name. If called with a parameter, it sets the field, with a parameter it just returns it.
jaroslav@52
     1
/*
jaroslav@52
     2
 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
jaroslav@52
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@52
     4
 *
jaroslav@52
     5
 * This code is free software; you can redistribute it and/or modify it
jaroslav@52
     6
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@52
     7
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@52
     8
 * particular file as subject to the "Classpath" exception as provided
jaroslav@52
     9
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@52
    10
 *
jaroslav@52
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@52
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@52
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@52
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@52
    15
 * accompanied this code).
jaroslav@52
    16
 *
jaroslav@52
    17
 * You should have received a copy of the GNU General Public License version
jaroslav@52
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@52
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@52
    20
 *
jaroslav@52
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@52
    22
 * or visit www.oracle.com if you need additional information or have any
jaroslav@52
    23
 * questions.
jaroslav@52
    24
 */
jaroslav@52
    25
jaroslav@52
    26
package java.lang;
jaroslav@52
    27
jaroslav@52
    28
/**
jaroslav@52
    29
 * {@code RuntimeException} is the superclass of those
jaroslav@52
    30
 * exceptions that can be thrown during the normal operation of the
jaroslav@52
    31
 * Java Virtual Machine.
jaroslav@52
    32
 *
jaroslav@52
    33
 * <p>{@code RuntimeException} and its subclasses are <em>unchecked
jaroslav@52
    34
 * exceptions</em>.  Unchecked exceptions do <em>not</em> need to be
jaroslav@52
    35
 * declared in a method or constructor's {@code throws} clause if they
jaroslav@52
    36
 * can be thrown by the execution of the method or constructor and
jaroslav@52
    37
 * propagate outside the method or constructor boundary.
jaroslav@52
    38
 *
jaroslav@52
    39
 * @author  Frank Yellin
jaroslav@52
    40
 * @jls 11.2 Compile-Time Checking of Exceptions
jaroslav@52
    41
 * @since   JDK1.0
jaroslav@52
    42
 */
jaroslav@52
    43
public class RuntimeException extends Exception {
jaroslav@52
    44
    static final long serialVersionUID = -7034897190745766939L;
jaroslav@52
    45
jaroslav@52
    46
    /** Constructs a new runtime exception with {@code null} as its
jaroslav@52
    47
     * detail message.  The cause is not initialized, and may subsequently be
jaroslav@52
    48
     * initialized by a call to {@link #initCause}.
jaroslav@52
    49
     */
jaroslav@52
    50
    public RuntimeException() {
jaroslav@52
    51
        super();
jaroslav@52
    52
    }
jaroslav@52
    53
jaroslav@52
    54
    /** Constructs a new runtime exception with the specified detail message.
jaroslav@52
    55
     * The cause is not initialized, and may subsequently be initialized by a
jaroslav@52
    56
     * call to {@link #initCause}.
jaroslav@52
    57
     *
jaroslav@52
    58
     * @param   message   the detail message. The detail message is saved for
jaroslav@52
    59
     *          later retrieval by the {@link #getMessage()} method.
jaroslav@52
    60
     */
jaroslav@52
    61
    public RuntimeException(String message) {
jaroslav@52
    62
        super(message);
jaroslav@52
    63
    }
jaroslav@52
    64
jaroslav@52
    65
    /**
jaroslav@52
    66
     * Constructs a new runtime exception with the specified detail message and
jaroslav@52
    67
     * cause.  <p>Note that the detail message associated with
jaroslav@52
    68
     * {@code cause} is <i>not</i> automatically incorporated in
jaroslav@52
    69
     * this runtime exception's detail message.
jaroslav@52
    70
     *
jaroslav@52
    71
     * @param  message the detail message (which is saved for later retrieval
jaroslav@52
    72
     *         by the {@link #getMessage()} method).
jaroslav@52
    73
     * @param  cause the cause (which is saved for later retrieval by the
jaroslav@52
    74
     *         {@link #getCause()} method).  (A <tt>null</tt> value is
jaroslav@52
    75
     *         permitted, and indicates that the cause is nonexistent or
jaroslav@52
    76
     *         unknown.)
jaroslav@52
    77
     * @since  1.4
jaroslav@52
    78
     */
jaroslav@52
    79
    public RuntimeException(String message, Throwable cause) {
jaroslav@52
    80
        super(message, cause);
jaroslav@52
    81
    }
jaroslav@52
    82
jaroslav@52
    83
    /** Constructs a new runtime exception with the specified cause and a
jaroslav@52
    84
     * detail message of <tt>(cause==null ? null : cause.toString())</tt>
jaroslav@52
    85
     * (which typically contains the class and detail message of
jaroslav@52
    86
     * <tt>cause</tt>).  This constructor is useful for runtime exceptions
jaroslav@52
    87
     * that are little more than wrappers for other throwables.
jaroslav@52
    88
     *
jaroslav@52
    89
     * @param  cause the cause (which is saved for later retrieval by the
jaroslav@52
    90
     *         {@link #getCause()} method).  (A <tt>null</tt> value is
jaroslav@52
    91
     *         permitted, and indicates that the cause is nonexistent or
jaroslav@52
    92
     *         unknown.)
jaroslav@52
    93
     * @since  1.4
jaroslav@52
    94
     */
jaroslav@52
    95
    public RuntimeException(Throwable cause) {
jaroslav@52
    96
        super(cause);
jaroslav@52
    97
    }
jaroslav@52
    98
jaroslav@52
    99
    /**
jaroslav@52
   100
     * Constructs a new runtime exception with the specified detail
jaroslav@52
   101
     * message, cause, suppression enabled or disabled, and writable
jaroslav@52
   102
     * stack trace enabled or disabled.
jaroslav@52
   103
     *
jaroslav@52
   104
     * @param  message the detail message.
jaroslav@52
   105
     * @param cause the cause.  (A {@code null} value is permitted,
jaroslav@52
   106
     * and indicates that the cause is nonexistent or unknown.)
jaroslav@52
   107
     * @param enableSuppression whether or not suppression is enabled
jaroslav@52
   108
     *                          or disabled
jaroslav@52
   109
     * @param writableStackTrace whether or not the stack trace should
jaroslav@52
   110
     *                           be writable
jaroslav@52
   111
     *
jaroslav@52
   112
     * @since 1.7
jaroslav@52
   113
     */
jaroslav@52
   114
    protected RuntimeException(String message, Throwable cause,
jaroslav@52
   115
                               boolean enableSuppression,
jaroslav@52
   116
                               boolean writableStackTrace) {
jaroslav@52
   117
        super(message, cause, enableSuppression, writableStackTrace);
jaroslav@52
   118
    }
jaroslav@52
   119
}