# HG changeset patch # User Jaroslav Tulach # Date 1349041005 25200 # Node ID 177ce4a56a6de1fadd074f4af795207c77c71a6e # Parent e4d7540b796aa33ededa5ad17527341c8a951afd AssertionError is necessary for NetBeans to recognize JDK 1.4 diff -r e4d7540b796a -r 177ce4a56a6d emul/src/main/java/java/lang/AssertionError.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emul/src/main/java/java/lang/AssertionError.java Sun Sep 30 14:36:45 2012 -0700 @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang; + +/** + * Thrown to indicate that an assertion has failed. + * + *

The seven one-argument public constructors provided by this + * class ensure that the assertion error returned by the invocation: + *

+ *     new AssertionError(expression)
+ * 
+ * has as its detail message the string conversion of + * expression (as defined in section 15.18.1.1 of + * The Java™ Language Specification), + * regardless of the type of expression. + * + * @since 1.4 + */ +public class AssertionError extends Error { + private static final long serialVersionUID = -5013299493970297370L; + + /** + * Constructs an AssertionError with no detail message. + */ + public AssertionError() { + } + + /** + * This internal constructor does no processing on its string argument, + * even if it is a null reference. The public constructors will + * never call this constructor with a null argument. + */ + private AssertionError(String detailMessage) { + super(detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified object, which is converted to a string as + * defined in section 15.18.1.1 of + * The Java™ Language Specification. + *

+ * If the specified object is an instance of {@code Throwable}, it + * becomes the cause of the newly constructed assertion error. + * + * @param detailMessage value to be used in constructing detail message + * @see Throwable#getCause() + */ + public AssertionError(Object detailMessage) { + this("" + detailMessage); + if (detailMessage instanceof Throwable) + initCause((Throwable) detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified boolean, which is converted to + * a string as defined in section 15.18.1.1 of + * The Java™ Language Specification. + * + * @param detailMessage value to be used in constructing detail message + */ + public AssertionError(boolean detailMessage) { + this("" + detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified char, which is converted to a + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. + * + * @param detailMessage value to be used in constructing detail message + */ + public AssertionError(char detailMessage) { + this("" + detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified int, which is converted to a + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. + * + * @param detailMessage value to be used in constructing detail message + */ + public AssertionError(int detailMessage) { + this("" + detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified long, which is converted to a + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. + * + * @param detailMessage value to be used in constructing detail message + */ + public AssertionError(long detailMessage) { + this("" + detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified float, which is converted to a + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. + * + * @param detailMessage value to be used in constructing detail message + */ + public AssertionError(float detailMessage) { + this("" + detailMessage); + } + + /** + * Constructs an AssertionError with its detail message derived + * from the specified double, which is converted to a + * string as defined in section 15.18.1.1 of + * The Java™ Language Specification. + * + * @param detailMessage value to be used in constructing detail message + */ + public AssertionError(double detailMessage) { + this("" + detailMessage); + } + + /** + * Constructs a new {@code AssertionError} with the specified + * detail message and cause. + * + *

Note that the detail message associated with + * {@code cause} is not automatically incorporated in + * this error's detail message. + * + * @param message the detail message, may be {@code null} + * @param cause the cause, may be {@code null} + * + * @since 1.7 + */ + public AssertionError(String message, Throwable cause) { + super(message, cause); + } +} diff -r e4d7540b796a -r 177ce4a56a6d emul/src/main/java/java/lang/Error.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emul/src/main/java/java/lang/Error.java Sun Sep 30 14:36:45 2012 -0700 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang; + +/** + * An {@code Error} is a subclass of {@code Throwable} + * that indicates serious problems that a reasonable application + * should not try to catch. Most such errors are abnormal conditions. + * The {@code ThreadDeath} error, though a "normal" condition, + * is also a subclass of {@code Error} because most applications + * should not try to catch it. + *

+ * A method is not required to declare in its {@code throws} + * clause any subclasses of {@code Error} that might be thrown + * during the execution of the method but not caught, since these + * errors are abnormal conditions that should never occur. + * + * That is, {@code Error} and its subclasses are regarded as unchecked + * exceptions for the purposes of compile-time checking of exceptions. + * + * @author Frank Yellin + * @see java.lang.ThreadDeath + * @jls 11.2 Compile-Time Checking of Exceptions + * @since JDK1.0 + */ +public class Error extends Throwable { + static final long serialVersionUID = 4980196508277280342L; + + /** + * Constructs a new error with {@code null} as its detail message. + * The cause is not initialized, and may subsequently be initialized by a + * call to {@link #initCause}. + */ + public Error() { + super(); + } + + /** + * Constructs a new error with the specified detail message. The + * cause is not initialized, and may subsequently be initialized by + * a call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public Error(String message) { + super(message); + } + + /** + * Constructs a new error with the specified detail message and + * cause.

Note that the detail message associated with + * {@code cause} is not automatically incorporated in + * this error's detail message. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public Error(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new error with the specified cause and a detail + * message of {@code (cause==null ? null : cause.toString())} (which + * typically contains the class and detail message of {@code cause}). + * This constructor is useful for errors that are little more than + * wrappers for other throwables. + * + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public Error(Throwable cause) { + super(cause); + } + + /** + * Constructs a new error with the specified detail message, + * cause, suppression enabled or disabled, and writable stack + * trace enabled or disabled. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled + * or disabled + * @param writableStackTrace whether or not the stack trace should + * be writable + * + * @since 1.7 + */ + protected Error(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff -r e4d7540b796a -r 177ce4a56a6d emul/src/main/java/java/lang/NullPointerException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emul/src/main/java/java/lang/NullPointerException.java Sun Sep 30 14:36:45 2012 -0700 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang; + +/** + * Thrown when an application attempts to use {@code null} in a + * case where an object is required. These include: + *

+ *

+ * Applications should throw instances of this class to indicate + * other illegal uses of the {@code null} object. + * + * {@code NullPointerException} objects may be constructed by the + * virtual machine as if {@linkplain Throwable#Throwable(String, + * Throwable, boolean, boolean) suppression were disabled and/or the + * stack trace was not writable}. + * + * @author unascribed + * @since JDK1.0 + */ +public +class NullPointerException extends RuntimeException { + private static final long serialVersionUID = 5162710183389028792L; + + /** + * Constructs a {@code NullPointerException} with no detail message. + */ + public NullPointerException() { + super(); + } + + /** + * Constructs a {@code NullPointerException} with the specified + * detail message. + * + * @param s the detail message. + */ + public NullPointerException(String s) { + super(s); + } +}