refactor: Convert method bodies to single expression functions

This commit is contained in:
oSumAtrIX 2024-07-26 03:09:03 +02:00
parent d21128fe2e
commit b41a542952
24 changed files with 125 additions and 255 deletions

View file

@ -9,21 +9,13 @@ class MutableAnnotation(annotation: Annotation) : BaseAnnotation() {
private val type = annotation.type private val type = annotation.type
private val _elements by lazy { annotation.elements.map { element -> element.toMutable() }.toMutableSet() } private val _elements by lazy { annotation.elements.map { element -> element.toMutable() }.toMutableSet() }
override fun getType(): String { override fun getType(): String = type
return type
}
override fun getElements(): MutableSet<MutableAnnotationElement> { override fun getElements(): MutableSet<MutableAnnotationElement> = _elements
return _elements
}
override fun getVisibility(): Int { override fun getVisibility(): Int = visibility
return visibility
}
companion object { companion object {
fun Annotation.toMutable(): MutableAnnotation { fun Annotation.toMutable(): MutableAnnotation = MutableAnnotation(this)
return MutableAnnotation(this)
}
} }
} }

View file

@ -18,17 +18,11 @@ class MutableAnnotationElement(annotationElement: AnnotationElement) : BaseAnnot
this.value = value this.value = value
} }
override fun getName(): String { override fun getName(): String = name
return name
}
override fun getValue(): EncodedValue { override fun getValue(): EncodedValue = value
return value
}
companion object { companion object {
fun AnnotationElement.toMutable(): MutableAnnotationElement { fun AnnotationElement.toMutable(): MutableAnnotationElement = MutableAnnotationElement(this)
return MutableAnnotationElement(this)
}
} }
} }

View file

@ -8,7 +8,9 @@ import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.util.FieldUtil import com.android.tools.smali.dexlib2.util.FieldUtil
import com.android.tools.smali.dexlib2.util.MethodUtil import com.android.tools.smali.dexlib2.util.MethodUtil
class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() { class MutableClass(classDef: ClassDef) :
BaseTypeReference(),
ClassDef {
// Class // Class
private var type = classDef.type private var type = classDef.type
private var sourceFile = classDef.sourceFile private var sourceFile = classDef.sourceFile
@ -46,57 +48,31 @@ class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() {
this.superclass = superclass this.superclass = superclass
} }
override fun getType(): String { override fun getType(): String = type
return type
}
override fun getAccessFlags(): Int { override fun getAccessFlags(): Int = accessFlags
return accessFlags
}
override fun getSourceFile(): String? { override fun getSourceFile(): String? = sourceFile
return sourceFile
}
override fun getSuperclass(): String? { override fun getSuperclass(): String? = superclass
return superclass
}
override fun getInterfaces(): MutableList<String> { override fun getInterfaces(): MutableList<String> = _interfaces
return _interfaces
}
override fun getAnnotations(): MutableSet<MutableAnnotation> { override fun getAnnotations(): MutableSet<MutableAnnotation> = _annotations
return _annotations
}
override fun getStaticFields(): MutableSet<MutableField> { override fun getStaticFields(): MutableSet<MutableField> = _staticFields
return _staticFields
}
override fun getInstanceFields(): MutableSet<MutableField> { override fun getInstanceFields(): MutableSet<MutableField> = _instanceFields
return _instanceFields
}
override fun getFields(): MutableSet<MutableField> { override fun getFields(): MutableSet<MutableField> = _fields
return _fields
}
override fun getDirectMethods(): MutableSet<MutableMethod> { override fun getDirectMethods(): MutableSet<MutableMethod> = _directMethods
return _directMethods
}
override fun getVirtualMethods(): MutableSet<MutableMethod> { override fun getVirtualMethods(): MutableSet<MutableMethod> = _virtualMethods
return _virtualMethods
}
override fun getMethods(): MutableSet<MutableMethod> { override fun getMethods(): MutableSet<MutableMethod> = _methods
return _methods
}
companion object { companion object {
fun ClassDef.toMutable(): MutableClass { fun ClassDef.toMutable(): MutableClass = MutableClass(this)
return MutableClass(this)
}
} }
} }

View file

