Verbose ClassCastException
This commit is contained in:
committed by
Sergey Bogolepov
parent
cd4f116f78
commit
6184685111
@@ -39,7 +39,7 @@ void RUNTIME_NORETURN ThrowNullPointerException();
|
||||
// Context is evaluated from caller's address.
|
||||
void RUNTIME_NORETURN ThrowArrayIndexOutOfBoundsException();
|
||||
// Throws class cast exception.
|
||||
void RUNTIME_NORETURN ThrowClassCastException();
|
||||
void RUNTIME_NORETURN ThrowClassCastException(const ObjHeader* instance, const TypeInfo* type_info);
|
||||
// Throws arithmetic exception.
|
||||
void RUNTIME_NORETURN ThrowArithmeticException();
|
||||
// Throws number format exception.
|
||||
|
||||
@@ -47,7 +47,7 @@ void CheckInstance(const ObjHeader* obj, const TypeInfo* type_info) {
|
||||
if (IsInstance(obj, type_info)) {
|
||||
return;
|
||||
}
|
||||
ThrowClassCastException();
|
||||
ThrowClassCastException(obj, type_info);
|
||||
}
|
||||
|
||||
KBoolean Kotlin_TypeInfo_isInstance(KConstRef obj, KNativePtr typeInfo) {
|
||||
|
||||
@@ -30,8 +30,9 @@ internal fun ThrowArrayIndexOutOfBoundsException(): Nothing {
|
||||
}
|
||||
|
||||
@ExportForCppRuntime
|
||||
fun ThrowClassCastException(): Nothing {
|
||||
throw ClassCastException()
|
||||
fun ThrowClassCastException(instance: Any, typeInfo: NativePtr): Nothing {
|
||||
val clazz = KClassImpl<Any>(typeInfo)
|
||||
throw ClassCastException("${instance::class.qualifiedName} cannot be cast to ${clazz.qualifiedName}")
|
||||
}
|
||||
|
||||
fun ThrowTypeCastException(): Nothing {
|
||||
|
||||
Reference in New Issue
Block a user