From 8462d9cb34c077b6d7d4f9d248406a257771f894 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Sat, 7 Oct 2023 11:17:35 +0800 Subject: [PATCH] docs: update api-exception, example --- docs-source/src/en/config/api-exception.md | 58 ------------------- docs-source/src/en/guide/example.md | 8 +-- docs-source/src/zh-cn/config/api-exception.md | 58 ------------------- docs-source/src/zh-cn/guide/example.md | 8 +-- 4 files changed, 8 insertions(+), 124 deletions(-) diff --git a/docs-source/src/en/config/api-exception.md b/docs-source/src/en/config/api-exception.md index 895d8569..8bdae27d 100644 --- a/docs-source/src/en/config/api-exception.md +++ b/docs-source/src/en/config/api-exception.md @@ -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 -// -JavaClassLoader.hook { - // ... -} -// -JavaClass.hook { - // ... -} -// -JavaMethod.hook { - // ... -} -// ... -``` - -**Solution** - -These functions are internal to the system, **they should not be hooked, may not be supported on some Hook Frameworks, and may cause other errors**, 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, all the consequences will be borne by yourself**. - -::: - -###### 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 { ... } ::: diff --git a/docs-source/src/en/guide/example.md b/docs-source/src/en/guide/example.md index f6fee358..18922e01 100644 --- a/docs-source/src/en/guide/example.md +++ b/docs-source/src/en/guide/example.md @@ -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 { diff --git a/docs-source/src/zh-cn/config/api-exception.md b/docs-source/src/zh-cn/config/api-exception.md index 5f17e292..03b1b700 100644 --- a/docs-source/src/zh-cn/config/api-exception.md +++ b/docs-source/src/zh-cn/config/api-exception.md @@ -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 { - // ... -} -// ... -``` - -**解决方案** - -这些功能是系统内部的,**它们不应该被 Hook,在部分 Hook Framework 上可能不被支持,还会引发其它错误**,请尝试更换 Hook 点。 - -::: tip - -若你仍要使用此功能,请参考 [YukiMemberHookCreator.useDangerousOperation](../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#usedangerousoperation-method) 方法。 - -但是**强烈建议不要这样做,发生问题请不要反馈,自行承担一切后果**。 - -::: - -###### 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 { ... } ::: diff --git a/docs-source/src/zh-cn/guide/example.md b/docs-source/src/zh-cn/guide/example.md index 50606fb9..1dd6b9fd 100644 --- a/docs-source/src/zh-cn/guide/example.md +++ b/docs-source/src/zh-cn/guide/example.md @@ -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 {