mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-01 08:15:37 +08:00
docs: update api-exception, example
This commit is contained in:
@@ -1080,48 +1080,6 @@ Please make sure you have loaded the `encase` method of `YukiHookAPI` in the cor
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger UnsupportedOperationException
|
||||
|
||||
!!!DANGEROUS!!! Hook \[**CLASS**\] Class is a dangerous behavior! \[**CONTENT**\] \[**SOLVE**\]
|
||||
|
||||
:::
|
||||
|
||||
**Abnormal**
|
||||
|
||||
You tried to hook a `Class` object in the list of dangerous behaviors, such as `Class`, `ClassLoader`, `Method`.
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
// <Scenario 1>
|
||||
JavaClassLoader.hook {
|
||||
// ...
|
||||
}
|
||||
// <Scenario 2>
|
||||
JavaClass.hook {
|
||||
// ...
|
||||
}
|
||||
// <Scenario 3>
|
||||
JavaMethod.hook {
|
||||
// ...
|
||||
}
|
||||
// ...
|
||||
```
|
||||
|
||||
**Solution**
|
||||
|
||||
These functions are internal to the system, <u>**they should not be hooked, may not be supported on some Hook Frameworks, and may cause other errors**</u>, please try to replace the hook point.
|
||||
|
||||
::: tip
|
||||
|
||||
If you still want to use this feature, please refer to [YukiMemberHookCreator.useDangerousOperation](../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#usedangerousoperation-method) method.
|
||||
|
||||
But **It is strongly recommended not to do this, please do not report any problems, <u>all the consequences will be borne by yourself</u>**.
|
||||
|
||||
:::
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger NoClassDefFoundError
|
||||
|
||||
Can't find this Class in \[**CLASSLOADER**\]: **CONTENT** Generated by YukiHookAPI#ReflectionTool
|
||||
@@ -1847,22 +1805,6 @@ For details, please refer to [Status Monitor](../guide/example#status-monitor).
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
This hook instance is create by Members, not support any hook class instance
|
||||
|
||||
:::
|
||||
|
||||
**Abnormal**
|
||||
|
||||
Hook instance is created using `Member.hook { ... }` instead of `Class.hook { ... }` and uses `instanceClass`.
|
||||
|
||||
**Solution**
|
||||
|
||||
You can only use `instanceClass` if you created a Hook instance using `Class.hook { ... }`.
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
Use of searchClass { ... }.hook { ... } is an error, please use like searchClass { ... }.get()?.hook { ... }
|
||||
|
||||
:::
|
||||
|
@@ -50,10 +50,10 @@ TargetClass.hook {
|
||||
method {
|
||||
// Your code here.
|
||||
}
|
||||
before {
|
||||
beforeHook {
|
||||
// Your code here.
|
||||
}
|
||||
after {
|
||||
afterHook {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
@@ -463,7 +463,7 @@ injectMember {
|
||||
method {
|
||||
throw RuntimeException("Exception Test")
|
||||
}
|
||||
after {
|
||||
afterHook {
|
||||
// ...
|
||||
}
|
||||
}.result {
|
||||
@@ -475,7 +475,7 @@ injectMember {
|
||||
method {
|
||||
// ...
|
||||
}
|
||||
after {
|
||||
afterHook {
|
||||
throw RuntimeException("Exception Test")
|
||||
}
|
||||
}.result {
|
||||
|
@@ -1017,48 +1017,6 @@ YukiHookAPI cannot support current Hook API or cannot found any available Hook A
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger UnsupportedOperationException
|
||||
|
||||
!!!DANGEROUS!!! Hook \[**CLASS**\] Class is a dangerous behavior! \[**CONTENT**\] \[**SOLVE**\]
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
你尝试 Hook 了处于危险行为列表中的 `Class` 对象,例如 `Class`、`ClassLoader`、`Method`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// <情景1>
|
||||
JavaClassLoader.hook {
|
||||
// ...
|
||||
}
|
||||
// <情景2>
|
||||
JavaClass.hook {
|
||||
// ...
|
||||
}
|
||||
// <情景3>
|
||||
JavaMethod.hook {
|
||||
// ...
|
||||
}
|
||||
// ...
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
这些功能是系统内部的,<u>**它们不应该被 Hook,在部分 Hook Framework 上可能不被支持,还会引发其它错误**</u>,请尝试更换 Hook 点。
|
||||
|
||||
::: tip
|
||||
|
||||
若你仍要使用此功能,请参考 [YukiMemberHookCreator.useDangerousOperation](../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#usedangerousoperation-method) 方法。
|
||||
|
||||
但是**强烈建议不要这样做,发生问题请不要反馈,<u>自行承担一切后果</u>**。
|
||||
|
||||
:::
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger NoClassDefFoundError
|
||||
|
||||
Can't find this Class in \[**CLASSLOADER**\]: **CONTENT** Generated by YukiHookAPI#ReflectionTool
|
||||
@@ -1765,22 +1723,6 @@ TargetClass.hook {
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
This hook instance is create by Members, not support any hook class instance
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
使用 `Member.hook { ... }` 并非 `Class.hook { ... }` 创建了 Hook 实例并使用了 `instanceClass`。
|
||||
|
||||
**解决方案**
|
||||
|
||||
你只能在使用 `Class.hook { ... }` 创建 Hook 实例的情况下使用 `instanceClass`。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
Use of searchClass { ... }.hook { ... } is an error, please use like searchClass { ... }.get()?.hook { ... }
|
||||
|
||||
:::
|
||||
|
@@ -50,10 +50,10 @@ TargetClass.hook {
|
||||
method {
|
||||
// Your code here.
|
||||
}
|
||||
before {
|
||||
beforeHook {
|
||||
// Your code here.
|
||||
}
|
||||
after {
|
||||
afterHook {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
@@ -463,7 +463,7 @@ injectMember {
|
||||
method {
|
||||
throw RuntimeException("Exception Test")
|
||||
}
|
||||
after {
|
||||
afterHook {
|
||||
// ...
|
||||
}
|
||||
}.result {
|
||||
@@ -475,7 +475,7 @@ injectMember {
|
||||
method {
|
||||
// ...
|
||||
}
|
||||
after {
|
||||
afterHook {
|
||||
throw RuntimeException("Exception Test")
|
||||
}
|
||||
}.result {
|
||||
|
Reference in New Issue
Block a user