Update api-exception documentation

This commit is contained in:
2023-01-05 19:09:50 +08:00
parent 3c76dbdd36
commit db1d15a621
2 changed files with 8 additions and 4 deletions

View File

@@ -1947,7 +1947,9 @@ Target Class type cannot cast to **TYPE**
**Abnormal**
Wrong type declared when converting a string class name to the target `Class` using the `toClass` method.
Wrong type declared when converting string class name to target `Class` using `Class.toClass`, `Class.toClassOrNull`, `GenericClass.argument` methods.
The following uses the `Class.toClass` method as an example.
> The following example
@@ -1967,4 +1969,4 @@ val clazz1 = "android.app.Activity".toClass<Activity>()
val clazz2 = "android.app.Activity".toClass()
```
Please ensure that the generic type declared after the `toClass` method is the specified target `Class` type, and you do not need to fill in the generic declaration if the target type is not sure.
Please ensure that the generic type declared after executing the method is the specified target `Class` type, and you do not need to fill in the generic declaration if the target type is not sure.

View File

@@ -1876,7 +1876,9 @@ Target Class type cannot cast to **TYPE**
**异常原因**
使用 `toClass` 方法将字符串类名转换为目标 `Class` 时声明了错误的类型。
使用 `Class.toClass``Class.toClassOrNull``GenericClass.argument` 方法将字符串类名转换为目标 `Class` 时声明了错误的类型。
以下使用 `Class.toClass` 方法来进行示例。
> 示例如下
@@ -1896,4 +1898,4 @@ val clazz1 = "android.app.Activity".toClass<Activity>()
val clazz2 = "android.app.Activity".toClass()
```
请确保 `toClass` 方法后声明的泛型是指定的目标 `Class` 类型,在不确定目标类型的情况下你可以不需要填写泛型声明。
请确保执行方法后声明的泛型是指定的目标 `Class` 类型,在不确定目标类型的情况下你可以不需要填写泛型声明。