fix: build correct file path for class from default package (#2854)

This commit is contained in:
Skylot
2026-04-20 19:17:42 +01:00
parent 27c283fb11
commit 97fa8ff210
3 changed files with 16 additions and 3 deletions
@@ -73,4 +73,12 @@ public class TestInput extends BaseCliIntegrationTest {
path -> path.getFileName().toString().equalsIgnoreCase("AndroidManifest.xml")); path -> path.getFileName().toString().equalsIgnoreCase("AndroidManifest.xml"));
assertThat(files).isNotEmpty(); assertThat(files).isNotEmpty();
} }
@Test
public void testNoRenameForDefPkg() throws Exception {
int result = execJadxCli(buildArgs(List.of("--rename-flags", "none"), "samples/defpkg.smali"));
assertThat(result).isEqualTo(0);
List<Path> files = collectJavaFilesInDir(outputDir);
assertThat(files).hasSize(1);
}
} }
@@ -0,0 +1,2 @@
.class public LA;
.super Ljava/lang/Object;
@@ -214,9 +214,12 @@ public final class ClassInfo implements Comparable<ClassInfo> {
} }
public String getAliasFullPath() { public String getAliasFullPath() {
return getAliasPkg().replace('.', File.separatorChar) String fileName = getAliasNameWithoutPackage().replace('.', '_');
+ File.separatorChar String aliasPkg = getAliasPkg();
+ getAliasNameWithoutPackage().replace('.', '_'); if (aliasPkg.isEmpty()) {
return fileName;
}
return aliasPkg.replace('.', File.separatorChar) + File.separatorChar + fileName;
} }
public String getFullName() { public String getFullName() {