diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt index 19a528af..ad8c2541 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt @@ -39,6 +39,12 @@ import com.highcapable.yukihookapi.hook.xposed.bridge.YukiHookBridge */ abstract class ClassBaseFinder internal constructor(internal open val loaderSet: ClassLoader? = null) : BaseFinder() { + internal companion object { + + /** [loaderSet] 为 null 的提示 */ + internal const val LOADERSET_IS_NULL = "loaderSet is null" + } + /** 当前找到的 [Class] 数组 */ internal var classInstances = HashSet>() @@ -67,6 +73,8 @@ abstract class ClassBaseFinder internal constructor(internal open val loaderSet: */ internal fun onFailureMsg(throwable: Throwable? = null) { if (isShutErrorPrinting) return + /** 判断是否为 [LOADERSET_IS_NULL] */ + if (throwable?.message == LOADERSET_IS_NULL) return yLoggerE(msg = "NoClassDefFound happend in [$loaderSet]", e = throwable) } diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt index f46f3129..8f3ded2e 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt @@ -54,6 +54,12 @@ abstract class MemberBaseFinder internal constructor( internal open val classSet: Class<*>? = null ) : BaseFinder() { + internal companion object { + + /** [classSet] 为 null 的提示 */ + internal const val CLASSSET_IS_NULL = "classSet is null" + } + /** 是否使用了重查找功能 */ @PublishedApi internal var isUsingRemedyPlan = false @@ -121,6 +127,8 @@ abstract class MemberBaseFinder internal constructor( if (isNotIgnoredNoSuchMemberFailure && isUsingRemedyPlan.not() && isShutErrorPrinting.not()) loggingContent = Pair(msg, throwable) } + /** 判断是否为 [CLASSSET_IS_NULL] */ + if (throwable?.message == CLASSSET_IS_NULL) return /** 判断绑定到 Hooker 时仅创建日志 */ if (isBindToHooker) return await { build() }.unit() /** 判断始终输出日志或等待结果后输出日志 */ diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt index 34f27af0..fda6fbed 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt @@ -494,7 +494,7 @@ class DexClassFinder @PublishedApi internal constructor( } } else startProcess() } - } else Result(isNotFound = true, Throwable("loaderSet is null")).await { onFailureMsg() } + } else Result(isNotFound = true, Throwable(LOADERSET_IS_NULL)).await { onFailureMsg() } }.getOrElse { e -> Result(isNotFound = true, e).await { onFailureMsg(throwable = e) } } /** diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt index 8b5a92f8..cb9a8ffb 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt @@ -237,7 +237,7 @@ class ConstructorFinder @PublishedApi internal constructor( * @param isBind 是否将结果设置到目标 [YukiMemberHookCreator.MemberHookCreator] */ private fun build(isBind: Boolean) { - if (classSet == null) error("classSet is null") + if (classSet == null) error(CLASSSET_IS_NULL) classSet.checkingInternal() runBlocking { isBindToHooker = isBind diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt index e8df3818..639f23c0 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt @@ -196,7 +196,7 @@ class FieldFinder @PublishedApi internal constructor( memberInstances.takeIf { it.isNotEmpty() }?.forEach { onDebuggingMsg(msg = "Find Field [$it] takes ${ms}ms [${hookTag}]") } } Result() - } else Result(isNoSuch = true, Throwable("classSet is null")) + } else Result(isNoSuch = true, Throwable(CLASSSET_IS_NULL)) }.getOrElse { e -> Result(isNoSuch = true, e).await { onFailureMsg(throwable = e) } } @YukiPrivateApi diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt index 2b2a4878..4faf368c 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt @@ -309,7 +309,7 @@ class MethodFinder @PublishedApi internal constructor( * @param isBind 是否将结果设置到目标 [YukiMemberHookCreator.MemberHookCreator] */ private fun build(isBind: Boolean) { - if (classSet == null) error("classSet is null") + if (classSet == null) error(CLASSSET_IS_NULL) classSet.checkingInternal() runBlocking { isBindToHooker = isBind