From 1792aeb8253597dfc1bab96c6663ea7cd016d427 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Thu, 12 Jan 2023 01:05:51 +0800 Subject: [PATCH] Modify optimize code style for @Deprecated annotation --- .../yukihookapi/hook/core/YukiMemberHookCreator.kt | 4 ++-- .../hook/core/finder/members/ConstructorFinder.kt | 2 +- .../yukihookapi/hook/core/finder/members/FieldFinder.kt | 2 +- .../yukihookapi/hook/core/finder/members/MethodFinder.kt | 2 +- .../yukihookapi/hook/factory/ReflectionFactory.kt | 4 ++-- .../com/highcapable/yukihookapi/hook/param/PackageParam.kt | 6 +++--- .../yukihookapi/hook/type/java/VariableTypeFactory.kt | 6 +++--- .../yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.kt | 4 ++-- .../hook/xposed/proxy/YukiHookXposedInitProxy.kt | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt index 84e632f4..2f173428 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt @@ -301,7 +301,7 @@ class YukiMemberHookCreator @PublishedApi internal constructor( * @param name 方法名称 * @return [ArrayList]<[MethodFinder.Result.Instance]> */ - @Deprecated(message = "请使用新方式来实现 Hook 所有方法", ReplaceWith(expression = "method { this.name = name }.all()")) + @Deprecated(message = "请使用新方式来实现 Hook 所有方法", ReplaceWith("method { this.name = name }.all()")) fun allMethods(name: String) = method { this.name = name }.all() /** @@ -314,7 +314,7 @@ class YukiMemberHookCreator @PublishedApi internal constructor( */ @Deprecated( message = "请使用新方式来实现 Hook 所有构造方法", - ReplaceWith(expression = "allMembers(MembersType.CONSTRUCTOR)", "com.highcapable.yukihookapi.hook.factory.MembersType") + ReplaceWith("allMembers(MembersType.CONSTRUCTOR)", "com.highcapable.yukihookapi.hook.factory.MembersType") ) fun allConstructors() = allMembers(MembersType.CONSTRUCTOR) 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 91c89b7b..664f5b49 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 @@ -572,7 +572,7 @@ class ConstructorFinder @PublishedApi internal constructor( * - ❗请现在转移到 [ignored] * @return [Result] 可继续向下监听 */ - @Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "ignored()")) + @Deprecated(message = "请使用新的命名方法", ReplaceWith("ignored()")) fun ignoredError() = ignored() /** 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 dcb3a34f..684186d3 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 @@ -458,7 +458,7 @@ class FieldFinder @PublishedApi internal constructor( * - ❗请现在转移到 [ignored] * @return [Result] 可继续向下监听 */ - @Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "ignored()")) + @Deprecated(message = "请使用新的命名方法", ReplaceWith("ignored()")) fun ignoredError() = ignored() /** 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 0c706a91..db9ad5ca 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 @@ -668,7 +668,7 @@ class MethodFinder @PublishedApi internal constructor( * - ❗请现在转移到 [ignored] * @return [Result] 可继续向下监听 */ - @Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "ignored()")) + @Deprecated(message = "请使用新的命名方法", ReplaceWith("ignored()")) fun ignoredError() = ignored() /** diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt index f41d5e98..739e662d 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt @@ -201,7 +201,7 @@ fun Class<*>.toJavaPrimitiveType() = when (this) { * @return [Class] * @throws NoClassDefFoundError 如果找不到 [Class] 或设置了错误的 [ClassLoader] */ -@Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "name.toClass(loader)")) +@Deprecated(message = "请使用新的命名方法", ReplaceWith("name.toClass(loader)")) fun classOf(name: String, loader: ClassLoader? = null) = name.toClass(loader) /** @@ -369,7 +369,7 @@ inline fun T.current(ignored: Boolean = false, initiate: Curre * - ❗请现在转移到 [buildOf] * @return [Any] or null */ -@Deprecated(message = "请使用新的命名方法", replaceWith = ReplaceWith(expression = "buildOf(*param, initiate)")) +@Deprecated(message = "请使用新的命名方法", ReplaceWith("buildOf(*param, initiate)")) fun Class<*>.buildOfAny(vararg param: Any?, initiate: ConstructorConditions = { emptyParam() }) = buildOf(*param, initiate) /** diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/PackageParam.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/PackageParam.kt index 49c9759b..927b7413 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/PackageParam.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/param/PackageParam.kt @@ -457,7 +457,7 @@ open class PackageParam internal constructor(@PublishedApi internal var wrapper: * @return [Class] * @throws NoClassDefFoundError 如果找不到 [Class] */ - @Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "toClass()")) + @Deprecated(message = "请使用新的命名方法", ReplaceWith("toClass()")) val String.clazz get() = toClass() @@ -470,7 +470,7 @@ open class PackageParam internal constructor(@PublishedApi internal var wrapper: * @return [Class] * @throws IllegalStateException 如果任何 [Class] 都没有匹配到 */ - @Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "toClass()")) + @Deprecated(message = "请使用新的命名方法", ReplaceWith("toClass()")) val VariousClass.clazz get() = toClass() @@ -482,7 +482,7 @@ open class PackageParam internal constructor(@PublishedApi internal var wrapper: * - ❗请现在转移到 [hasClass] * @return [Boolean] 是否存在 */ - @Deprecated(message = "请使用新的命名方法", ReplaceWith(expression = "hasClass()")) + @Deprecated(message = "请使用新的命名方法", ReplaceWith("hasClass()")) val String.hasClass get() = hasClass() diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt index 4058dc39..284b98bf 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt @@ -76,7 +76,7 @@ fun ArrayClass(type: Class<*>) = JavaArray.newInstance(type, 0).javaClass as Cla * - ❗请现在转移到 [AnyClass] * @return [Class]<[Any]> */ -@Deprecated(message = "请使用新的命名方法", replaceWith = ReplaceWith(expression = "AnyClass")) +@Deprecated(message = "请使用新的命名方法", ReplaceWith("AnyClass")) val AnyType get() = AnyClass /** @@ -247,7 +247,7 @@ val UnitClass get() = classOf() * - ❗请现在转移到 [StringClass] * @return [Class]<[String]> */ -@Deprecated(message = "请使用新的命名方法", replaceWith = ReplaceWith(expression = "StringClass")) +@Deprecated(message = "请使用新的命名方法", ReplaceWith("StringClass")) val StringType get() = StringClass /** @@ -258,7 +258,7 @@ val StringType get() = StringClass * - ❗请现在转移到 [CharSequenceClass] * @return [Class]<[CharSequence]> */ -@Deprecated(message = "请使用新的命名方法", replaceWith = ReplaceWith(expression = "CharSequenceClass")) +@Deprecated(message = "请使用新的命名方法", ReplaceWith("CharSequenceClass")) val CharSequenceType get() = CharSequenceClass /** diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.kt index dd84b6ca..377528e2 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.kt @@ -193,7 +193,7 @@ class YukiHookModulePrefs private constructor(private var context: Context? = nu * - ❗请现在转移到 [isPreferencesAvailable] * @return [Boolean] */ - @Deprecated(message = "请使用新方式来实现此功能", replaceWith = ReplaceWith(expression = "isPreferencesAvailable")) + @Deprecated(message = "请使用新方式来实现此功能", ReplaceWith("isPreferencesAvailable")) val isXSharePrefsReadable get() = isPreferencesAvailable /** @@ -204,7 +204,7 @@ class YukiHookModulePrefs private constructor(private var context: Context? = nu * - ❗请现在转移到 [isPreferencesAvailable] * @return [Boolean] */ - @Deprecated(message = "请使用新方式来实现此功能", replaceWith = ReplaceWith(expression = "isPreferencesAvailable")) + @Deprecated(message = "请使用新方式来实现此功能", ReplaceWith("isPreferencesAvailable")) val isRunInNewXShareMode get() = isPreferencesAvailable /** diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt index db34a347..f6038897 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt @@ -39,7 +39,7 @@ import com.highcapable.yukihookapi.hook.log.yLoggerW * * - ❗请现在转移到 [IYukiHookXposedInit] 否则此接口的声明将在自动处理程序中被拦截 */ -@Deprecated(message = "此接口的命名和功能已被弃用", ReplaceWith(expression = "IYukiHookXposedInit"), level = DeprecationLevel.ERROR) +@Deprecated(message = "此接口的命名和功能已被弃用", ReplaceWith("IYukiHookXposedInit"), level = DeprecationLevel.ERROR) interface YukiHookXposedInitProxy { /**