-
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.
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver11.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,38 @@ | ||
package jadx.tests.integration.types; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.NotYetImplemented; | ||
import jadx.tests.api.IntegrationTest; | ||
|
||
public class TestTypeResolver11 extends IntegrationTest { | ||
|
||
public static class TestCls { | ||
public Void test(Object... objArr) { | ||
int val = (Integer) objArr[0]; | ||
String str = (String) objArr[1]; | ||
call(str, str, val, val); | ||
return null; | ||
} | ||
|
||
private void call(String a, String b, int... val) { | ||
} | ||
|
||
public void check() { | ||
test(1, "str"); | ||
} | ||
} | ||
|
||
@NotYetImplemented("Missing cast") | ||
@Test | ||
public void test() { | ||
getClassNode(TestCls.class); | ||
} | ||
|
||
@NotYetImplemented("Missing cast") | ||
@Test | ||
public void testNoDebug() { | ||
noDebugInfo(); | ||
getClassNode(TestCls.class); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver12.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,43 @@ | ||
package jadx.tests.integration.types; | ||
|
||
import java.lang.ref.WeakReference; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.NotYetImplemented; | ||
import jadx.tests.api.IntegrationTest; | ||
|
||
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; | ||
|
||
public class TestTypeResolver12 extends IntegrationTest { | ||
|
||
public abstract static class TestCls<T> { | ||
private WeakReference<T> ref; | ||
|
||
public void test(String str) { | ||
T obj = this.ref.get(); | ||
if (obj != null) { | ||
call(obj, str); | ||
} | ||
} | ||
|
||
public abstract void call(T t, String str); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
assertThat(getClassNode(TestCls.class)) | ||
.code() | ||
.containsOne("T obj = this.ref.get();"); | ||
} | ||
|
||
@NotYetImplemented("Generic type inference") | ||
@Test | ||
public void testNoDebug() { | ||
noDebugInfo(); | ||
assertThat(getClassNode(TestCls.class)) | ||
.code() | ||
.doesNotContain("Object obj") | ||
.containsOne("T obj = this.ref.get();"); | ||
} | ||
} |