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

Print this page




  49      * Constructs an AssertionError with no detail message.
  50      */
  51     public AssertionError() {
  52     }
  53 
  54     /**
  55      * This internal constructor does no processing on its string argument,
  56      * even if it is a null reference.  The public constructors will
  57      * never call this constructor with a null argument.
  58      */
  59     private AssertionError(String detailMessage) {
  60         super(detailMessage);
  61     }
  62 
  63     /**
  64      * Constructs an AssertionError with its detail message derived
  65      * from the specified object, which is converted to a string as
  66      * defined in <i>The Java Language Specification, Second
  67      * Edition</i>, Section 15.18.1.1.
  68      *<p>
  69      * If the specified object is an instance of <tt>Throwable</tt>, it
  70      * becomes the <i>cause</i> of the newly constructed assertion error.
  71      *
  72      * @param detailMessage value to be used in constructing detail message
  73      * @see   Throwable#getCause()
  74      */
  75     public AssertionError(Object detailMessage) {
  76         this("" +  detailMessage);
  77         if (detailMessage instanceof Throwable)
  78             initCause((Throwable) detailMessage);
  79     }
  80 
  81     /**
  82      * Constructs an AssertionError with its detail message derived
  83      * from the specified <code>boolean</code>, which is converted to
  84      * a string as defined in <i>The Java Language Specification,
  85      * Second Edition</i>, Section 15.18.1.1.
  86      *
  87      * @param detailMessage value to be used in constructing detail message
  88      */
  89     public AssertionError(boolean detailMessage) {


 132      * string as defined in <i>The Java Language Specification, Second
 133      * Edition</i>, Section 15.18.1.1.
 134      *
 135      * @param detailMessage value to be used in constructing detail message
 136      */
 137     public AssertionError(float detailMessage) {
 138         this("" +  detailMessage);
 139     }
 140 
 141     /**
 142      * Constructs an AssertionError with its detail message derived
 143      * from the specified <code>double</code>, which is converted to a
 144      * string as defined in <i>The Java Language Specification, Second
 145      * Edition</i>, Section 15.18.1.1.
 146      *
 147      * @param detailMessage value to be used in constructing detail message
 148      */
 149     public AssertionError(double detailMessage) {
 150         this("" +  detailMessage);
 151     }

















 152 }


  49      * Constructs an AssertionError with no detail message.
  50      */
  51     public AssertionError() {
  52     }
  53 
  54     /**
  55      * This internal constructor does no processing on its string argument,
  56      * even if it is a null reference.  The public constructors will
  57      * never call this constructor with a null argument.
  58      */
  59     private AssertionError(String detailMessage) {
  60         super(detailMessage);
  61     }
  62 
  63     /**
  64      * Constructs an AssertionError with its detail message derived
  65      * from the specified object, which is converted to a string as
  66      * defined in <i>The Java Language Specification, Second
  67      * Edition</i>, Section 15.18.1.1.
  68      *<p>
  69      * If the specified object is an instance of {@code Throwable}, it
  70      * becomes the <i>cause</i> of the newly constructed assertion error.
  71      *
  72      * @param detailMessage value to be used in constructing detail message
  73      * @see   Throwable#getCause()
  74      */
  75     public AssertionError(Object detailMessage) {
  76         this("" +  detailMessage);
  77         if (detailMessage instanceof Throwable)
  78             initCause((Throwable) detailMessage);
  79     }
  80 
  81     /**
  82      * Constructs an AssertionError with its detail message derived
  83      * from the specified <code>boolean</code>, which is converted to
  84      * a string as defined in <i>The Java Language Specification,
  85      * Second Edition</i>, Section 15.18.1.1.
  86      *
  87      * @param detailMessage value to be used in constructing detail message
  88      */
  89     public AssertionError(boolean detailMessage) {


 132      * string as defined in <i>The Java Language Specification, Second
 133      * Edition</i>, Section 15.18.1.1.
 134      *
 135      * @param detailMessage value to be used in constructing detail message
 136      */
 137     public AssertionError(float detailMessage) {
 138         this("" +  detailMessage);
 139     }
 140 
 141     /**
 142      * Constructs an AssertionError with its detail message derived
 143      * from the specified <code>double</code>, which is converted to a
 144      * string as defined in <i>The Java Language Specification, Second
 145      * Edition</i>, Section 15.18.1.1.
 146      *
 147      * @param detailMessage value to be used in constructing detail message
 148      */
 149     public AssertionError(double detailMessage) {
 150         this("" +  detailMessage);
 151     }
 152 
 153     /**
 154      * Constructs a new {@code AssertionError} with the specified
 155      * detail message and cause.
 156      *
 157      * <p>Note that the detail message associated with
 158      * {@code cause} is <i>not</i> automatically incorporated in
 159      * this error's detail message.
 160      *
 161      * @param  message the detail message, may be {@code null}
 162      * @param  cause the cause, may be {@code null}
 163      *
 164      * @since 1.7
 165      */
 166     public AssertionError(String message, Throwable cause) {
 167         super(message, cause);
 168     }
 169 }