@ -7,7 +7,9 @@ import com.android.tools.smali.dexlib2.HiddenApiRestriction
import com.android.tools.smali.dexlib2.base.reference.BaseFieldReference import com.android.tools.smali.dexlib2.base.reference.BaseFieldReference
import com.android.tools.smali.dexlib2.iface.Field import com.android.tools.smali.dexlib2.iface.Field
class MutableField(field: Field) : Field, BaseFieldReference() { class MutableField(field: Field) :
BaseFieldReference(),
Field {
private var definingClass = field.definingClass private var definingClass = field.definingClass
private var name = field.name private var name = field.name
private var type = field.type private var type = field.type
@ -37,37 +39,21 @@ class MutableField(field: Field) : Field, BaseFieldReference() {
this.initialValue = initialValue this.initialValue = initialValue
} }
override fun getDefiningClass(): String { override fun getDefiningClass(): String = this.definingClass
return this.definingClass
}
override fun getName(): String { override fun getName(): String = this.name
return this.name
}
override fun getType(): String { override fun getType(): String = this.type
return this.type
}
override fun getAnnotations(): MutableSet<MutableAnnotation> { override fun getAnnotations(): MutableSet<MutableAnnotation> = this._annotations
return this._annotations
}
override fun getAccessFlags(): Int { override fun getAccessFlags(): Int = this.accessFlags
return this.accessFlags
}
override fun getHiddenApiRestrictions(): MutableSet<HiddenApiRestriction> { override fun getHiddenApiRestrictions(): MutableSet<HiddenApiRestriction> = this._hiddenApiRestrictions
return this._hiddenApiRestrictions
}
override fun getInitialValue(): MutableEncodedValue? { override fun getInitialValue(): MutableEncodedValue? = this.initialValue
return this.initialValue
}
companion object { companion object {
fun Field.toMutable(): MutableField { fun Field.toMutable(): MutableField = MutableField(this)
return MutableField(this)
}
} }
} }

View file

@ -7,7 +7,9 @@ import com.android.tools.smali.dexlib2.base.reference.BaseMethodReference
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
class MutableMethod(method: Method) : Method, BaseMethodReference() { class MutableMethod(method: Method) :
BaseMethodReference(),
Method {
private var definingClass = method.definingClass private var definingClass = method.definingClass
private var name = method.name private var name = method.name
private var accessFlags = method.accessFlags private var accessFlags = method.accessFlags
@ -36,45 +38,25 @@ class MutableMethod(method: Method) : Method, BaseMethodReference() {
this.returnType = returnType this.returnType = returnType
} }
override fun getDefiningClass(): String { override fun getDefiningClass(): String = definingClass
return definingClass
}
override fun getName(): String { override fun getName(): String = name
return name
}
override fun getParameterTypes(): MutableList<CharSequence> { override fun getParameterTypes(): MutableList<CharSequence> = _parameterTypes
return _parameterTypes
}
override fun getReturnType(): String { override fun getReturnType(): String = returnType
return returnType
}
override fun getAnnotations(): MutableSet<MutableAnnotation> { override fun getAnnotations(): MutableSet<MutableAnnotation> = _annotations
return _annotations
}
override fun getAccessFlags(): Int { override fun getAccessFlags(): Int = accessFlags
return accessFlags
}
override fun getHiddenApiRestrictions(): MutableSet<HiddenApiRestriction> { override fun getHiddenApiRestrictions(): MutableSet<HiddenApiRestriction> = _hiddenApiRestrictions
return _hiddenApiRestrictions
}
override fun getParameters(): MutableList<MutableMethodParameter> { override fun getParameters(): MutableList<MutableMethodParameter> = _parameters
return _parameters
}
override fun getImplementation(): MutableMethodImplementation? { override fun getImplementation(): MutableMethodImplementation? = _implementation
return _implementation
}
companion object { companion object {
fun Method.toMutable(): MutableMethod { fun Method.toMutable(): MutableMethod = MutableMethod(this)
return MutableMethod(this)
}
} }
} }

View file

