Skip to content

Commit f609672

Browse files
committed
Modify remove Members cache function and remove LruCache function, optimizing performance of finder
1 parent 0b5bb7f commit f609672

File tree

13 files changed

+88
-408
lines changed

13 files changed

+88
-408
lines changed

docs-source/src/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -512,29 +512,15 @@ var isEnableDataChannel: Boolean
512512

513513
此功能默认启用,关闭后将不会在功能初始化的时候装载 `YukiHookDataChannel`
514514

515-
### isEnableMemberCache <span class="symbol">- field</span>
516-
517-
```kotlin:no-line-numbers
518-
var isEnableMemberCache: Boolean
519-
```
515+
<h3 class="deprecated">isEnableMemberCache - field</h3>
520516

521517
**Change Records**
522518

523519
`v1.0.68` `added`
524520

525-
**Function Illustrate**
526-
527-
> 是否启用 `Member` 缓存功能。
528-
529-
为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。
530-
531-
启用后会缓存已经找到的 `Method``Constructor``Field`
532-
533-
缓存的 `Member` 都将处于 `ReflectsCacheStore` 的全局静态实例中。
534-
535-
推荐使用 `MethodFinder``ConstructorFinder``FieldFinder` 来获取 `Member`
521+
`v1.1.11` `deprecated`
536522

537-
除非缓存的 `Member` 发生了混淆的问题,例如使用 R8 混淆后的 APP 的目标 `Member`,否则建议启用。
523+
`Member` 的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
538524

539525
## configs <span class="symbol">- method</span>
540526

@@ -578,7 +564,6 @@ object HookEntry : IYukiHookXposedInit {
578564
isEnableHookModuleStatus = true
579565
isEnableHookSharedPreferences = false
580566
isEnableDataChannel = true
581-
isEnableMemberCache = true
582567
}
583568
}
584569

@@ -607,7 +592,6 @@ object HookEntry : IYukiHookXposedInit {
607592
isEnableHookModuleStatus = true
608593
isEnableHookSharedPreferences = false
609594
isEnableDataChannel = true
610-
isEnableMemberCache = true
611595
}
612596

