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;
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) {
......
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;
}
......
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