mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 00:54:25 +02:00
Fix up makeDefaultValueForType method
1. Remove the unused DexFile parameter 2. Add a convenience wrapper that accepts a TypeIdItem
This commit is contained in:
parent
662e425150
commit
0d2ce20ee4
@ -359,8 +359,8 @@ public class ClassDefItem extends Item<ClassDefItem> {
|
||||
StaticFieldInitializer staticFieldInitializer = staticFieldInitializers.get(i);
|
||||
|
||||
if (staticFieldInitializer.value != null &&
|
||||
(staticFieldInitializer.value.compareTo(TypeUtils.makeDefaultValueForType(dexFile,
|
||||
staticFieldInitializer.field.field.getFieldType().getTypeDescriptor())) != 0)) {
|
||||
(staticFieldInitializer.value.compareTo(TypeUtils.makeDefaultValueForType(
|
||||
staticFieldInitializer.field.field.getFieldType())) != 0)) {
|
||||
lastIndex = i;
|
||||
break;
|
||||
}
|
||||
@ -377,8 +377,7 @@ public class ClassDefItem extends Item<ClassDefItem> {
|
||||
StaticFieldInitializer staticFieldInitializer = staticFieldInitializers.get(i);
|
||||
EncodedValue encodedValue = staticFieldInitializer.value;
|
||||
if (encodedValue == null) {
|
||||
encodedValue = TypeUtils.makeDefaultValueForType(dexFile,
|
||||
staticFieldInitializer.field.field.getFieldType().getTypeDescriptor());
|
||||
encodedValue = TypeUtils.makeDefaultValueForType(staticFieldInitializer.field.field.getFieldType());
|
||||
}
|
||||
|
||||
values[i] = encodedValue;
|
||||
|
@ -28,13 +28,12 @@
|
||||
|
||||
package org.jf.dexlib.Util;
|
||||
|
||||
import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.EncodedValue.*;
|
||||
import org.jf.dexlib.TypeIdItem;
|
||||
|
||||
public class TypeUtils
|
||||
{
|
||||
public static EncodedValue makeDefaultValueForType(DexFile dexFile, String type) {
|
||||
EncodedValue subField;
|
||||
public static EncodedValue makeDefaultValueForType(String type) {
|
||||
switch (type.charAt(0)) {
|
||||
case 'Z':
|
||||
return BooleanEncodedValue.FalseValue;
|
||||
@ -58,4 +57,8 @@ public class TypeUtils
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EncodedValue makeDefaultValueForType(TypeIdItem type) {
|
||||
return makeDefaultValueForType(type.getTypeDescriptor());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user