Skip to content

Commit

Permalink
fix: fix classes having multiple instances of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 5, 2022
1 parent 398239d commit 7cc8a7d
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
import com.google.common.collect.Iterables
import org.jf.dexlib2.base.reference.BaseTypeReference
import org.jf.dexlib2.iface.ClassDef
import org.jf.dexlib2.util.FieldUtil
import org.jf.dexlib2.util.MethodUtil

class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() {
Expand All @@ -27,12 +28,8 @@ class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() {

// Fields
private val _fields by lazy { classDef.fields.map { field -> field.toMutable() }.toMutableSet() }
private val _staticFields by lazy {
classDef.staticFields.map { staticField -> staticField.toMutable() }.toMutableSet()
}
private val _instanceFields by lazy {
classDef.instanceFields.map { instanceFields -> instanceFields.toMutable() }.toMutableSet()
}
private val _staticFields by lazy { Iterables.filter(_fields, FieldUtil.FIELD_IS_STATIC).toMutableSet() }
private val _instanceFields by lazy {Iterables.filter(_fields, FieldUtil.FIELD_IS_INSTANCE) .toMutableSet() }

fun setType(type: String) {
this.type = type
Expand Down

0 comments on commit 7cc8a7d

Please sign in to comment.