mirror of
https://github.com/skylot/jadx.git
synced 2024-11-27 06:31:15 +00:00
feat: add the option to always use source file name as class name alias (PR #2287)
This commit is contained in:
parent
7abbc81886
commit
b5e3dcf70f
@ -27,6 +27,7 @@ import jadx.api.JadxDecompiler;
|
||||
import jadx.api.args.GeneratedRenamesMappingFileMode;
|
||||
import jadx.api.args.IntegerFormat;
|
||||
import jadx.api.args.ResourceNameSource;
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.api.args.UserRenamesMappingsMode;
|
||||
import jadx.core.deobf.conditions.DeobfWhitelist;
|
||||
import jadx.core.utils.exceptions.JadxArgsValidateException;
|
||||
@ -166,8 +167,15 @@ public class JadxCLIArgs {
|
||||
)
|
||||
protected GeneratedRenamesMappingFileMode generatedRenamesMappingFileMode = GeneratedRenamesMappingFileMode.getDefault();
|
||||
|
||||
@Parameter(names = { "--deobf-use-sourcename" }, description = "use source file name as class name alias")
|
||||
protected boolean deobfuscationUseSourceNameAsAlias = false;
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
@Parameter(
|
||||
names = { "--deobf-use-sourcename" },
|
||||
description = "use source file name as class name alias."
|
||||
+ "\nDEPRECATED, use \"--use-source-name-as-class-name-alias\" instead",
|
||||
hidden = true
|
||||
)
|
||||
@Deprecated
|
||||
protected Boolean deobfuscationUseSourceNameAsAlias = null;
|
||||
|
||||
@Parameter(
|
||||
names = { "--deobf-res-name-source" },
|
||||
@ -179,6 +187,16 @@ public class JadxCLIArgs {
|
||||
)
|
||||
protected ResourceNameSource resourceNameSource = ResourceNameSource.AUTO;
|
||||
|
||||
@Parameter(
|
||||
names = { "--use-source-name-as-class-name-alias" },
|
||||
description = "use source name as class name alias:"
|
||||
+ "\n 'always' - always use source name if it's available"
|
||||
+ "\n 'if-better' - use source name if it seems better than the current one"
|
||||
+ "\n 'never' - never use source name, even if it's available",
|
||||
converter = UseSourceNameAsClassNameConverter.class
|
||||
)
|
||||
protected UseSourceNameAsClassNameAlias useSourceNameAsClassNameAlias = null;
|
||||
|
||||
@Parameter(
|
||||
names = { "--use-kotlin-methods-for-var-names" },
|
||||
description = "use kotlin intrinsic methods to rename variables, values: disable, apply, apply-and-hide",
|
||||
@ -327,7 +345,7 @@ public class JadxCLIArgs {
|
||||
args.setDeobfuscationMinLength(deobfuscationMinLength);
|
||||
args.setDeobfuscationMaxLength(deobfuscationMaxLength);
|
||||
args.setDeobfuscationWhitelist(Arrays.asList(deobfuscationWhitelistStr.split(" ")));
|
||||
args.setUseSourceNameAsClassAlias(deobfuscationUseSourceNameAsAlias);
|
||||
args.setUseSourceNameAsClassNameAlias(getUseSourceNameAsClassNameAlias());
|
||||
args.setUseKotlinMethodsForVarNames(useKotlinMethodsForVarNames);
|
||||
args.setResourceNameSource(resourceNameSource);
|
||||
args.setEscapeUnicode(escapeUnicode);
|
||||
@ -467,8 +485,23 @@ public class JadxCLIArgs {
|
||||
return generatedRenamesMappingFileMode;
|
||||
}
|
||||
|
||||
public UseSourceNameAsClassNameAlias getUseSourceNameAsClassNameAlias() {
|
||||
if (useSourceNameAsClassNameAlias != null) {
|
||||
return useSourceNameAsClassNameAlias;
|
||||
} else if (deobfuscationUseSourceNameAsAlias != null) {
|
||||
// noinspection deprecation
|
||||
return UseSourceNameAsClassNameAlias.create(deobfuscationUseSourceNameAsAlias);
|
||||
} else {
|
||||
return UseSourceNameAsClassNameAlias.getDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getUseSourceNameAsClassNameAlias()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isDeobfuscationUseSourceNameAsAlias() {
|
||||
return deobfuscationUseSourceNameAsAlias;
|
||||
return getUseSourceNameAsClassNameAlias().toBoolean();
|
||||
}
|
||||
|
||||
public ResourceNameSource getResourceNameSource() {
|
||||
@ -592,6 +625,12 @@ public class JadxCLIArgs {
|
||||
}
|
||||
}
|
||||
|
||||
public static class UseSourceNameAsClassNameConverter extends BaseEnumConverter<UseSourceNameAsClassNameAlias> {
|
||||
public UseSourceNameAsClassNameConverter() {
|
||||
super(UseSourceNameAsClassNameAlias::valueOf, UseSourceNameAsClassNameAlias::values);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DecompilationModeConverter extends BaseEnumConverter<DecompilationMode> {
|
||||
public DecompilationModeConverter() {
|
||||
super(DecompilationMode::valueOf, DecompilationMode::values);
|
||||
|
@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import jadx.api.JadxArgs;
|
||||
import jadx.api.JadxDecompiler;
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.core.clsp.ClsSet;
|
||||
import jadx.core.dex.nodes.RootNode;
|
||||
import jadx.core.utils.files.FileUtils;
|
||||
@ -47,7 +48,7 @@ public class ConvertToClsSet {
|
||||
// disable not needed passes executed at prepare stage
|
||||
jadxArgs.setDeobfuscationOn(false);
|
||||
jadxArgs.setRenameFlags(EnumSet.noneOf(JadxArgs.RenameEnum.class));
|
||||
jadxArgs.setUseSourceNameAsClassAlias(false);
|
||||
jadxArgs.setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias.NEVER);
|
||||
jadxArgs.setMoveInnerClasses(false);
|
||||
jadxArgs.setInlineAnonymousClasses(false);
|
||||
jadxArgs.setInlineMethods(false);
|
||||
|
@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||
import jadx.api.args.GeneratedRenamesMappingFileMode;
|
||||
import jadx.api.args.IntegerFormat;
|
||||
import jadx.api.args.ResourceNameSource;
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.api.args.UserRenamesMappingsMode;
|
||||
import jadx.api.data.ICodeData;
|
||||
import jadx.api.deobf.IAliasProvider;
|
||||
@ -98,7 +99,7 @@ public class JadxArgs implements Closeable {
|
||||
private UserRenamesMappingsMode userRenamesMappingsMode = UserRenamesMappingsMode.getDefault();
|
||||
|
||||
private boolean deobfuscationOn = false;
|
||||
private boolean useSourceNameAsClassAlias = false;
|
||||
private UseSourceNameAsClassNameAlias useSourceNameAsClassNameAlias = UseSourceNameAsClassNameAlias.getDefault();
|
||||
|
||||
private File generatedRenamesMappingFile = null;
|
||||
private GeneratedRenamesMappingFileMode generatedRenamesMappingFileMode = GeneratedRenamesMappingFileMode.getDefault();
|
||||
@ -430,12 +431,29 @@ public class JadxArgs implements Closeable {
|
||||
this.generatedRenamesMappingFileMode = mode;
|
||||
}
|
||||
|
||||
public boolean isUseSourceNameAsClassAlias() {
|
||||
return useSourceNameAsClassAlias;
|
||||
public UseSourceNameAsClassNameAlias getUseSourceNameAsClassNameAlias() {
|
||||
return useSourceNameAsClassNameAlias;
|
||||
}
|
||||
|
||||
public void setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias useSourceNameAsClassNameAlias) {
|
||||
this.useSourceNameAsClassNameAlias = useSourceNameAsClassNameAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getUseSourceNameAsClassNameAlias()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isUseSourceNameAsClassAlias() {
|
||||
return getUseSourceNameAsClassNameAlias().toBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setUseSourceNameAsClassAlias(boolean useSourceNameAsClassAlias) {
|
||||
this.useSourceNameAsClassAlias = useSourceNameAsClassAlias;
|
||||
final var useSourceNameAsClassNameAlias = UseSourceNameAsClassNameAlias.create(useSourceNameAsClassAlias);
|
||||
setUseSourceNameAsClassNameAlias(useSourceNameAsClassNameAlias);
|
||||
}
|
||||
|
||||
public int getDeobfuscationMinLength() {
|
||||
@ -729,10 +747,11 @@ public class JadxArgs implements Closeable {
|
||||
String argStr = "args:" + decompilationMode + useImports + showInconsistentCode
|
||||
+ inlineAnonymousClasses + inlineMethods + moveInnerClasses + allowInlineKotlinLambda
|
||||
+ deobfuscationOn + deobfuscationMinLength + deobfuscationMaxLength + deobfuscationWhitelist
|
||||
+ useSourceNameAsClassNameAlias
|
||||
+ resourceNameSource
|
||||
+ useKotlinMethodsForVarNames
|
||||
+ insertDebugLines + extractFinally
|
||||
+ debugInfo + useSourceNameAsClassAlias + escapeUnicode + replaceConsts
|
||||
+ debugInfo + escapeUnicode + replaceConsts
|
||||
+ respectBytecodeAccModifiers + fsCaseSensitive + renameFlags
|
||||
+ commentsLevel + useDxInput + integerFormat
|
||||
+ "|" + buildPluginsHash(decompiler);
|
||||
@ -768,7 +787,7 @@ public class JadxArgs implements Closeable {
|
||||
+ ", generatedRenamesMappingFile=" + generatedRenamesMappingFile
|
||||
+ ", generatedRenamesMappingFileMode=" + generatedRenamesMappingFileMode
|
||||
+ ", resourceNameSource=" + resourceNameSource
|
||||
+ ", useSourceNameAsClassAlias=" + useSourceNameAsClassAlias
|
||||
+ ", useSourceNameAsClassNameAlias=" + useSourceNameAsClassNameAlias
|
||||
+ ", useKotlinMethodsForVarNames=" + useKotlinMethodsForVarNames
|
||||
+ ", insertDebugLines=" + insertDebugLines
|
||||
+ ", extractFinally=" + extractFinally
|
||||
|
@ -0,0 +1,38 @@
|
||||
package jadx.api.args;
|
||||
|
||||
import jadx.core.utils.exceptions.JadxRuntimeException;
|
||||
|
||||
public enum UseSourceNameAsClassNameAlias {
|
||||
ALWAYS,
|
||||
IF_BETTER,
|
||||
NEVER;
|
||||
|
||||
public static UseSourceNameAsClassNameAlias getDefault() {
|
||||
return NEVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link UseSourceNameAsClassNameAlias} directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean toBoolean() {
|
||||
switch (this) {
|
||||
case IF_BETTER:
|
||||
return true;
|
||||
case NEVER:
|
||||
return false;
|
||||
case ALWAYS:
|
||||
throw new JadxRuntimeException("No match between " + this + " and boolean");
|
||||
default:
|
||||
throw new JadxRuntimeException("Unhandled strategy: " + this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link UseSourceNameAsClassNameAlias} directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static UseSourceNameAsClassNameAlias create(boolean useSourceNameAsAlias) {
|
||||
return useSourceNameAsAlias ? IF_BETTER : NEVER;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.api.plugins.input.data.attributes.JadxAttrType;
|
||||
import jadx.api.plugins.input.data.attributes.types.SourceFileAttr;
|
||||
import jadx.core.deobf.NameMapper;
|
||||
@ -18,6 +19,7 @@ import jadx.core.dex.visitors.AbstractVisitor;
|
||||
import jadx.core.utils.BetterName;
|
||||
import jadx.core.utils.StringUtils;
|
||||
import jadx.core.utils.exceptions.JadxException;
|
||||
import jadx.core.utils.exceptions.JadxRuntimeException;
|
||||
|
||||
public class SourceFileRename extends AbstractVisitor {
|
||||
|
||||
@ -28,9 +30,11 @@ public class SourceFileRename extends AbstractVisitor {
|
||||
|
||||
@Override
|
||||
public void init(RootNode root) throws JadxException {
|
||||
if (!root.getArgs().isUseSourceNameAsClassAlias()) {
|
||||
final var useSourceName = root.getArgs().getUseSourceNameAsClassNameAlias();
|
||||
if (useSourceName == UseSourceNameAsClassNameAlias.NEVER) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ClassNode> classes = root.getClasses();
|
||||
Map<String, Boolean> canUseAlias = new HashMap<>();
|
||||
for (ClassNode cls : classes) {
|
||||
@ -55,16 +59,15 @@ public class SourceFileRename extends AbstractVisitor {
|
||||
for (ClsRename clsRename : renames) {
|
||||
String alias = clsRename.getAlias();
|
||||
if (canUseAlias.get(alias) == Boolean.TRUE) {
|
||||
applyRename(clsRename.getCls(), alias);
|
||||
applyRename(clsRename.getCls(), alias, useSourceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyRename(ClassNode cls, String alias) {
|
||||
private static void applyRename(ClassNode cls, String alias, UseSourceNameAsClassNameAlias useSourceName) {
|
||||
if (cls.getClassInfo().hasAlias()) {
|
||||
// ignore source name if current alias is "better"
|
||||
String currentAlias = cls.getAlias();
|
||||
String betterName = BetterName.compareAndGet(alias, currentAlias);
|
||||
String betterName = getBetterName(currentAlias, alias, useSourceName);
|
||||
if (betterName.equals(currentAlias)) {
|
||||
return;
|
||||
}
|
||||
@ -73,6 +76,19 @@ public class SourceFileRename extends AbstractVisitor {
|
||||
cls.addAttr(new RenameReasonAttr(cls).append("use source file name"));
|
||||
}
|
||||
|
||||
private static String getBetterName(String currentName, String sourceName, UseSourceNameAsClassNameAlias useSourceName) {
|
||||
switch (useSourceName) {
|
||||
case ALWAYS:
|
||||
return sourceName;
|
||||
case IF_BETTER:
|
||||
return BetterName.compareAndGet(sourceName, currentName);
|
||||
case NEVER:
|
||||
return currentName;
|
||||
default:
|
||||
throw new JadxRuntimeException("Unhandled strategy: " + useSourceName);
|
||||
}
|
||||
}
|
||||
|
||||
private static @Nullable String getAliasFromSourceFile(ClassNode cls) {
|
||||
SourceFileAttr sourceFileAttr = cls.get(JadxAttrType.SOURCE_FILE);
|
||||
if (sourceFileAttr == null) {
|
||||
|
@ -1,40 +0,0 @@
|
||||
package jadx.tests.integration.deobf;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.tests.api.SmaliTest;
|
||||
|
||||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
|
||||
|
||||
public class TestBadSourceFile extends SmaliTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
// use source name disabled by default
|
||||
enableDeobfuscation();
|
||||
args.setDeobfuscationMinLength(100); // rename everything
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class C0000b {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithUseSourceName() {
|
||||
args.setUseSourceNameAsClassAlias(true);
|
||||
// deobfuscation disabled
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class a {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithUseSourceNameAndDeobf() {
|
||||
args.setUseSourceNameAsClassAlias(true);
|
||||
enableDeobfuscation();
|
||||
args.setDeobfuscationMinLength(100); // rename everything
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class C0000b {")
|
||||
.containsOne("/* compiled from: a.java */");
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package jadx.tests.integration.rename;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.tests.api.SmaliTest;
|
||||
|
||||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
|
||||
|
||||
public class TestUsingSourceFileName extends SmaliTest {
|
||||
|
||||
@Test
|
||||
public void testNeverUseSourceName() {
|
||||
args.setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias.NEVER);
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class b {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlwaysUseSourceName() {
|
||||
args.setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias.ALWAYS);
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class a {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNeverUseSourceNameWithDeobf() {
|
||||
args.setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias.NEVER);
|
||||
enableDeobfuscation();
|
||||
args.setDeobfuscationMinLength(100); // rename everything
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class C0000b {")
|
||||
.containsOne("/* compiled from: a.java */");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlwaysUseSourceNameWithDeobf() {
|
||||
args.setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias.ALWAYS);
|
||||
enableDeobfuscation();
|
||||
args.setDeobfuscationMinLength(100); // rename everything
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class a {")
|
||||
.containsOne("/* compiled from: a.java */");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeprecatedDontUseSourceName() {
|
||||
// noinspection deprecation
|
||||
args.setUseSourceNameAsClassAlias(false);
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class b {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeprecatedUseSourceName() {
|
||||
// noinspection deprecation
|
||||
args.setUseSourceNameAsClassAlias(true);
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class a {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeprecatedUseSourceNameWithDeobf() {
|
||||
// noinspection deprecation
|
||||
args.setUseSourceNameAsClassAlias(true);
|
||||
enableDeobfuscation();
|
||||
args.setDeobfuscationMinLength(100); // rename everything
|
||||
assertThat(searchCls(loadFromSmaliFiles(), "b"))
|
||||
.code()
|
||||
.containsOne("class C0000b {")
|
||||
.containsOne("/* compiled from: a.java */");
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ import jadx.core.utils.files.FileUtils;
|
||||
public class DiskCodeCache implements ICodeCache {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DiskCodeCache.class);
|
||||
|
||||
private static final int DATA_FORMAT_VERSION = 14;
|
||||
private static final int DATA_FORMAT_VERSION = 15;
|
||||
|
||||
private final Path baseDir;
|
||||
private final Path srcDir;
|
||||
|
@ -32,6 +32,7 @@ import jadx.api.JadxArgs;
|
||||
import jadx.api.args.GeneratedRenamesMappingFileMode;
|
||||
import jadx.api.args.IntegerFormat;
|
||||
import jadx.api.args.ResourceNameSource;
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.api.args.UserRenamesMappingsMode;
|
||||
import jadx.cli.JadxCLIArgs;
|
||||
import jadx.cli.LogHelper;
|
||||
@ -53,7 +54,7 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
|
||||
private static final Path USER_HOME = Paths.get(System.getProperty("user.home"));
|
||||
private static final int RECENT_PROJECTS_COUNT = 30;
|
||||
private static final int CURRENT_SETTINGS_VERSION = 21;
|
||||
private static final int CURRENT_SETTINGS_VERSION = 22;
|
||||
|
||||
private static final Font DEFAULT_FONT = new RSyntaxTextArea().getFont();
|
||||
|
||||
@ -400,8 +401,17 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
this.generatedRenamesMappingFileMode = mode;
|
||||
}
|
||||
|
||||
public void setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias useSourceNameAsClassNameAlias) {
|
||||
this.useSourceNameAsClassNameAlias = useSourceNameAsClassNameAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setUseSourceNameAsClassNameAlias(UseSourceNameAsClassNameAlias)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDeobfuscationUseSourceNameAsAlias(boolean deobfuscationUseSourceNameAsAlias) {
|
||||
this.deobfuscationUseSourceNameAsAlias = deobfuscationUseSourceNameAsAlias;
|
||||
final var useSourceName = UseSourceNameAsClassNameAlias.create(deobfuscationUseSourceNameAsAlias);
|
||||
setUseSourceNameAsClassNameAlias(useSourceName);
|
||||
}
|
||||
|
||||
public void setUseKotlinMethodsForVarNames(JadxArgs.UseKotlinMethodsForVarNames useKotlinMethodsForVarNames) {
|
||||
@ -829,6 +839,10 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
jadxUpdateChannel = JadxUpdateChannel.STABLE;
|
||||
fromVersion++;
|
||||
}
|
||||
if (fromVersion == 21) {
|
||||
migrateUseSourceNameAsClassNameAlias();
|
||||
fromVersion++;
|
||||
}
|
||||
if (fromVersion != CURRENT_SETTINGS_VERSION) {
|
||||
LOG.warn("Incorrect settings upgrade. Expected version: {}, got: {}", CURRENT_SETTINGS_VERSION, fromVersion);
|
||||
}
|
||||
@ -836,6 +850,14 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
sync();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void migrateUseSourceNameAsClassNameAlias() {
|
||||
final var deobfuscationUseSourceNameAsAlias = this.deobfuscationUseSourceNameAsAlias;
|
||||
if (deobfuscationUseSourceNameAsAlias != null) {
|
||||
useSourceNameAsClassNameAlias = UseSourceNameAsClassNameAlias.create(deobfuscationUseSourceNameAsAlias);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JadxCLIArgs newInstance() {
|
||||
return new JadxSettings();
|
||||
|
@ -54,6 +54,7 @@ import jadx.api.JadxDecompiler;
|
||||
import jadx.api.args.GeneratedRenamesMappingFileMode;
|
||||
import jadx.api.args.IntegerFormat;
|
||||
import jadx.api.args.ResourceNameSource;
|
||||
import jadx.api.args.UseSourceNameAsClassNameAlias;
|
||||
import jadx.api.plugins.events.JadxEvents;
|
||||
import jadx.api.plugins.gui.ISettingsGroup;
|
||||
import jadx.gui.settings.JadxSettings;
|
||||
@ -292,10 +293,10 @@ public class JadxSettingsWindow extends JDialog {
|
||||
needReload();
|
||||
});
|
||||
|
||||
JCheckBox deobfSourceAlias = new JCheckBox();
|
||||
deobfSourceAlias.setSelected(settings.isDeobfuscationUseSourceNameAsAlias());
|
||||
deobfSourceAlias.addItemListener(e -> {
|
||||
settings.setDeobfuscationUseSourceNameAsAlias(e.getStateChange() == ItemEvent.SELECTED);
|
||||
JComboBox<UseSourceNameAsClassNameAlias> useSourceNameAsClassNameAlias = new JComboBox<>(UseSourceNameAsClassNameAlias.values());
|
||||
useSourceNameAsClassNameAlias.setSelectedItem(settings.getUseSourceNameAsClassNameAlias());
|
||||
useSourceNameAsClassNameAlias.addActionListener(e -> {
|
||||
settings.setUseSourceNameAsClassNameAlias((UseSourceNameAsClassNameAlias) useSourceNameAsClassNameAlias.getSelectedItem());
|
||||
needReload();
|
||||
});
|
||||
|
||||
@ -303,7 +304,7 @@ public class JadxSettingsWindow extends JDialog {
|
||||
group.addRow(NLS.str("preferences.rename_case"), renameCaseSensitive);
|
||||
group.addRow(NLS.str("preferences.rename_valid"), renameValid);
|
||||
group.addRow(NLS.str("preferences.rename_printable"), renamePrintable);
|
||||
group.addRow(NLS.str("preferences.deobfuscation_source_alias"), deobfSourceAlias);
|
||||
group.addRow(NLS.str("preferences.rename_use_source_name_as_class_name_alias"), useSourceNameAsClassNameAlias);
|
||||
return group;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=Deobfuskierung aktivieren
|
||||
preferences.generated_renames_mapping_file_mode=Umgang mit Map-Dateien
|
||||
preferences.deobfuscation_min_len=Minimale Namenlänge
|
||||
preferences.deobfuscation_max_len=Maximale Namenlänge
|
||||
preferences.deobfuscation_source_alias=Quelldateiname als Klassennamen-Alias verwenden
|
||||
#preferences.deobfuscation_res_name_source=Better resources name source
|
||||
preferences.deobfuscation_whitelist=Pakete und Klassen von Deobfuskierung ausschließen
|
||||
preferences.deobfuscation_whitelist.editDialog=Whitelist für Deobfuskierung
|
||||
@ -248,6 +247,7 @@ preferences.rename=Umbenennen
|
||||
preferences.rename_case=System unterscheidet zwischen Groß/Kleinschreibung
|
||||
preferences.rename_valid=Ist eine gültige Kennung
|
||||
preferences.rename_printable=Ist druckbar
|
||||
preferences.rename_use_source_name_as_class_name_alias=Quelldateiname als Klassennamen-Alias verwenden
|
||||
preferences.search_group_title=Ressourcen durchsuchen
|
||||
#preferences.search_results_per_page=Results per page (0 - no limit)
|
||||
preferences.res_file_ext=Dateierweiterungen (z.B. .xml|.html), * bedeutet alle
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=Enable deobfuscation
|
||||
preferences.generated_renames_mapping_file_mode=Map file handle mode
|
||||
preferences.deobfuscation_min_len=Minimum name length
|
||||
preferences.deobfuscation_max_len=Maximum name length
|
||||
preferences.deobfuscation_source_alias=Use source file name as class name alias
|
||||
preferences.deobfuscation_res_name_source=Better resources name source
|
||||
preferences.deobfuscation_whitelist=Exclude packages and classes from deobfuscation
|
||||
preferences.deobfuscation_whitelist.editDialog=Whitelist for deobfuscation
|
||||
@ -248,6 +247,7 @@ preferences.rename=Rename identifiers
|
||||
preferences.rename_case=To fix case sensitivity issues
|
||||
preferences.rename_valid=To make them valid
|
||||
preferences.rename_printable=To make printable
|
||||
preferences.rename_use_source_name_as_class_name_alias=Use source file name as class name alias
|
||||
preferences.search_group_title=Search
|
||||
preferences.search_results_per_page=Results per page (0 - no limit)
|
||||
preferences.res_file_ext=Resource files extensions ('xml|html', * for all)
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=Activar desobfuscación
|
||||
#preferences.generated_renames_mapping_file_mode=Map file handle mode
|
||||
preferences.deobfuscation_min_len=Longitud mínima del nombre
|
||||
preferences.deobfuscation_max_len=Longitud máxima del nombre
|
||||
preferences.deobfuscation_source_alias=Usar el nombre del source como alias para la clase
|
||||
#preferences.deobfuscation_res_name_source=Better resources name source
|
||||
#preferences.deobfuscation_whitelist=Exclude packages and classes from deobfuscation
|
||||
#preferences.deobfuscation_whitelist.editDialog=Whitelist for deobfuscation
|
||||
@ -248,6 +247,7 @@ preferences.reset_title=Reestablecer preferencias
|
||||
#preferences.rename_case=
|
||||
#preferences.rename_valid=
|
||||
#preferences.rename_printable=
|
||||
preferences.rename_use_source_name_as_class_name_alias=Usar el nombre del source como alias para la clase
|
||||
#preferences.search_group_title=Search
|
||||
#preferences.search_results_per_page=Results per page (0 - no limit)
|
||||
#preferences.res_file_ext=Resource files extensions ('xml|html', * for all)
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=Aktifkan deobfikasi
|
||||
preferences.generated_renames_mapping_file_mode=Mode penanganan file pemetaan
|
||||
preferences.deobfuscation_min_len=Panjang nama minimum
|
||||
preferences.deobfuscation_max_len=Panjang nama maksimum
|
||||
preferences.deobfuscation_source_alias=Gunakan nama berkas sumber sebagai alias nama kelas
|
||||
preferences.deobfuscation_res_name_source=Sumber nama sumber daya yang lebih baik
|
||||
#preferences.deobfuscation_whitelist=Exclude packages and classes from deobfuscation
|
||||
#preferences.deobfuscation_whitelist.editDialog=Whitelist for deobfuscation
|
||||
@ -248,6 +247,7 @@ preferences.rename=Ganti nama identitas
|
||||
preferences.rename_case=Untuk memperbaiki masalah sensitivitas huruf besar-kecil
|
||||
preferences.rename_valid=Untuk membuatnya valid
|
||||
preferences.rename_printable=Untuk membuatnya dapat dicetak
|
||||
preferences.rename_use_source_name_as_class_name_alias=Gunakan nama berkas sumber sebagai alias nama kelas
|
||||
preferences.search_group_title=Pencarian
|
||||
preferences.search_results_per_page=Hasil per halaman (0 - tanpa batas)
|
||||
preferences.res_file_ext=Ekstensi berkas sumber daya ('xml|html', * untuk semua)
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=난독 해제 활성화
|
||||
preferences.generated_renames_mapping_file_mode=맵 파일 처리 모드
|
||||
preferences.deobfuscation_min_len=최소 이름 길이
|
||||
preferences.deobfuscation_max_len=최대 이름 길이
|
||||
preferences.deobfuscation_source_alias=소스 파일 이름을 클래스 이름 별칭으로 사용
|
||||
preferences.deobfuscation_res_name_source=더 나은 리소스 이름 소스
|
||||
#preferences.deobfuscation_whitelist=Exclude packages and classes from deobfuscation
|
||||
#preferences.deobfuscation_whitelist.editDialog=Whitelist for deobfuscation
|
||||
@ -248,6 +247,7 @@ preferences.rename=이름 바꾸기
|
||||
preferences.rename_case=시스템 대소문자 구분
|
||||
preferences.rename_valid=유효한 식별자로 바꾸기
|
||||
preferences.rename_printable=출력 가능하게 바꾸기
|
||||
preferences.rename_use_source_name_as_class_name_alias=소스 파일 이름을 클래스 이름 별칭으로 사용
|
||||
preferences.search_group_title=리소스 검색
|
||||
#preferences.search_results_per_page=Results per page (0 - no limit)
|
||||
preferences.res_file_ext=파일 확장자 (예: .xml|.html) (* 은 전체를 의미)
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=Ativar desofuscação
|
||||
#preferences.generated_renames_mapping_file_mode=Map file handle mode
|
||||
preferences.deobfuscation_min_len=Tamanho mínimo do nome
|
||||
preferences.deobfuscation_max_len=Tamanho máximo do nome
|
||||
preferences.deobfuscation_source_alias=Utilizar nome do arquivo como apelido da classe
|
||||
preferences.deobfuscation_res_name_source=Melhora nome da fonte dos recursos
|
||||
#preferences.deobfuscation_whitelist=Exclude packages and classes from deobfuscation
|
||||
#preferences.deobfuscation_whitelist.editDialog=Whitelist for deobfuscation
|
||||
@ -248,6 +247,7 @@ preferences.rename=Renomear identificadores
|
||||
preferences.rename_case=Corrigir problemas de capitalização (case sensitivity)
|
||||
preferences.rename_valid=Deixá-las válidas
|
||||
preferences.rename_printable=Deixá-las imprimíveis (printable)
|
||||
preferences.rename_use_source_name_as_class_name_alias=Utilizar nome do arquivo como apelido da classe
|
||||
preferences.search_group_title=Buscar recursos
|
||||
#preferences.search_results_per_page=Results per page (0 - no limit)
|
||||
preferences.res_file_ext=Extensões de arquivos (ex: .xml|.html), * significa todas
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=Включить деобфускацию
|
||||
preferences.generated_renames_mapping_file_mode=Режим обработки маппингов
|
||||
preferences.deobfuscation_min_len=Минимальная длина имени
|
||||
preferences.deobfuscation_max_len=Максимальная длина имени
|
||||
preferences.deobfuscation_source_alias=Иcпользовать атрибут SOURCE
|
||||
preferences.deobfuscation_res_name_source=Расшифровка имен ресурсов
|
||||
preferences.deobfuscation_whitelist=Исключить пакеты и классы из деобфускации
|
||||
preferences.deobfuscation_whitelist.editDialog=Белый список деобфускации
|
||||
@ -248,6 +247,7 @@ preferences.rename=Переименовать идентификаторы
|
||||
preferences.rename_case=И исправить проблемы именования
|
||||
preferences.rename_valid=И сделать их верными
|
||||
preferences.rename_printable=И сделать их доступными для печати
|
||||
preferences.rename_use_source_name_as_class_name_alias=Иcпользовать атрибут SOURCE
|
||||
preferences.search_group_title=Поиск
|
||||
preferences.search_results_per_page=Результатов на страницу (0 - без лимита)
|
||||
preferences.res_file_ext=Расширения файлов ресурсов ('xml|html', * для всех)
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=启用反混淆
|
||||
preferences.generated_renames_mapping_file_mode=映射文件句柄模式
|
||||
preferences.deobfuscation_min_len=最小命名长度
|
||||
preferences.deobfuscation_max_len=最大命名长度
|
||||
preferences.deobfuscation_source_alias=使用资源名作为类的别名
|
||||
preferences.deobfuscation_res_name_source=更好的资源名称来源
|
||||
preferences.deobfuscation_whitelist=从反混淆中排除包和类
|
||||
preferences.deobfuscation_whitelist.editDialog=反混淆白名单
|
||||
@ -248,6 +247,7 @@ preferences.rename=重命名标识符
|
||||
preferences.rename_case=标识符要能够区分大小写
|
||||
preferences.rename_valid=标识符应该符合标准规范
|
||||
preferences.rename_printable=标识符必须要能正常显示
|
||||
preferences.rename_use_source_name_as_class_name_alias=使用资源名作为类的别名
|
||||
preferences.search_group_title=搜索资源
|
||||
preferences.search_results_per_page=每页结果数(0 - 无限制)
|
||||
preferences.res_file_ext=文件扩展名(e.g. .xml|.html),* 表示所有
|
||||
|
@ -232,7 +232,6 @@ preferences.deobfuscation_on=啟用去模糊化
|
||||
preferences.generated_renames_mapping_file_mode=Map 檔案處理模式
|
||||
preferences.deobfuscation_min_len=最小名稱長度
|
||||
preferences.deobfuscation_max_len=最大名稱長度
|
||||
preferences.deobfuscation_source_alias=將原始檔案名稱作為類別別名
|
||||
preferences.deobfuscation_res_name_source=較佳的資源名稱來源
|
||||
#preferences.deobfuscation_whitelist=Exclude packages and classes from deobfuscation
|
||||
#preferences.deobfuscation_whitelist.editDialog=Whitelist for deobfuscation
|
||||
@ -248,6 +247,7 @@ preferences.rename=重新命名識別碼
|
||||
preferences.rename_case=以修復區分大小寫問題
|
||||
preferences.rename_valid=以使其有效
|
||||
preferences.rename_printable=以使其可列印
|
||||
preferences.rename_use_source_name_as_class_name_alias=將原始檔案名稱作為類別別名
|
||||
preferences.search_group_title=搜尋資源
|
||||
preferences.search_results_per_page=每頁的搜尋結果數 (0 - 無限制)
|
||||
preferences.res_file_ext=副檔名 (e.g. .xml|.html), * 表示全部
|
||||
|
Loading…
Reference in New Issue
Block a user