Commonize AssertionError(message, cause) constructor
This commit is contained in:
committed by
Space Team
parent
8e995e6c62
commit
c961c15729
@@ -131,7 +131,7 @@ public actual open class AssertionError : Error {
|
||||
|
||||
actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
|
||||
constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
}
|
||||
|
||||
@Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
|
||||
@@ -78,6 +78,9 @@ public expect open class ClassCastException : RuntimeException {
|
||||
public expect open class AssertionError : Error {
|
||||
constructor()
|
||||
constructor(message: Any?)
|
||||
|
||||
@SinceKotlin("1.9")
|
||||
constructor(message: String?, cause: Throwable?)
|
||||
}
|
||||
|
||||
public expect open class NoSuchElementException : RuntimeException {
|
||||
|
||||
@@ -81,7 +81,7 @@ public actual open class AssertionError : Error {
|
||||
public constructor(message: String?) : super(message)
|
||||
public actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
@SinceKotlin("1.4")
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
}
|
||||
|
||||
public actual open class NoSuchElementException : RuntimeException {
|
||||
|
||||
@@ -82,7 +82,7 @@ public actual open class ClassCastException actual constructor(message: String?)
|
||||
|
||||
public actual open class AssertionError
|
||||
@SinceKotlin("1.4")
|
||||
constructor(message: String?, cause: Throwable?) : Error(message, cause) {
|
||||
actual constructor(message: String?, cause: Throwable?) : Error(message, cause) {
|
||||
actual constructor() : this(null)
|
||||
constructor(message: String?) : this(message, null)
|
||||
actual constructor(message: Any?) : this(message.toString(), message as? Throwable)
|
||||
|
||||
@@ -20,6 +20,7 @@ package kotlin
|
||||
@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
|
||||
@Suppress("NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS")
|
||||
@SinceKotlin("1.1") public actual typealias AssertionError = java.lang.AssertionError
|
||||
|
||||
@SinceKotlin("1.1") public actual typealias NoSuchElementException = java.util.NoSuchElementException
|
||||
|
||||
@@ -29,7 +29,7 @@ class ExceptionTest {
|
||||
@Test fun noWhenBranchMatchedException() = @Suppress("DEPRECATION_ERROR") testCreateException(::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException, ::NoWhenBranchMatchedException)
|
||||
@Test fun uninitializedPropertyAccessException() = @Suppress("DEPRECATION_ERROR") testCreateException(::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException, ::UninitializedPropertyAccessException)
|
||||
|
||||
@Test fun assertionError() = testCreateException(::AssertionError, ::AssertionError, ::AssertionError)
|
||||
@Test fun assertionError() = testCreateException(::AssertionError, ::AssertionError, ::AssertionError, ::AssertionError)
|
||||
|
||||
|
||||
private fun <T : Throwable> testCreateException(
|
||||
|
||||
@@ -81,7 +81,7 @@ public actual open class AssertionError : Error {
|
||||
public constructor(message: String?) : super(message)
|
||||
public actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
@SinceKotlin("1.4")
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
}
|
||||
|
||||
public actual open class NoSuchElementException : RuntimeException {
|
||||
|
||||
Reference in New Issue
Block a user