Skip to content

Commit

Permalink
fix: Check for class type exactly instead of with contains (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX authored Sep 18, 2024
1 parent 525beda commit 69f2f20
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/patcher/Fingerprint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class Fingerprint internal constructor(
fun match(
context: BytecodePatchContext,
method: Method,
) = match(context, method, context.classByType(method.definingClass)!!.immutableClass)
) = match(context, method, context.classBy { method.definingClass == it.type }!!.immutableClass)

/**
* Match using a [Method].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
* @param type The type of the class.
* @return A proxy for the first class that matches the type.
*/
@Deprecated("Use classBy { type in it.type } instead.", ReplaceWith("classBy { type in it.type }"))
fun classByType(type: String) = classBy { type in it.type }

/**
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/app/revanced/patcher/util/ClassMerger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ internal object ClassMerger {
callback: MutableClass.() -> Unit,
) {
callback(targetClass)
this.classByType(targetClass.superclass ?: return)?.mutableClass?.let {

targetClass.superclass ?: return
this.classBy { targetClass.superclass == it.type }?.mutableClass?.let {
traverseClassHierarchy(it, callback)
}
}
Expand Down

0 comments on commit 69f2f20

Please sign in to comment.