< prev index next >

src/java.base/share/classes/java/lang/AssertionError.java

Print this page




  24  */
  25 
  26 package java.lang;
  27 
  28 /**
  29  * Thrown to indicate that an assertion has failed.
  30  *
  31  * <p>The seven one-argument public constructors provided by this
  32  * class ensure that the assertion error returned by the invocation:
  33  * <pre>
  34  *     new AssertionError(<i>expression</i>)
  35  * </pre>
  36  * has as its detail message the <i>string conversion</i> of
  37  * <i>expression</i> (as defined in section 15.18.1.1 of
  38  * <cite>The Java&trade; Language Specification</cite>),
  39  * regardless of the type of <i>expression</i>.
  40  *
  41  * @since   1.4
  42  */
  43 public class AssertionError extends Error {

  44     private static final long serialVersionUID = -5013299493970297370L;
  45 
  46     /**
  47      * Constructs an AssertionError with no detail message.
  48      */
  49     public AssertionError() {
  50     }
  51 
  52     /**
  53      * This internal constructor does no processing on its string argument,
  54      * even if it is a null reference.  The public constructors will
  55      * never call this constructor with a null argument.
  56      */
  57     private AssertionError(String detailMessage) {
  58         super(detailMessage);
  59     }
  60 
  61     /**
  62      * Constructs an AssertionError with its detail message derived
  63      * from the specified object, which is converted to a string as




  24  */
  25 
  26 package java.lang;
  27 
  28 /**
  29  * Thrown to indicate that an assertion has failed.
  30  *
  31  * <p>The seven one-argument public constructors provided by this
  32  * class ensure that the assertion error returned by the invocation:
  33  * <pre>
  34  *     new AssertionError(<i>expression</i>)
  35  * </pre>
  36  * has as its detail message the <i>string conversion</i> of
  37  * <i>expression</i> (as defined in section 15.18.1.1 of
  38  * <cite>The Java&trade; Language Specification</cite>),
  39  * regardless of the type of <i>expression</i>.
  40  *
  41  * @since   1.4
  42  */
  43 public class AssertionError extends Error {
  44     @java.io.Serial
  45     private static final long serialVersionUID = -5013299493970297370L;
  46 
  47     /**
  48      * Constructs an AssertionError with no detail message.
  49      */
  50     public AssertionError() {
  51     }
  52 
  53     /**
  54      * This internal constructor does no processing on its string argument,
  55      * even if it is a null reference.  The public constructors will
  56      * never call this constructor with a null argument.
  57      */
  58     private AssertionError(String detailMessage) {
  59         super(detailMessage);
  60     }
  61 
  62     /**
  63      * Constructs an AssertionError with its detail message derived
  64      * from the specified object, which is converted to a string as


< prev index next >