@ -5,7 +5,9 @@ import com.android.tools.smali.dexlib2.base.BaseMethodParameter
import com.android.tools.smali.dexlib2.iface.MethodParameter import com.android.tools.smali.dexlib2.iface.MethodParameter
// TODO: finish overriding all members if necessary // TODO: finish overriding all members if necessary
class MutableMethodParameter(parameter: MethodParameter) : MethodParameter, BaseMethodParameter() { class MutableMethodParameter(parameter: MethodParameter) :
BaseMethodParameter(),
MethodParameter {
private var type = parameter.type private var type = parameter.type
private var name = parameter.name private var name = parameter.name
private var signature = parameter.signature private var signature = parameter.signature
@ -13,25 +15,15 @@ class MutableMethodParameter(parameter: MethodParameter) : MethodParameter, Base
parameter.annotations.map { annotation -> annotation.toMutable() }.toMutableSet() parameter.annotations.map { annotation -> annotation.toMutable() }.toMutableSet()
} }
override fun getType(): String { override fun getType(): String = type
return type
}
override fun getName(): String? { override fun getName(): String? = name
return name
}
override fun getSignature(): String? { override fun getSignature(): String? = signature
return signature
}
override fun getAnnotations(): MutableSet<MutableAnnotation> { override fun getAnnotations(): MutableSet<MutableAnnotation> = _annotations
return _annotations
}
companion object { companion object {
fun MethodParameter.toMutable(): MutableMethodParameter { fun MethodParameter.toMutable(): MutableMethodParameter = MutableMethodParameter(this)
return MutableMethodParameter(this)
}
} }
} }

View file

@ -14,21 +14,15 @@ class MutableAnnotationEncodedValue(annotationEncodedValue: AnnotationEncodedVal
annotationEncodedValue.elements.map { annotationElement -> annotationElement.toMutable() }.toMutableSet() annotationEncodedValue.elements.map { annotationElement -> annotationElement.toMutable() }.toMutableSet()
} }
override fun getType(): String { override fun getType(): String = this.type
return this.type
}
fun setType(type: String) { fun setType(type: String) {
this.type = type this.type = type
} }
override fun getElements(): MutableSet<out AnnotationElement> { override fun getElements(): MutableSet<out AnnotationElement> = _elements
return _elements
}
companion object { companion object {
fun AnnotationEncodedValue.toMutable(): MutableAnnotationEncodedValue { fun AnnotationEncodedValue.toMutable(): MutableAnnotationEncodedValue = MutableAnnotationEncodedValue(this)
return MutableAnnotationEncodedValue(this)
}
} }
} }

View file

@ -5,18 +5,16 @@ import com.android.tools.smali.dexlib2.base.value.BaseArrayEncodedValue
import com.android.tools.smali.dexlib2.iface.value.ArrayEncodedValue import com.android.tools.smali.dexlib2.iface.value.ArrayEncodedValue
import com.android.tools.smali.dexlib2.iface.value.EncodedValue import com.android.tools.smali.dexlib2.iface.value.EncodedValue
class MutableArrayEncodedValue(arrayEncodedValue: ArrayEncodedValue) : BaseArrayEncodedValue(), MutableEncodedValue { class MutableArrayEncodedValue(arrayEncodedValue: ArrayEncodedValue) :
BaseArrayEncodedValue(),
MutableEncodedValue {
private val _value by lazy { private val _value by lazy {
arrayEncodedValue.value.map { encodedValue -> encodedValue.toMutable() }.toMutableList() arrayEncodedValue.value.map { encodedValue -> encodedValue.toMutable() }.toMutableList()
} }
override fun getValue(): MutableList<out EncodedValue> { override fun getValue(): MutableList<out EncodedValue> = _value
return _value
}
companion object { companion object {
fun ArrayEncodedValue.toMutable(): MutableArrayEncodedValue { fun ArrayEncodedValue.toMutable(): MutableArrayEncodedValue = MutableArrayEncodedValue(this)
return MutableArrayEncodedValue(this)
}
} }
} }

View file