613597
override fun onHook() {
@@ -638,7 +622,6 @@ object HookEntry : IYukiHookXposedInit {
638622
YukiHookAPI.Configs.isEnableHookModuleStatus = true
639623
YukiHookAPI.Configs.isEnableHookSharedPreferences = false
640624
YukiHookAPI.Configs.isEnableDataChannel = true
641-
YukiHookAPI.Configs.isEnableMemberCache = true
642625
}
643626

644627
override fun onHook() {

docs-source/src/zh-cn/api/public/com/highcapable/yukihookapi/YukiHookAPI.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -504,29 +504,15 @@ var isEnableDataChannel: Boolean
504504

505505
此功能默认启用,关闭后将不会在功能初始化的时候装载 `YukiHookDataChannel`
506506

507-
### isEnableMemberCache <span class="symbol">- field</span>
508-
509-
```kotlin:no-line-numbers
510-
var isEnableMemberCache: Boolean
511-
```
507+
<h3 class="deprecated">isEnableMemberCache - field</h3>
512508

513509
**变更记录**
514510

515511
`v1.0.68` `新增`
516512

517-
**功能描述**
518-
519-
> 是否启用 `Member` 缓存功能。
520-
521-
为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。
522-
523-
启用后会缓存已经找到的 `Method``Constructor``Field`
524-
525-
缓存的 `Member` 都将处于 `ReflectsCacheStore` 的全局静态实例中。
526-
527-
推荐使用 `MethodFinder``ConstructorFinder``FieldFinder` 来获取 `Member`
513+
`v1.1.11` `作废`
528514

529-
除非缓存的 `Member` 发生了混淆的问题,例如使用 R8 混淆后的 APP 的目标 `Member`,否则建议启用。
515+
`Member` 的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
530516

531517
## configs <span class="symbol">- method</span>
532518

@@ -570,7 +556,6 @@ object HookEntry : IYukiHookXposedInit {
570556
isEnableHookModuleStatus = true
571557
isEnableHookSharedPreferences = false
572558
isEnableDataChannel = true
573-
isEnableMemberCache = true
574559
}
575560
}
576561

@@ -599,7 +584,6 @@ object HookEntry : IYukiHookXposedInit {
599584
isEnableHookModuleStatus = true
600585
isEnableHookSharedPreferences = false
601586
isEnableDataChannel = true
602-
isEnableMemberCache = true
603587
}
604588

605589
override fun onHook() {
@@ -630,7 +614,6 @@ object HookEntry : IYukiHookXposedInit {
630614
YukiHookAPI.Configs.isEnableHookModuleStatus = true
631615
YukiHookAPI.Configs.isEnableHookSharedPreferences = false
632616
YukiHookAPI.Configs.isEnableDataChannel = true
633-
YukiHookAPI.Configs.isEnableMemberCache = true
634617
}
635618

636619
override fun onHook() {

yukihookapi/src/main/java/com/highcapable/yukihookapi/YukiHookAPI.kt

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
4040
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiCategoryHelper
4141
import com.highcapable.yukihookapi.hook.core.api.compat.HookApiProperty
4242
import com.highcapable.yukihookapi.hook.core.api.compat.type.ExecutorType
43-
import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder
44-
import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder
45-
import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder
46-
import com.highcapable.yukihookapi.hook.core.finder.store.ReflectsCacheStore
4743
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
4844
import com.highcapable.yukihookapi.hook.factory.isTaiChiModuleActive
4945
import com.highcapable.yukihookapi.hook.factory.processName
@@ -58,10 +54,7 @@ import com.highcapable.yukihookapi.hook.xposed.bridge.status.YukiXposedModuleSta
5854
import com.highcapable.yukihookapi.hook.xposed.bridge.type.HookEntryType
5955
import com.highcapable.yukihookapi.hook.xposed.channel.YukiHookDataChannel
6056
import com.highcapable.yukihookapi.hook.xposed.prefs.YukiHookPrefsBridge
61-
import java.lang.reflect.Constructor
62-
import java.lang.reflect.Field
6357
import java.lang.reflect.Member
64-
import java.lang.reflect.Method
6558

6659
/**
6760
* [YukiHookAPI] 的装载调用类
@@ -343,21 +336,12 @@ object YukiHookAPI {
343336
/**
344337
* 是否启用 [Member] 缓存功能
345338
*
346-
* - 为防止 [Member] 复用过高造成的系统 GC 问题 - 此功能默认启用
347-
*
348-
* 启用后会缓存已经找到的 [Method]、[Constructor]、[Field]
349-
*
350-
* 缓存的 [Member] 都将处于 [ReflectsCacheStore] 的全局静态实例中
351-
*
352-
* 推荐使用 [MethodFinder]、[ConstructorFinder]、[FieldFinder] 来获取 [Member]
353-
*
354-
* 详情请参考 [API 文档](https://fankes.github.io/YukiHookAPI/zh-cn/api/home)
355-
*
356-
* For English version, see [API Document](https://fankes.github.io/YukiHookAPI/en/api/home)
339+
* - ❗此方法及功能已被移除 - 在之后的版本中将直接被删除
357340
*
358-
* 除非缓存的 [Member] 发生了混淆的问题 - 例如使用 R8 混淆后的 APP 的目标 [Member] - 否则建议启用
341+
* - ❗[Member] 的直接缓存功能已被移除 - 因为其存在内存溢出 (OOM) 问题
359342
*/
360-
var isEnableMemberCache = true
343+
@Deprecated(message = "此方法及功能已被移除,请删除此方法")
344+
var isEnableMemberCache = false
361345
}
362346

363347
/**

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,5 @@ internal abstract class BaseRulesData internal constructor(
139139
*/
140140
internal open val isInitialize get() = modifiers != null || orderIndex != null || matchIndex != null
141141

142-
/**
143-
* 通过规则数据 [toString] 来得到一个 [Any.hashCode]
144-
* @param other 额外的数据 - 可选
145-
* @return [Int]
146-
*/
147-
internal open fun hashCode(other: Any? = null) = "[$other][$modifiers][$orderIndex][$matchIndex]".hashCode()
142+
override fun toString() = "[$modifiers][$orderIndex][$matchIndex]"
148143
}

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ internal class ClassRulesData internal constructor(
175175
isNoExtendsClass != null || isNoImplementsClass != null || extendsClass.isNotEmpty() || enclosingClass.isNotEmpty() ||
176176
memberRules.isNotEmpty() || fieldRules.isNotEmpty() || methodRules.isNotEmpty() || constroctorRules.isNotEmpty()
177177

178-
override fun hashCode(other: Any?) = super.hashCode(other) + toString().hashCode()
179-
180178
override fun toString() = "[$fromPackages][$fullName][$simpleName][$singleName][$fullNameConditions][$simpleNameConditions]" +
181179
"[$singleNameConditions][$modifiers][$isAnonymousClass][$isNoExtendsClass][$isNoImplementsClass][$extendsClass][$implementsClass]" +
182-
"[$enclosingClass][$memberRules][$fieldRules][$methodRules][$constroctorRules]"
180+
"[$enclosingClass][$memberRules][$fieldRules][$methodRules][$constroctorRules]" + super.toString()
183181
}

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,5 @@ internal class ConstructorRulesData internal constructor(
6363
get() = super.isInitializeOfSuper || paramTypes != null || paramTypesConditions != null || paramCount >= 0 ||
6464
paramCountRange.isEmpty().not() || paramCountConditions != null
6565

66-
override fun hashCode(other: Any?) = super.hashCode(other) + toString().hashCode()
67-
68-
override fun toString() = "[$paramTypes][$paramTypesConditions][$paramCount][$paramCountRange]"
66+
override fun toString() = "[$paramTypes][$paramTypesConditions][$paramCount][$paramCountRange]" + super.toString()
6967
}

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,5 @@ internal class FieldRulesData internal constructor(
5959
override val isInitialize
6060
get() = super.isInitializeOfSuper || name.isNotBlank() || nameConditions != null || type != null || typeConditions != null
6161

62-
override fun hashCode(other: Any?) = super.hashCode(other) + toString().hashCode()
63-
64-
override fun toString() = "[$name][$nameConditions][$type][$typeConditions]"
62+
override fun toString() = "[$name][$nameConditions][$type][$typeConditions]" + super.toString()
6563
}

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,5 @@ internal open class MemberRulesData internal constructor(
7070

7171
override val isInitialize get() = isInitializeOfSuper || isInitializeOfMatch
7272

73-
override fun hashCode(other: Any?) = super.hashCode(other) + toString().hashCode()
74-
75-
override fun toString() = "[$isFindInSuper][$matchIndex][$matchCountRange]"
73+
override fun toString() = "[$isFindInSuper][$matchIndex][$matchCountRange][$matchCountConditions]" + super.toString()
7674
}

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ internal class MethodRulesData internal constructor(
7878
paramCount >= 0 || paramCountRange.isEmpty().not() || paramCountConditions != null ||
7979
returnType != null || returnTypeConditions != null
8080

81-
override fun hashCode(other: Any?) = super.hashCode(other) + toString().hashCode()
82-
8381
override fun toString() = "[$name][$nameConditions][$paramTypes][$paramTypesConditions][$paramCount]" +
84-
"[$paramCountRange][$returnType][$returnTypeConditions]"
82+
"[$paramCountRange][$returnType][$returnTypeConditions]" + super.toString()
8583
}

yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/store/ReflectsCacheStore.kt

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)