Exception.hx 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package java.lang;
  2. /*
  3. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
  4. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. *
  6. * This code is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 only, as
  8. * published by the Free Software Foundation. Oracle designates this
  9. * particular file as subject to the "Classpath" exception as provided
  10. * by Oracle in the LICENSE file that accompanied this code.
  11. *
  12. * This code is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15. * version 2 for more details (a copy is included in the LICENSE file that
  16. * accompanied this code).
  17. *
  18. * You should have received a copy of the GNU General Public License version
  19. * 2 along with this work; if not, write to the Free Software Foundation,
  20. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21. *
  22. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23. * or visit www.oracle.com if you need additional information or have any
  24. * questions.
  25. */
  26. /**
  27. * The class {@code Exception} and its subclasses are a form of
  28. * {@code Throwable} that indicates conditions that a reasonable
  29. * application might want to catch.
  30. *
  31. * <p>The class {@code Exception} and any subclasses that are not also
  32. * subclasses of {@link RuntimeException} are <em>checked
  33. * exceptions</em>. Checked exceptions need to be declared in a
  34. * method or constructor's {@code throws} clause if they can be thrown
  35. * by the execution of the method or constructor and propagate outside
  36. * the method or constructor boundary.
  37. *
  38. * @author Frank Yellin
  39. * @see java.lang.Error
  40. * @jls 11.2 Compile-Time Checking of Exceptions
  41. * @since JDK1.0
  42. */
  43. @:require(java0) extern class Exception extends java.lang.Throwable
  44. {
  45. /**
  46. * Constructs a new exception with {@code null} as its detail message.
  47. * The cause is not initialized, and may subsequently be initialized by a
  48. * call to {@link #initCause}.
  49. */
  50. @:overload public function new() : Void;
  51. /**
  52. * Constructs a new exception with the specified detail message. The
  53. * cause is not initialized, and may subsequently be initialized by
  54. * a call to {@link #initCause}.
  55. *
  56. * @param message the detail message. The detail message is saved for
  57. * later retrieval by the {@link #getMessage()} method.
  58. */
  59. @:overload public function new(message : String) : Void;
  60. /**
  61. * Constructs a new exception with the specified detail message and
  62. * cause. <p>Note that the detail message associated with
  63. * {@code cause} is <i>not</i> automatically incorporated in
  64. * this exception's detail message.
  65. *
  66. * @param message the detail message (which is saved for later retrieval
  67. * by the {@link #getMessage()} method).
  68. * @param cause the cause (which is saved for later retrieval by the
  69. * {@link #getCause()} method). (A <tt>null</tt> value is
  70. * permitted, and indicates that the cause is nonexistent or
  71. * unknown.)
  72. * @since 1.4
  73. */
  74. @:require(java4) @:overload public function new(message : String, cause : java.lang.Throwable) : Void;
  75. /**
  76. * Constructs a new exception with the specified cause and a detail
  77. * message of <tt>(cause==null ? null : cause.toString())</tt> (which
  78. * typically contains the class and detail message of <tt>cause</tt>).
  79. * This constructor is useful for exceptions that are little more than
  80. * wrappers for other throwables (for example, {@link
  81. * java.security.PrivilegedActionException}).
  82. *
  83. * @param cause the cause (which is saved for later retrieval by the
  84. * {@link #getCause()} method). (A <tt>null</tt> value is
  85. * permitted, and indicates that the cause is nonexistent or
  86. * unknown.)
  87. * @since 1.4
  88. */
  89. @:require(java4) @:overload public function new(cause : java.lang.Throwable) : Void;
  90. /**
  91. * Constructs a new exception with the specified detail message,
  92. * cause, suppression enabled or disabled, and writable stack
  93. * trace enabled or disabled.
  94. *
  95. * @param message the detail message.
  96. * @param cause the cause. (A {@code null} value is permitted,
  97. * and indicates that the cause is nonexistent or unknown.)
  98. * @param enableSuppression whether or not suppression is enabled
  99. * or disabled
  100. * @param writableStackTrace whether or not the stack trace should
  101. * be writable
  102. * @since 1.7
  103. */
  104. @:require(java7) @:overload private function new(message : String, cause : java.lang.Throwable, enableSuppression : Bool, writableStackTrace : Bool) : Void;
  105. }