diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt index d85aaa5a..ac9c47b2 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt @@ -35,6 +35,7 @@ package com.highcapable.yukihookapi.hook.core import com.highcapable.yukihookapi.YukiHookAPI import com.highcapable.yukihookapi.hook.bean.HookClass import com.highcapable.yukihookapi.hook.core.annotation.DangerousHookOperation +import com.highcapable.yukihookapi.hook.core.annotation.LegacyHookApi import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper import com.highcapable.yukihookapi.hook.core.api.helper.YukiHookHelper import com.highcapable.yukihookapi.hook.core.api.priority.YukiHookPriority @@ -56,7 +57,6 @@ import com.highcapable.yukihookapi.hook.factory.toJavaPrimitiveType import com.highcapable.yukihookapi.hook.log.YLog import com.highcapable.yukihookapi.hook.param.HookParam import com.highcapable.yukihookapi.hook.param.PackageParam -import com.highcapable.yukihookapi.hook.param.annotation.LegacyHookApi import com.highcapable.yukihookapi.hook.type.java.AnyClass import com.highcapable.yukihookapi.hook.type.java.JavaClass import com.highcapable.yukihookapi.hook.type.java.JavaClassLoader @@ -167,6 +167,7 @@ class YukiMemberHookCreator internal constructor(private val packageParam: Packa * @return [Class] * @throws IllegalStateException 如果当前 [Class] 未被正确装载或为 [HookClass.isPlaceholder] */ + @LegacyHookApi val instanceClass get() = if (hookClass.isPlaceholder) error("This hook instance is create by Members, not support any hook class instance") diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/DangerousHookOperation.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/DangerousHookOperation.kt index cd066cd6..3b3eaa82 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/DangerousHookOperation.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/DangerousHookOperation.kt @@ -29,7 +29,7 @@ package com.highcapable.yukihookapi.hook.core.annotation @RequiresOptIn(message = "允许 Hook 过程中的所有危险行为可能导致意料之外的情况发生", level = RequiresOptIn.Level.WARNING) @MustBeDocumented -@Target(AnnotationTarget.FUNCTION) +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) /** * 标记需要 [RequiresOptIn] 的功能 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/annotation/LegacyHookApi.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt similarity index 91% rename from yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/annotation/LegacyHookApi.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt index 93376eb1..3c646571 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/annotation/LegacyHookApi.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyHookApi.kt @@ -25,11 +25,11 @@ * * This file is created by fankes on 2023/10/3. */ -package com.highcapable.yukihookapi.hook.param.annotation +package com.highcapable.yukihookapi.hook.core.annotation @RequiresOptIn(message = "这种方式将不再被推荐且将在 2.x.x 版本完全移除,建议迁移到使用 Member 创建 Hook 的新写法", level = RequiresOptIn.Level.WARNING) @MustBeDocumented -@Target(AnnotationTarget.FUNCTION) +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) /** * 标记需要 [RequiresOptIn] 的功能 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/annotation/LegacyResourcesHook.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyResourcesHook.kt similarity index 91% rename from yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/annotation/LegacyResourcesHook.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyResourcesHook.kt index 50d1d128..2766dd40 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/annotation/LegacyResourcesHook.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/annotation/LegacyResourcesHook.kt @@ -25,11 +25,11 @@ * * This file is created by fankes on 2023/10/3. */ -package com.highcapable.yukihookapi.hook.param.annotation +package com.highcapable.yukihookapi.hook.core.annotation @RequiresOptIn(message = "Resources Hook 功能将在 2.x.x 版本完全移除 (如果必须使用,你可以继续使用 1.x.x 版本)", level = RequiresOptIn.Level.WARNING) @MustBeDocumented -@Target(AnnotationTarget.FUNCTION) +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) /** * 标记需要 [RequiresOptIn] 的功能 diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt index 85177044..8b605bf2 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt @@ -25,7 +25,7 @@ * * This file is created by fankes on 2022/2/2. */ -@file:Suppress("unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST") +@file:Suppress("unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "OPT_IN_USAGE") package com.highcapable.yukihookapi.hook.param diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt index 558d6a46..6baeb339 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt @@ -43,6 +43,8 @@ import com.highcapable.yukihookapi.hook.bean.HookResources import com.highcapable.yukihookapi.hook.bean.VariousClass import com.highcapable.yukihookapi.hook.core.YukiMemberHookCreator import com.highcapable.yukihookapi.hook.core.YukiResourcesHookCreator +import com.highcapable.yukihookapi.hook.core.annotation.LegacyHookApi +import com.highcapable.yukihookapi.hook.core.annotation.LegacyResourcesHook import com.highcapable.yukihookapi.hook.core.api.priority.YukiHookPriority import com.highcapable.yukihookapi.hook.core.finder.base.BaseFinder import com.highcapable.yukihookapi.hook.core.finder.classes.DexClassFinder @@ -52,8 +54,6 @@ import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool import com.highcapable.yukihookapi.hook.core.finder.type.factory.ClassConditions import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker import com.highcapable.yukihookapi.hook.log.YLog -import com.highcapable.yukihookapi.hook.param.annotation.LegacyHookApi -import com.highcapable.yukihookapi.hook.param.annotation.LegacyResourcesHook import com.highcapable.yukihookapi.hook.param.wrapper.PackageParamWrapper import com.highcapable.yukihookapi.hook.utils.factory.value import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule diff --git a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/annotation/SendTooLargeChannelData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/annotation/SendTooLargeChannelData.kt index c14c24c4..c4520abf 100644 --- a/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/annotation/SendTooLargeChannelData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/annotation/SendTooLargeChannelData.kt @@ -29,7 +29,7 @@ package com.highcapable.yukihookapi.hook.xposed.channel.annotation @RequiresOptIn(message = "这是一个危险的操作,允许发送过大的数据可能导致宿主或模块崩溃", level = RequiresOptIn.Level.WARNING) @MustBeDocumented -@Target(AnnotationTarget.FUNCTION) +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) /** * 标记需要 [RequiresOptIn] 的功能