Introduce common ArithmeticException

Make divisionByZero test still fail in JS after introducing ArithmeticException
This commit is contained in:
Ilya Gorbunov
2018-08-09 23:39:17 +03:00
parent ceb909d261
commit 2df78fc81a
5 changed files with 30 additions and 9 deletions
@@ -88,6 +88,12 @@ public expect open class NoSuchElementException : RuntimeException {
constructor(message: String?)
}
@SinceKotlin("1.3")
public expect open class ArithmeticException : RuntimeException {
constructor()
constructor(message: String?)
}
@Deprecated("This exception type is not supposed to be thrown or caught in common code and will be removed from kotlin-stdlib-common soon.")
public expect open class NoWhenBranchMatchedException : RuntimeException {
constructor()
@@ -107,6 +107,10 @@ public actual open class NoSuchElementException actual constructor(message: Stri
actual constructor() : this(null)
}
@SinceKotlin("1.3")
public actual open class ArithmeticException actual constructor(message: String?) : RuntimeException(message) {
actual constructor() : this(null)
}
public actual open class NoWhenBranchMatchedException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {
actual constructor() : this(null, null)
@@ -16,6 +16,7 @@ package kotlin
@SinceKotlin("1.1") public actual typealias IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException
@SinceKotlin("1.1") public actual typealias UnsupportedOperationException = java.lang.UnsupportedOperationException
@SinceKotlin("1.3") public actual typealias ArithmeticException = java.lang.ArithmeticException
@SinceKotlin("1.1") public actual typealias NumberFormatException = java.lang.NumberFormatException
@SinceKotlin("1.1") public actual typealias NullPointerException = java.lang.NullPointerException
@SinceKotlin("1.1") public actual typealias ClassCastException = java.lang.ClassCastException
@@ -23,5 +24,4 @@ package kotlin
@SinceKotlin("1.1") public actual typealias NoSuchElementException = java.util.NoSuchElementException
@SinceKotlin("1.1") public actual typealias Comparator<T> = java.util.Comparator<T>
+1
View File
@@ -22,6 +22,7 @@ class ExceptionTest {
@Test fun nullPointerException() = testCreateException(::NullPointerException, ::NullPointerException)
@Test fun classCastException() = testCreateException(::ClassCastException, ::ClassCastException)
@Test fun noSuchElementException() = testCreateException(::NoSuchElementException, ::NoSuchElementException)
@Test fun arithmeticException() = testCreateException(::ArithmeticException, ::ArithmeticException)
@Test fun noWhenBranchMatchedException() = testCreateException(::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException)
@Test fun uninitializedPropertyAccessException() = testCreateException(::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException)