diff --git a/runtime/src/main/cpp/Console.cpp b/runtime/src/main/cpp/Console.cpp index 8fd4df0588a..07b4eb4165b 100644 --- a/runtime/src/main/cpp/Console.cpp +++ b/runtime/src/main/cpp/Console.cpp @@ -19,6 +19,7 @@ #include "KString.h" #include "Porting.h" #include "Types.h" +#include "Exceptions.h" #include "utf8.h" @@ -26,7 +27,9 @@ extern "C" { // io/Console.kt void Kotlin_io_Console_print(KString message) { - RuntimeAssert(message->type_info() == theStringTypeInfo, "Must use a string"); + if (message->type_info() != theStringTypeInfo) { + ThrowClassCastException(message->obj(), theStringTypeInfo); + } // TODO: system stdout must be aware about UTF-8. const KChar* utf16 = CharArrayAddressOfElementAt(message, 0); KStdString utf8;