refactor: resolve deprecation warning for TypeGen.literalToString method
This commit is contained in:
@@ -3,7 +3,6 @@ package jadx.core.codegen;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import jadx.api.JadxArgs;
|
||||
import jadx.core.deobf.NameMapper;
|
||||
import jadx.core.dex.instructions.args.ArgType;
|
||||
import jadx.core.dex.instructions.args.PrimitiveType;
|
||||
@@ -38,12 +37,7 @@ public class TypeGen {
|
||||
return literalToString(lit, type, dexNode.root().getStringUtils());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String literalToString(long lit, ArgType type) {
|
||||
return literalToString(lit, type, new StringUtils(new JadxArgs()));
|
||||
}
|
||||
|
||||
private static String literalToString(long lit, ArgType type, StringUtils stringUtils) {
|
||||
public static String literalToString(long lit, ArgType type, StringUtils stringUtils) {
|
||||
if (type == null || !type.isTypeKnown()) {
|
||||
String n = Long.toString(lit);
|
||||
if (Math.abs(lit) > 100) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package jadx.core.dex.instructions.args;
|
||||
|
||||
import jadx.api.JadxArgs;
|
||||
import jadx.core.codegen.TypeGen;
|
||||
import jadx.core.utils.StringUtils;
|
||||
import jadx.core.utils.exceptions.JadxRuntimeException;
|
||||
|
||||
public final class LiteralArg extends InsnArg {
|
||||
@@ -63,10 +65,12 @@ public final class LiteralArg extends InsnArg {
|
||||
return literal == that.literal && getType().equals(that.getType());
|
||||
}
|
||||
|
||||
private static final StringUtils DEF_STRING_UTILS = new StringUtils(new JadxArgs());
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
String value = TypeGen.literalToString(literal, getType());
|
||||
String value = TypeGen.literalToString(literal, getType(), DEF_STRING_UTILS);
|
||||
if (getType().equals(ArgType.BOOLEAN) && (value.equals("true") || value.equals("false"))) {
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user