diff --git a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt index 985a59b67b9..4066932e358 100644 --- a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt +++ b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt @@ -7,7 +7,7 @@ fun ThrowNullPointerException(): Nothing { @ExportForCppRuntime internal fun ThrowArrayIndexOutOfBoundsException(): Nothing { - throw IndexOutOfBoundsException() + throw ArrayIndexOutOfBoundsException() } @ExportForCppRuntime diff --git a/runtime/src/main/kotlin/kotlin/Exceptions.kt b/runtime/src/main/kotlin/kotlin/Exceptions.kt index d6657db7606..789b118e55b 100644 --- a/runtime/src/main/kotlin/kotlin/Exceptions.kt +++ b/runtime/src/main/kotlin/kotlin/Exceptions.kt @@ -54,7 +54,7 @@ public class NullPointerException : RuntimeException { } } -public class NoSuchElementException : RuntimeException { +public open class NoSuchElementException : RuntimeException { constructor() : super() { } @@ -63,7 +63,7 @@ public class NoSuchElementException : RuntimeException { } } -public class IllegalArgumentException : RuntimeException { +public open class IllegalArgumentException : RuntimeException { constructor() : super() { } @@ -78,7 +78,7 @@ public class IllegalArgumentException : RuntimeException { } } -public class IllegalStateException : RuntimeException { +public open class IllegalStateException : RuntimeException { constructor() : super() { } @@ -93,7 +93,7 @@ public class IllegalStateException : RuntimeException { } } -public class UnsupportedOperationException : RuntimeException { +public open class UnsupportedOperationException : RuntimeException { constructor() { } @@ -108,7 +108,7 @@ public class UnsupportedOperationException : RuntimeException { } } -public class IndexOutOfBoundsException : RuntimeException { +public open class IndexOutOfBoundsException : RuntimeException { constructor() : super() { } @@ -117,7 +117,7 @@ public class IndexOutOfBoundsException : RuntimeException { } } -public class ClassCastException : RuntimeException { +public open class ArrayIndexOutOfBoundsException : IndexOutOfBoundsException { constructor() : super() { } @@ -126,7 +126,8 @@ public class ClassCastException : RuntimeException { } } -public class ArithmeticException : RuntimeException { +public open class ClassCastException : RuntimeException { + constructor() : super() { } @@ -134,7 +135,24 @@ public class ArithmeticException : RuntimeException { } } -public class AssertionError : Error { +public open class TypeCastException : ClassCastException { + + constructor() : super() { + } + + constructor(s: String) : super(s) { + } +} + +public open class ArithmeticException : RuntimeException { + constructor() : super() { + } + + constructor(s: String) : super(s) { + } +} + +public open class AssertionError : Error { constructor() { } @@ -149,7 +167,7 @@ public class AssertionError : Error { } } -public class NoWhenBranchMatchedException : RuntimeException { +public open class NoWhenBranchMatchedException : RuntimeException { constructor() : super() { } @@ -158,7 +176,7 @@ public class NoWhenBranchMatchedException : RuntimeException { } } -public class OutOfMemoryError : Error { +public open class OutOfMemoryError : Error { constructor() : super() { }