Update api-exception documentation

This commit is contained in:
2023-04-08 00:56:15 +08:00
parent f489313054
commit 099ece1e97
2 changed files with 0 additions and 97 deletions

View File

@@ -1075,55 +1075,6 @@ Please make sure you have loaded the `encase` method of `YukiHookAPI` in the cor
###### exception
::: danger RuntimeException
!!!DO NOT ALLOWED!!! You cannot hook or reflection to call the internal class of the YukiHookAPI itself, The called class is \[**CLASS**\]
:::
**Abnormal**
You have invoked the `Class` object of the API itself using `YukiHookAPI` related reflection or Hook function.
> The following example
```kotlin
// <Scenario 1>
YukiHookAPI.current()
// <Scenario 2>
PackageParam::class.java.hook {
// ...
}
// <Scenario 3>
MethodFinder::class.java.method {
name = "name"
param(StringClass)
}.get().call("name")
// ...
```
**Solution**
Please check the code section for errors, such as the case below.
> The following example
```kotlin
YourClass.method {
// ...
// ❗ The method execution is not called
// The actual method is called here is the MethodFinder.Result object
}.get(instance).current()
YourClass.method {
// ...
// ✅ The correct way to use it, assuming this method has no parameters
}.get(instance).call().current()
```
Inlining, reflection, Hook `YukiHookAPI`'s own `Class` and internal functions are not allowed to prevent errors.
###### exception
::: danger UnsupportedOperationException
!!!DANGEROUS!!! Hook \[**CLASS**\] Class is a dangerous behavior! \[**CONTENT**\] \[**SOLVE**\]

View File

@@ -1016,54 +1016,6 @@ YukiHookAPI cannot support current Hook API or cannot found any available Hook A
###### exception
::: danger RuntimeException
!!!DO NOT ALLOWED!!! You cannot hook or reflection to call the internal class of the YukiHookAPI itself, The called class is \[**CLASS**\]
:::
**异常原因**
你使用 `YukiHookAPI` 的相关反射或 Hook 功能调用了 API 自身的 `Class` 对象。
> 示例如下
```kotlin
// <情景1>
YukiHookAPI.current()
// <情景2>
PackageParam::class.java.hook {
// ...
}
// <情景3>
MethodFinder::class.java.method {
name = "name"
param(StringClass)
}.get().call("name")
// ...
```
**解决方案**
请检查代码部分是否有错误,例如下面的情况。
> 示例如下
```kotlin
YourClass.method {
// ...
// ❗ 没有调用方法执行,这里实际调用的是 MethodFinder.Result 对象
}.get(instance).current()
YourClass.method {
// ...
// ✅ 正确的使用方法,假设此方法无参
}.get(instance).call().current()
```
不允许内联、反射、Hook `YukiHookAPI` 自身的 `Class` 以及内部功能,防止发生错误。
###### exception
::: danger UnsupportedOperationException
!!!DANGEROUS!!! Hook \[**CLASS**\] Class is a dangerous behavior! \[**CONTENT**\] \[**SOLVE**\]