@ -8,17 +8,13 @@ class MutableBooleanEncodedValue(booleanEncodedValue: BooleanEncodedValue) :
MutableEncodedValue { MutableEncodedValue {
private var value = booleanEncodedValue.value private var value = booleanEncodedValue.value
override fun getValue(): Boolean { override fun getValue(): Boolean = this.value
return this.value
}
fun setValue(value: Boolean) { fun setValue(value: Boolean) {
this.value = value this.value = value
} }
companion object { companion object {
fun BooleanEncodedValue.toMutable(): MutableBooleanEncodedValue { fun BooleanEncodedValue.toMutable(): MutableBooleanEncodedValue = MutableBooleanEncodedValue(this)
return MutableBooleanEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseByteEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseByteEncodedValue
import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue
class MutableByteEncodedValue(byteEncodedValue: ByteEncodedValue) : BaseByteEncodedValue(), MutableEncodedValue { class MutableByteEncodedValue(byteEncodedValue: ByteEncodedValue) :
BaseByteEncodedValue(),
MutableEncodedValue {
private var value = byteEncodedValue.value private var value = byteEncodedValue.value
override fun getValue(): Byte { override fun getValue(): Byte = this.value
return this.value
}
fun setValue(value: Byte) { fun setValue(value: Byte) {
this.value = value this.value = value
} }
companion object { companion object {
fun ByteEncodedValue.toMutable(): MutableByteEncodedValue { fun ByteEncodedValue.toMutable(): MutableByteEncodedValue = MutableByteEncodedValue(this)
return MutableByteEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseCharEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseCharEncodedValue
import com.android.tools.smali.dexlib2.iface.value.CharEncodedValue import com.android.tools.smali.dexlib2.iface.value.CharEncodedValue
class MutableCharEncodedValue(charEncodedValue: CharEncodedValue) : BaseCharEncodedValue(), MutableEncodedValue { class MutableCharEncodedValue(charEncodedValue: CharEncodedValue) :
BaseCharEncodedValue(),
MutableEncodedValue {
private var value = charEncodedValue.value private var value = charEncodedValue.value
override fun getValue(): Char { override fun getValue(): Char = this.value
return this.value
}
fun setValue(value: Char) { fun setValue(value: Char) {
this.value = value this.value = value
} }
companion object { companion object {
fun CharEncodedValue.toMutable(): MutableCharEncodedValue { fun CharEncodedValue.toMutable(): MutableCharEncodedValue = MutableCharEncodedValue(this)
return MutableCharEncodedValue(this)
}
} }
} }

View file

@ -8,17 +8,13 @@ class MutableDoubleEncodedValue(doubleEncodedValue: DoubleEncodedValue) :
MutableEncodedValue { MutableEncodedValue {
private var value = doubleEncodedValue.value private var value = doubleEncodedValue.value
override fun getValue(): Double { override fun getValue(): Double = this.value
return this.value
}
fun setValue(value: Double) { fun setValue(value: Double) {
this.value = value this.value = value
} }
companion object { companion object {
fun DoubleEncodedValue.toMutable(): MutableDoubleEncodedValue { fun DoubleEncodedValue.toMutable(): MutableDoubleEncodedValue = MutableDoubleEncodedValue(this)
return MutableDoubleEncodedValue(this)
}
} }
} }

View file

@ -4,20 +4,18 @@ import com.android.tools.smali.dexlib2.base.value.BaseEnumEncodedValue
import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.value.EnumEncodedValue import com.android.tools.smali.dexlib2.iface.value.EnumEncodedValue
class MutableEnumEncodedValue(enumEncodedValue: EnumEncodedValue) : BaseEnumEncodedValue(), MutableEncodedValue { class MutableEnumEncodedValue(enumEncodedValue: EnumEncodedValue) :
BaseEnumEncodedValue(),
MutableEncodedValue {
private var value = enumEncodedValue.value private var value = enumEncodedValue.value
override fun getValue(): FieldReference { override fun getValue(): FieldReference = this.value
return this.value
}
fun setValue(value: FieldReference) { fun setValue(value: FieldReference) {
this.value = value this.value = value
} }
companion object { companion object {
fun EnumEncodedValue.toMutable(): MutableEnumEncodedValue { fun EnumEncodedValue.toMutable(): MutableEnumEncodedValue = MutableEnumEncodedValue(this)
return MutableEnumEncodedValue(this)
}
} }
} }

View file

@ -5,24 +5,20 @@ import com.android.tools.smali.dexlib2.base.value.BaseFieldEncodedValue
import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.value.FieldEncodedValue import com.android.tools.smali.dexlib2.iface.value.FieldEncodedValue
class MutableFieldEncodedValue(fieldEncodedValue: FieldEncodedValue) : BaseFieldEncodedValue(), MutableEncodedValue { class MutableFieldEncodedValue(fieldEncodedValue: FieldEncodedValue) :
BaseFieldEncodedValue(),
MutableEncodedValue {
private var value = fieldEncodedValue.value private var value = fieldEncodedValue.value
override fun getValueType(): Int { override fun getValueType(): Int = ValueType.FIELD
return ValueType.FIELD
}
override fun getValue(): FieldReference { override fun getValue(): FieldReference = this.value
return this.value
}
fun setValue(value: FieldReference) { fun setValue(value: FieldReference) {
this.value = value this.value = value
} }
companion object { companion object {
fun FieldEncodedValue.toMutable(): MutableFieldEncodedValue { fun FieldEncodedValue.toMutable(): MutableFieldEncodedValue = MutableFieldEncodedValue(this)
return MutableFieldEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseFloatEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseFloatEncodedValue
import com.android.tools.smali.dexlib2.iface.value.FloatEncodedValue import com.android.tools.smali.dexlib2.iface.value.FloatEncodedValue
class MutableFloatEncodedValue(floatEncodedValue: FloatEncodedValue) : BaseFloatEncodedValue(), MutableEncodedValue { class MutableFloatEncodedValue(floatEncodedValue: FloatEncodedValue) :
BaseFloatEncodedValue(),
MutableEncodedValue {
private var value = floatEncodedValue.value private var value = floatEncodedValue.value
override fun getValue(): Float { override fun getValue(): Float = this.value
return this.value
}
fun setValue(value: Float) { fun setValue(value: Float) {
this.value = value this.value = value
} }
companion object { companion object {
fun FloatEncodedValue.toMutable(): MutableFloatEncodedValue { fun FloatEncodedValue.toMutable(): MutableFloatEncodedValue = MutableFloatEncodedValue(this)
return MutableFloatEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseIntEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseIntEncodedValue
import com.android.tools.smali.dexlib2.iface.value.IntEncodedValue import com.android.tools.smali.dexlib2.iface.value.IntEncodedValue
class MutableIntEncodedValue(intEncodedValue: IntEncodedValue) : BaseIntEncodedValue(), MutableEncodedValue { class MutableIntEncodedValue(intEncodedValue: IntEncodedValue) :
BaseIntEncodedValue(),
MutableEncodedValue {
private var value = intEncodedValue.value private var value = intEncodedValue.value
override fun getValue(): Int { override fun getValue(): Int = this.value
return this.value
}
fun setValue(value: Int) { fun setValue(value: Int) {
this.value = value this.value = value
} }
companion object { companion object {
fun IntEncodedValue.toMutable(): MutableIntEncodedValue { fun IntEncodedValue.toMutable(): MutableIntEncodedValue = MutableIntEncodedValue(this)
return MutableIntEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseLongEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseLongEncodedValue
import com.android.tools.smali.dexlib2.iface.value.LongEncodedValue import com.android.tools.smali.dexlib2.iface.value.LongEncodedValue
class MutableLongEncodedValue(longEncodedValue: LongEncodedValue) : BaseLongEncodedValue(), MutableEncodedValue { class MutableLongEncodedValue(longEncodedValue: LongEncodedValue) :
BaseLongEncodedValue(),
MutableEncodedValue {
private var value = longEncodedValue.value private var value = longEncodedValue.value
override fun getValue(): Long { override fun getValue(): Long = this.value
return this.value
}
fun setValue(value: Long) { fun setValue(value: Long) {
this.value = value this.value = value
} }
companion object { companion object {
fun LongEncodedValue.toMutable(): MutableLongEncodedValue { fun LongEncodedValue.toMutable(): MutableLongEncodedValue = MutableLongEncodedValue(this)
return MutableLongEncodedValue(this)
}
} }
} }

View file

@ -9,17 +9,13 @@ class MutableMethodEncodedValue(methodEncodedValue: MethodEncodedValue) :
MutableEncodedValue { MutableEncodedValue {
private var value = methodEncodedValue.value private var value = methodEncodedValue.value
override fun getValue(): MethodReference { override fun getValue(): MethodReference = this.value
return this.value
}
fun setValue(value: MethodReference) { fun setValue(value: MethodReference) {
this.value = value this.value = value
} }
companion object { companion object {
fun MethodEncodedValue.toMutable(): MutableMethodEncodedValue { fun MethodEncodedValue.toMutable(): MutableMethodEncodedValue = MutableMethodEncodedValue(this)
return MutableMethodEncodedValue(this)
}
} }
} }

View file

@ -9,17 +9,13 @@ class MutableMethodHandleEncodedValue(methodHandleEncodedValue: MethodHandleEnco
MutableEncodedValue { MutableEncodedValue {
private var value = methodHandleEncodedValue.value private var value = methodHandleEncodedValue.value
override fun getValue(): MethodHandleReference { override fun getValue(): MethodHandleReference = this.value
return this.value
}
fun setValue(value: MethodHandleReference) { fun setValue(value: MethodHandleReference) {
this.value = value this.value = value
} }
companion object { companion object {
fun MethodHandleEncodedValue.toMutable(): MutableMethodHandleEncodedValue { fun MethodHandleEncodedValue.toMutable(): MutableMethodHandleEncodedValue = MutableMethodHandleEncodedValue(this)
return MutableMethodHandleEncodedValue(this)
}
} }
} }

View file

@ -9,17 +9,13 @@ class MutableMethodTypeEncodedValue(methodTypeEncodedValue: MethodTypeEncodedVal
MutableEncodedValue { MutableEncodedValue {
private var value = methodTypeEncodedValue.value private var value = methodTypeEncodedValue.value
override fun getValue(): MethodProtoReference { override fun getValue(): MethodProtoReference = this.value
return this.value
}
fun setValue(value: MethodProtoReference) { fun setValue(value: MethodProtoReference) {
this.value = value this.value = value
} }
companion object { companion object {
fun MethodTypeEncodedValue.toMutable(): MutableMethodTypeEncodedValue { fun MethodTypeEncodedValue.toMutable(): MutableMethodTypeEncodedValue = MutableMethodTypeEncodedValue(this)
return MutableMethodTypeEncodedValue(this)
}
} }
} }

View file

@ -3,10 +3,10 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseNullEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseNullEncodedValue
import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue
class MutableNullEncodedValue : BaseNullEncodedValue(), MutableEncodedValue { class MutableNullEncodedValue :
BaseNullEncodedValue(),
MutableEncodedValue {
companion object { companion object {
fun ByteEncodedValue.toMutable(): MutableByteEncodedValue { fun ByteEncodedValue.toMutable(): MutableByteEncodedValue = MutableByteEncodedValue(this)
return MutableByteEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseShortEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseShortEncodedValue
import com.android.tools.smali.dexlib2.iface.value.ShortEncodedValue import com.android.tools.smali.dexlib2.iface.value.ShortEncodedValue
class MutableShortEncodedValue(shortEncodedValue: ShortEncodedValue) : BaseShortEncodedValue(), MutableEncodedValue { class MutableShortEncodedValue(shortEncodedValue: ShortEncodedValue) :
BaseShortEncodedValue(),
MutableEncodedValue {
private var value = shortEncodedValue.value private var value = shortEncodedValue.value
override fun getValue(): Short { override fun getValue(): Short = this.value
return this.value
}
fun setValue(value: Short) { fun setValue(value: Short) {
this.value = value this.value = value
} }
companion object { companion object {
fun ShortEncodedValue.toMutable(): MutableShortEncodedValue { fun ShortEncodedValue.toMutable(): MutableShortEncodedValue = MutableShortEncodedValue(this)
return MutableShortEncodedValue(this)
}
} }
} }

View file

@ -9,17 +9,13 @@ class MutableStringEncodedValue(stringEncodedValue: StringEncodedValue) :
MutableEncodedValue { MutableEncodedValue {
private var value = stringEncodedValue.value private var value = stringEncodedValue.value
override fun getValue(): String { override fun getValue(): String = this.value
return this.value
}
fun setValue(value: String) { fun setValue(value: String) {
this.value = value this.value = value
} }
companion object { companion object {
fun ByteEncodedValue.toMutable(): MutableByteEncodedValue { fun ByteEncodedValue.toMutable(): MutableByteEncodedValue = MutableByteEncodedValue(this)
return MutableByteEncodedValue(this)
}
} }
} }

View file

@ -3,20 +3,18 @@ package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
import com.android.tools.smali.dexlib2.base.value.BaseTypeEncodedValue import com.android.tools.smali.dexlib2.base.value.BaseTypeEncodedValue
import com.android.tools.smali.dexlib2.iface.value.TypeEncodedValue import com.android.tools.smali.dexlib2.iface.value.TypeEncodedValue
class MutableTypeEncodedValue(typeEncodedValue: TypeEncodedValue) : BaseTypeEncodedValue(), MutableEncodedValue { class MutableTypeEncodedValue(typeEncodedValue: TypeEncodedValue) :
BaseTypeEncodedValue(),
MutableEncodedValue {
private var value = typeEncodedValue.value private var value = typeEncodedValue.value
override fun getValue(): String { override fun getValue(): String = this.value
return this.value
}
fun setValue(value: String) { fun setValue(value: String) {
this.value = value this.value = value
} }
companion object { companion object {
fun TypeEncodedValue.toMutable(): MutableTypeEncodedValue { fun TypeEncodedValue.toMutable(): MutableTypeEncodedValue = MutableTypeEncodedValue(this)
return MutableTypeEncodedValue(this)
}
} }
} }