@@ -92,6 +92,9 @@ public class RenameVisitor extends AbstractVisitor {
|
||||
if (firstChar == '$') {
|
||||
return 'C' + NameMapper.removeInvalidCharsMiddle(clsName);
|
||||
}
|
||||
if (!NameMapper.isValidIdentifier(clsName)) {
|
||||
return 'C' + clsName;
|
||||
}
|
||||
return NameMapper.removeInvalidChars(clsName, "C");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package jadx.tests.integration.names;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import jadx.core.dex.nodes.ClassNode;
|
||||
import jadx.tests.api.SmaliTest;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class TestReservedClassNames extends SmaliTest {
|
||||
/*
|
||||
public class do {
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
ClassNode cls = getClassNodeFromSmali("names" + File.separatorChar + "TestReservedClassNames", "do");
|
||||
String code = cls.getCode().toString();
|
||||
|
||||
assertThat(code, not(containsString("public class do")));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
.class public Ldo;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
# direct methods
|
||||
.method public constructor <init>()V
|
||||
.locals 0
|
||||
|
||||
.line 3
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
Reference in New Issue
Block a user