diff --git a/libraries/stdlib/src/kotlin/util/Standard.kt b/libraries/stdlib/src/kotlin/util/Standard.kt index 12bf682578e..7ad93e9418b 100644 --- a/libraries/stdlib/src/kotlin/util/Standard.kt +++ b/libraries/stdlib/src/kotlin/util/Standard.kt @@ -1,17 +1,21 @@ package kotlin - /** - * Always throws an [UnsupportedOperationException] stating that operation is not implemented. + * An exception is thrown to indicate that a method body remains to be implemented. */ -public fun TODO(): Nothing = throw UnsupportedOperationException("An operation is not implemented.") +public class NotImplementedError(message: String = "An operation is not implemented.") : Error(message) /** - * Always throws an [UnsupportedOperationException] stating that operation is not implemented. + * Always throws [NotImplementedError] stating that operation is not implemented. + */ +public fun TODO(): Nothing = throw NotImplementedError() + +/** + * Always throws [NotImplementedError] stating that operation is not implemented. * * @param reason a string explaining why the implementation is missing. */ -public fun TODO(reason: String): Nothing = throw UnsupportedOperationException("An operation is not implemented: $reason") +public fun TODO(reason: String): Nothing = throw NotImplementedError("An operation is not implemented: $reason") /** diff --git a/libraries/stdlib/test/utils/TODOTest.kt b/libraries/stdlib/test/utils/TODOTest.kt index 30c351d6b29..4dba42a87d5 100644 --- a/libraries/stdlib/test/utils/TODOTest.kt +++ b/libraries/stdlib/test/utils/TODOTest.kt @@ -27,12 +27,12 @@ private class PartiallyImplementedClass { class TODOTest { private fun assertNotImplemented(block: () -> Unit) { - assertTrue(fails(block) is UnsupportedOperationException) + assertTrue(fails(block) is NotImplementedError) } private fun assertNotImplementedWithMessage(message: String, block: () -> Unit) { val e = fails(block) - assertTrue(e is UnsupportedOperationException) + assertTrue(e is NotImplementedError) assertTrue(message in e!!.getMessage()!!) }