AssertionError is necessary for NetBeans to recognize JDK 1.4 jdk7-b147
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 30 Sep 2012 14:36:45 -0700
branchjdk7-b147
changeset 70177ce4a56a6d
parent 69 e4d7540b796a
child 71 54179e9c6a2f
child 76 3cfbb0d3bc82
AssertionError is necessary for NetBeans to recognize JDK 1.4
emul/src/main/java/java/lang/AssertionError.java
emul/src/main/java/java/lang/Error.java
emul/src/main/java/java/lang/NullPointerException.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/emul/src/main/java/java/lang/AssertionError.java	Sun Sep 30 14:36:45 2012 -0700
     1.3 @@ -0,0 +1,167 @@
     1.4 +/*
     1.5 + * Copyright (c) 2000, 2010, 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 + * Thrown to indicate that an assertion has failed.
    1.33 + *
    1.34 + * <p>The seven one-argument public constructors provided by this
    1.35 + * class ensure that the assertion error returned by the invocation:
    1.36 + * <pre>
    1.37 + *     new AssertionError(<i>expression</i>)
    1.38 + * </pre>
    1.39 + * has as its detail message the <i>string conversion</i> of
    1.40 + * <i>expression</i> (as defined in section 15.18.1.1 of
    1.41 + * <cite>The Java&trade; Language Specification</cite>),
    1.42 + * regardless of the type of <i>expression</i>.
    1.43 + *
    1.44 + * @since   1.4
    1.45 + */
    1.46 +public class AssertionError extends Error {
    1.47 +    private static final long serialVersionUID = -5013299493970297370L;
    1.48 +
    1.49 +    /**
    1.50 +     * Constructs an AssertionError with no detail message.
    1.51 +     */
    1.52 +    public AssertionError() {
    1.53 +    }
    1.54 +
    1.55 +    /**
    1.56 +     * This internal constructor does no processing on its string argument,
    1.57 +     * even if it is a null reference.  The public constructors will
    1.58 +     * never call this constructor with a null argument.
    1.59 +     */
    1.60 +    private AssertionError(String detailMessage) {
    1.61 +        super(detailMessage);
    1.62 +    }
    1.63 +
    1.64 +    /**
    1.65 +     * Constructs an AssertionError with its detail message derived
    1.66 +     * from the specified object, which is converted to a string as
    1.67 +     * defined in section 15.18.1.1 of
    1.68 +     * <cite>The Java&trade; Language Specification</cite>.
    1.69 +     *<p>
    1.70 +     * If the specified object is an instance of {@code Throwable}, it
    1.71 +     * becomes the <i>cause</i> of the newly constructed assertion error.
    1.72 +     *
    1.73 +     * @param detailMessage value to be used in constructing detail message
    1.74 +     * @see   Throwable#getCause()
    1.75 +     */
    1.76 +    public AssertionError(Object detailMessage) {
    1.77 +        this("" +  detailMessage);
    1.78 +        if (detailMessage instanceof Throwable)
    1.79 +            initCause((Throwable) detailMessage);
    1.80 +    }
    1.81 +
    1.82 +    /**
    1.83 +     * Constructs an AssertionError with its detail message derived
    1.84 +     * from the specified <code>boolean</code>, which is converted to
    1.85 +     * a string as defined in section 15.18.1.1 of
    1.86 +     * <cite>The Java&trade; Language Specification</cite>.
    1.87 +     *
    1.88 +     * @param detailMessage value to be used in constructing detail message
    1.89 +     */
    1.90 +    public AssertionError(boolean detailMessage) {
    1.91 +        this("" +  detailMessage);
    1.92 +    }
    1.93 +
    1.94 +    /**
    1.95 +     * Constructs an AssertionError with its detail message derived
    1.96 +     * from the specified <code>char</code>, which is converted to a
    1.97 +     * string as defined in section 15.18.1.1 of
    1.98 +     * <cite>The Java&trade; Language Specification</cite>.
    1.99 +     *
   1.100 +     * @param detailMessage value to be used in constructing detail message
   1.101 +     */
   1.102 +    public AssertionError(char detailMessage) {
   1.103 +        this("" +  detailMessage);
   1.104 +    }
   1.105 +
   1.106 +    /**
   1.107 +     * Constructs an AssertionError with its detail message derived
   1.108 +     * from the specified <code>int</code>, which is converted to a
   1.109 +     * string as defined in section 15.18.1.1 of
   1.110 +     * <cite>The Java&trade; Language Specification</cite>.
   1.111 +     *
   1.112 +     * @param detailMessage value to be used in constructing detail message
   1.113 +     */
   1.114 +    public AssertionError(int detailMessage) {
   1.115 +        this("" +  detailMessage);
   1.116 +    }
   1.117 +
   1.118 +    /**
   1.119 +     * Constructs an AssertionError with its detail message derived
   1.120 +     * from the specified <code>long</code>, which is converted to a
   1.121 +     * string as defined in section 15.18.1.1 of
   1.122 +     * <cite>The Java&trade; Language Specification</cite>.
   1.123 +     *
   1.124 +     * @param detailMessage value to be used in constructing detail message
   1.125 +     */
   1.126 +    public AssertionError(long detailMessage) {
   1.127 +        this("" +  detailMessage);
   1.128 +    }
   1.129 +
   1.130 +    /**
   1.131 +     * Constructs an AssertionError with its detail message derived
   1.132 +     * from the specified <code>float</code>, which is converted to a
   1.133 +     * string as defined in section 15.18.1.1 of
   1.134 +     * <cite>The Java&trade; Language Specification</cite>.
   1.135 +     *
   1.136 +     * @param detailMessage value to be used in constructing detail message
   1.137 +     */
   1.138 +    public AssertionError(float detailMessage) {
   1.139 +        this("" +  detailMessage);
   1.140 +    }
   1.141 +
   1.142 +    /**
   1.143 +     * Constructs an AssertionError with its detail message derived
   1.144 +     * from the specified <code>double</code>, which is converted to a
   1.145 +     * string as defined in section 15.18.1.1 of
   1.146 +     * <cite>The Java&trade; Language Specification</cite>.
   1.147 +     *
   1.148 +     * @param detailMessage value to be used in constructing detail message
   1.149 +     */
   1.150 +    public AssertionError(double detailMessage) {
   1.151 +        this("" +  detailMessage);
   1.152 +    }
   1.153 +
   1.154 +    /**
   1.155 +     * Constructs a new {@code AssertionError} with the specified
   1.156 +     * detail message and cause.
   1.157 +     *
   1.158 +     * <p>Note that the detail message associated with
   1.159 +     * {@code cause} is <i>not</i> automatically incorporated in
   1.160 +     * this error's detail message.
   1.161 +     *
   1.162 +     * @param  message the detail message, may be {@code null}
   1.163 +     * @param  cause the cause, may be {@code null}
   1.164 +     *
   1.165 +     * @since 1.7
   1.166 +     */
   1.167 +    public AssertionError(String message, Throwable cause) {
   1.168 +        super(message, cause);
   1.169 +    }
   1.170 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/emul/src/main/java/java/lang/Error.java	Sun Sep 30 14:36:45 2012 -0700
     2.3 @@ -0,0 +1,128 @@
     2.4 +/*
     2.5 + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package java.lang;
    2.30 +
    2.31 +/**
    2.32 + * An {@code Error} is a subclass of {@code Throwable}
    2.33 + * that indicates serious problems that a reasonable application
    2.34 + * should not try to catch. Most such errors are abnormal conditions.
    2.35 + * The {@code ThreadDeath} error, though a "normal" condition,
    2.36 + * is also a subclass of {@code Error} because most applications
    2.37 + * should not try to catch it.
    2.38 + * <p>
    2.39 + * A method is not required to declare in its {@code throws}
    2.40 + * clause any subclasses of {@code Error} that might be thrown
    2.41 + * during the execution of the method but not caught, since these
    2.42 + * errors are abnormal conditions that should never occur.
    2.43 + *
    2.44 + * That is, {@code Error} and its subclasses are regarded as unchecked
    2.45 + * exceptions for the purposes of compile-time checking of exceptions.
    2.46 + *
    2.47 + * @author  Frank Yellin
    2.48 + * @see     java.lang.ThreadDeath
    2.49 + * @jls 11.2 Compile-Time Checking of Exceptions
    2.50 + * @since   JDK1.0
    2.51 + */
    2.52 +public class Error extends Throwable {
    2.53 +    static final long serialVersionUID = 4980196508277280342L;
    2.54 +
    2.55 +    /**
    2.56 +     * Constructs a new error with {@code null} as its detail message.
    2.57 +     * The cause is not initialized, and may subsequently be initialized by a
    2.58 +     * call to {@link #initCause}.
    2.59 +     */
    2.60 +    public Error() {
    2.61 +        super();
    2.62 +    }
    2.63 +
    2.64 +    /**
    2.65 +     * Constructs a new error with the specified detail message.  The
    2.66 +     * cause is not initialized, and may subsequently be initialized by
    2.67 +     * a call to {@link #initCause}.
    2.68 +     *
    2.69 +     * @param   message   the detail message. The detail message is saved for
    2.70 +     *          later retrieval by the {@link #getMessage()} method.
    2.71 +     */
    2.72 +    public Error(String message) {
    2.73 +        super(message);
    2.74 +    }
    2.75 +
    2.76 +    /**
    2.77 +     * Constructs a new error with the specified detail message and
    2.78 +     * cause.  <p>Note that the detail message associated with
    2.79 +     * {@code cause} is <i>not</i> automatically incorporated in
    2.80 +     * this error's detail message.
    2.81 +     *
    2.82 +     * @param  message the detail message (which is saved for later retrieval
    2.83 +     *         by the {@link #getMessage()} method).
    2.84 +     * @param  cause the cause (which is saved for later retrieval by the
    2.85 +     *         {@link #getCause()} method).  (A {@code null} value is
    2.86 +     *         permitted, and indicates that the cause is nonexistent or
    2.87 +     *         unknown.)
    2.88 +     * @since  1.4
    2.89 +     */
    2.90 +    public Error(String message, Throwable cause) {
    2.91 +        super(message, cause);
    2.92 +    }
    2.93 +
    2.94 +    /**
    2.95 +     * Constructs a new error with the specified cause and a detail
    2.96 +     * message of {@code (cause==null ? null : cause.toString())} (which
    2.97 +     * typically contains the class and detail message of {@code cause}).
    2.98 +     * This constructor is useful for errors that are little more than
    2.99 +     * wrappers for other throwables.
   2.100 +     *
   2.101 +     * @param  cause the cause (which is saved for later retrieval by the
   2.102 +     *         {@link #getCause()} method).  (A {@code null} value is
   2.103 +     *         permitted, and indicates that the cause is nonexistent or
   2.104 +     *         unknown.)
   2.105 +     * @since  1.4
   2.106 +     */
   2.107 +    public Error(Throwable cause) {
   2.108 +        super(cause);
   2.109 +    }
   2.110 +
   2.111 +    /**
   2.112 +     * Constructs a new error with the specified detail message,
   2.113 +     * cause, suppression enabled or disabled, and writable stack
   2.114 +     * trace enabled or disabled.
   2.115 +     *
   2.116 +     * @param  message the detail message.
   2.117 +     * @param cause the cause.  (A {@code null} value is permitted,
   2.118 +     * and indicates that the cause is nonexistent or unknown.)
   2.119 +     * @param enableSuppression whether or not suppression is enabled
   2.120 +     *                          or disabled
   2.121 +     * @param writableStackTrace whether or not the stack trace should
   2.122 +     *                           be writable
   2.123 +     *
   2.124 +     * @since 1.7
   2.125 +     */
   2.126 +    protected Error(String message, Throwable cause,
   2.127 +                    boolean enableSuppression,
   2.128 +                    boolean writableStackTrace) {
   2.129 +        super(message, cause, enableSuppression, writableStackTrace);
   2.130 +    }
   2.131 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/emul/src/main/java/java/lang/NullPointerException.java	Sun Sep 30 14:36:45 2012 -0700
     3.3 @@ -0,0 +1,72 @@
     3.4 +/*
     3.5 + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.  Oracle designates this
    3.11 + * particular file as subject to the "Classpath" exception as provided
    3.12 + * by Oracle in the LICENSE file that accompanied this code.
    3.13 + *
    3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.17 + * version 2 for more details (a copy is included in the LICENSE file that
    3.18 + * accompanied this code).
    3.19 + *
    3.20 + * You should have received a copy of the GNU General Public License version
    3.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.23 + *
    3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.25 + * or visit www.oracle.com if you need additional information or have any
    3.26 + * questions.
    3.27 + */
    3.28 +
    3.29 +package java.lang;
    3.30 +
    3.31 +/**
    3.32 + * Thrown when an application attempts to use {@code null} in a
    3.33 + * case where an object is required. These include:
    3.34 + * <ul>
    3.35 + * <li>Calling the instance method of a {@code null} object.
    3.36 + * <li>Accessing or modifying the field of a {@code null} object.
    3.37 + * <li>Taking the length of {@code null} as if it were an array.
    3.38 + * <li>Accessing or modifying the slots of {@code null} as if it
    3.39 + *     were an array.
    3.40 + * <li>Throwing {@code null} as if it were a {@code Throwable}
    3.41 + *     value.
    3.42 + * </ul>
    3.43 + * <p>
    3.44 + * Applications should throw instances of this class to indicate
    3.45 + * other illegal uses of the {@code null} object.
    3.46 + *
    3.47 + * {@code NullPointerException} objects may be constructed by the
    3.48 + * virtual machine as if {@linkplain Throwable#Throwable(String,
    3.49 + * Throwable, boolean, boolean) suppression were disabled and/or the
    3.50 + * stack trace was not writable}.
    3.51 + *
    3.52 + * @author  unascribed
    3.53 + * @since   JDK1.0
    3.54 + */
    3.55 +public
    3.56 +class NullPointerException extends RuntimeException {
    3.57 +    private static final long serialVersionUID = 5162710183389028792L;
    3.58 +
    3.59 +    /**
    3.60 +     * Constructs a {@code NullPointerException} with no detail message.
    3.61 +     */
    3.62 +    public NullPointerException() {
    3.63 +        super();
    3.64 +    }
    3.65 +
    3.66 +    /**
    3.67 +     * Constructs a {@code NullPointerException} with the specified
    3.68 +     * detail message.
    3.69 +     *
    3.70 +     * @param   s   the detail message.
    3.71 +     */
    3.72 +    public NullPointerException(String s) {
    3.73 +        super(s);
    3.74 +    }
    3.75 +}