-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: force rename by checks from RenameVisitor (#432)
- Loading branch information
Showing
7 changed files
with
128 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
jadx-core/src/test/java/jadx/tests/integration/names/TestDuplicatedNames.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package jadx.tests.integration.names; | ||
|
||
import org.junit.Test; | ||
|
||
import jadx.core.dex.nodes.ClassNode; | ||
import jadx.tests.api.SmaliTest; | ||
|
||
import static jadx.tests.api.utils.JadxMatchers.containsOne; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public class TestDuplicatedNames extends SmaliTest { | ||
/* | ||
public static class TestCls { | ||
public Object fieldName; | ||
public String fieldName; | ||
public Object run() { | ||
return this.fieldName; | ||
} | ||
public String run() { | ||
return this.fieldName; | ||
} | ||
} | ||
*/ | ||
@Test | ||
public void test() { | ||
commonChecks(); | ||
} | ||
|
||
@Test | ||
public void testWithDeobf() { | ||
enableDeobfuscation(); | ||
commonChecks(); | ||
} | ||
|
||
private void commonChecks() { | ||
ClassNode cls = getClassNodeFromSmaliWithPath("names", "TestDuplicatedNames"); | ||
String code = cls.getCode().toString(); | ||
|
||
assertThat(code, containsOne("Object fieldName;")); | ||
assertThat(code, containsOne("String f0fieldName")); | ||
|
||
assertThat(code, containsOne("this.fieldName")); | ||
assertThat(code, containsOne("this.f0fieldName")); | ||
|
||
assertThat(code, containsOne("public Object run() {")); | ||
assertThat(code, containsOne("public String m0run() {")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.class public LTestDuplicatedNames; | ||
.super Ljava/lang/Object; | ||
.source "TestDuplicatedNames.java" | ||
|
||
|
||
# instance fields | ||
.field public fieldName:Ljava/lang/String; | ||
.field public fieldName:Ljava/lang/Object; | ||
|
||
|
||
# direct methods | ||
.method public constructor <init>()V | ||
.registers 1 | ||
|
||
.prologue | ||
.line 3 | ||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V | ||
|
||
return-void | ||
.end method | ||
|
||
|
||
# virtual methods | ||
.method public run()Ljava/lang/String; | ||
.registers 2 | ||
|
||
.prologue | ||
iget-object v0, p0, LTestDuplicatedNames;->fieldName:Ljava/lang/String; | ||
|
||
return-object v0 | ||
.end method | ||
|
||
.method public run()Ljava/lang/Object; | ||
.registers 2 | ||
|
||
.prologue | ||
iget-object v0, p0, LTestDuplicatedNames;->fieldName:Ljava/lang/Object; | ||
|
||
return-object v0 | ||
.end method |