test: add MissingGenericsTypesTest (PR #498)
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package jadx.tests.api.utils;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import jadx.NotYetImplementedExtension;
|
||||
import jadx.core.codegen.CodeWriter;
|
||||
|
||||
@ExtendWith(NotYetImplementedExtension.class)
|
||||
public class TestUtils {
|
||||
|
||||
public static String indent(int indent) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package jadx.tests.integration.generics;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jadx.NotYetImplemented;
|
||||
import jadx.core.dex.nodes.ClassNode;
|
||||
import jadx.tests.api.SmaliTest;
|
||||
|
||||
public class MissingGenericsTypesTest extends SmaliTest {
|
||||
|
||||
/*
|
||||
private int x;
|
||||
|
||||
public void test() {
|
||||
Map<String, String> map = new HashMap();
|
||||
x = 1;
|
||||
for (String s : map.keySet()) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
@NotYetImplemented
|
||||
public void test() {
|
||||
ClassNode cls = getClassNodeFromSmaliWithPath("generics", "MissingGenericsTypesTest");
|
||||
String code = cls.getCode().toString();
|
||||
|
||||
assertThat(code, containsString("Map<String"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
.class public LMissingGenericsTypesTest;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
# instance fields
|
||||
.field private x:I
|
||||
|
||||
|
||||
# direct methods
|
||||
.method public constructor <init>()V
|
||||
.locals 0
|
||||
|
||||
.line 9
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public test()V
|
||||
.locals 3
|
||||
|
||||
.line 14
|
||||
new-instance v0, Ljava/util/HashMap;
|
||||
|
||||
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
|
||||
|
||||
const/4 v1, 0x1
|
||||
|
||||
.line 15
|
||||
iput v1, p0, LMissingGenericsTypesTest;->x:I
|
||||
|
||||
.line 16
|
||||
invoke-interface {v0}, Ljava/util/Map;->keySet()Ljava/util/Set;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
:goto_0
|
||||
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
||||
|
||||
move-result v1
|
||||
|
||||
if-eqz v1, :cond_0
|
||||
|
||||
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
check-cast v1, Ljava/lang/String;
|
||||
|
||||
.line 17
|
||||
sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
|
||||
|
||||
invoke-virtual {v2, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
return-void
|
||||
.end method
|
||||
Reference in New Issue
Block a user