Commit 28bcad20 authored by Skylot's avatar Skylot

refactor: resolve deprecation warning for TypeGen.literalToString method

parent 16d8d41b
...@@ -3,7 +3,6 @@ package jadx.core.codegen; ...@@ -3,7 +3,6 @@ package jadx.core.codegen;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import jadx.api.JadxArgs;
import jadx.core.deobf.NameMapper; import jadx.core.deobf.NameMapper;
import jadx.core.dex.instructions.args.ArgType; import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.PrimitiveType; import jadx.core.dex.instructions.args.PrimitiveType;
...@@ -38,12 +37,7 @@ public class TypeGen { ...@@ -38,12 +37,7 @@ public class TypeGen {
return literalToString(lit, type, dexNode.root().getStringUtils()); return literalToString(lit, type, dexNode.root().getStringUtils());
} }
@Deprecated public static String literalToString(long lit, ArgType type, StringUtils stringUtils) {
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) {
if (type == null || !type.isTypeKnown()) { if (type == null || !type.isTypeKnown()) {
String n = Long.toString(lit); String n = Long.toString(lit);
if (Math.abs(lit) > 100) { if (Math.abs(lit) > 100) {
......
package jadx.core.dex.instructions.args; package jadx.core.dex.instructions.args;
import jadx.api.JadxArgs;
import jadx.core.codegen.TypeGen; import jadx.core.codegen.TypeGen;
import jadx.core.utils.StringUtils;
import jadx.core.utils.exceptions.JadxRuntimeException; import jadx.core.utils.exceptions.JadxRuntimeException;
public final class LiteralArg extends InsnArg { public final class LiteralArg extends InsnArg {
...@@ -63,10 +65,12 @@ public final class LiteralArg extends InsnArg { ...@@ -63,10 +65,12 @@ public final class LiteralArg extends InsnArg {
return literal == that.literal && getType().equals(that.getType()); return literal == that.literal && getType().equals(that.getType());
} }
private static final StringUtils DEF_STRING_UTILS = new StringUtils(new JadxArgs());
@Override @Override
public String toString() { public String toString() {
try { 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"))) { if (getType().equals(ArgType.BOOLEAN) && (value.equals("true") || value.equals("false"))) {
return value; return value;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment