0N/A/*
3261N/A * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.lang;
0N/A
0N/A/**
0N/A * Thrown to indicate that an assertion has failed.
0N/A *
0N/A * <p>The seven one-argument public constructors provided by this
0N/A * class ensure that the assertion error returned by the invocation:
0N/A * <pre>
0N/A * new AssertionError(<i>expression</i>)
0N/A * </pre>
0N/A * has as its detail message the <i>string conversion</i> of
4008N/A * <i>expression</i> (as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>),
4008N/A * regardless of the type of <i>expression</i>.
0N/A *
0N/A * @since 1.4
0N/A */
0N/Apublic class AssertionError extends Error {
644N/A private static final long serialVersionUID = -5013299493970297370L;
644N/A
0N/A /**
0N/A * Constructs an AssertionError with no detail message.
0N/A */
0N/A public AssertionError() {
0N/A }
0N/A
0N/A /**
0N/A * This internal constructor does no processing on its string argument,
0N/A * even if it is a null reference. The public constructors will
0N/A * never call this constructor with a null argument.
0N/A */
0N/A private AssertionError(String detailMessage) {
0N/A super(detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified object, which is converted to a string as
4008N/A * defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *<p>
2463N/A * If the specified object is an instance of {@code Throwable}, it
0N/A * becomes the <i>cause</i> of the newly constructed assertion error.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A * @see Throwable#getCause()
0N/A */
0N/A public AssertionError(Object detailMessage) {
0N/A this("" + detailMessage);
0N/A if (detailMessage instanceof Throwable)
0N/A initCause((Throwable) detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified <code>boolean</code>, which is converted to
4008N/A * a string as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A */
0N/A public AssertionError(boolean detailMessage) {
0N/A this("" + detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified <code>char</code>, which is converted to a
4008N/A * string as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A */
0N/A public AssertionError(char detailMessage) {
0N/A this("" + detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified <code>int</code>, which is converted to a
4008N/A * string as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A */
0N/A public AssertionError(int detailMessage) {
0N/A this("" + detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified <code>long</code>, which is converted to a
4008N/A * string as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A */
0N/A public AssertionError(long detailMessage) {
0N/A this("" + detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified <code>float</code>, which is converted to a
4008N/A * string as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A */
0N/A public AssertionError(float detailMessage) {
0N/A this("" + detailMessage);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an AssertionError with its detail message derived
0N/A * from the specified <code>double</code>, which is converted to a
4008N/A * string as defined in section 15.18.1.1 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
0N/A *
0N/A * @param detailMessage value to be used in constructing detail message
0N/A */
0N/A public AssertionError(double detailMessage) {
0N/A this("" + detailMessage);
0N/A }
2463N/A
2463N/A /**
2463N/A * Constructs a new {@code AssertionError} with the specified
2463N/A * detail message and cause.
2463N/A *
2463N/A * <p>Note that the detail message associated with
2463N/A * {@code cause} is <i>not</i> automatically incorporated in
2463N/A * this error's detail message.
2463N/A *
2463N/A * @param message the detail message, may be {@code null}
2463N/A * @param cause the cause, may be {@code null}
2463N/A *
2463N/A * @since 1.7
2463N/A */
2463N/A public AssertionError(String message, Throwable cause) {
2463N/A super(message, cause);
2463N/A }
0N/A}