-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: inline anonymous class wrongly handles field as Classname.this (PR
#2367) * fix: inline anonymous class wrongly handle Classname.this * add test case --------- Co-authored-by: Skylot <[email protected]>
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 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
40 changes: 40 additions & 0 deletions
40
jadx-core/src/test/java/jadx/tests/integration/inner/TestAnonymousClass22.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,40 @@ | ||
package jadx.tests.integration.inner; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.tests.api.IntegrationTest; | ||
|
||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; | ||
|
||
public class TestAnonymousClass22 extends IntegrationTest { | ||
|
||
public static class TestCls { | ||
|
||
public static class Parent { | ||
public static Parent test(Class<?> cls) { | ||
final AnotherClass another = new AnotherClass(); | ||
return new Parent() { | ||
@Override | ||
public String func() { | ||
return another.toString(); | ||
} | ||
}; | ||
} | ||
|
||
public String func() { | ||
return ""; | ||
} | ||
} | ||
|
||
public static class AnotherClass { | ||
} | ||
} | ||
|
||
@Test | ||
public void test() { | ||
assertThat(getClassNode(TestCls.class)) | ||
.code() | ||
.containsOne("return another.toString();") | ||
.doesNotContain("AnotherClass.this"); | ||
} | ||
} |