Commit 43de744c authored by Skylot's avatar Skylot

fix: don't reject type update for generics

parent 2dea6f55
...@@ -181,7 +181,6 @@ public final class TypeUpdate { ...@@ -181,7 +181,6 @@ public final class TypeUpdate {
return true; return true;
case WIDER: case WIDER:
case WIDER_BY_GENERIC:
return bound.getBound() != BoundEnum.USE; return bound.getBound() != BoundEnum.USE;
case NARROW: case NARROW:
...@@ -190,6 +189,7 @@ public final class TypeUpdate { ...@@ -190,6 +189,7 @@ public final class TypeUpdate {
} }
return true; return true;
case WIDER_BY_GENERIC:
case NARROW_BY_GENERIC: case NARROW_BY_GENERIC:
// allow replace object to same object with known generic type // allow replace object to same object with known generic type
// due to incomplete information about external methods and fields // due to incomplete information about external methods and fields
......
package jadx.tests.integration.types;
import org.junit.Test;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.junit.Assert.assertThat;
public class TestGenerics extends IntegrationTest {
public static class TestCls<T> {
private T data;
public TestCls<T> data(T t) {
this.data = t;
return this;
}
}
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("TestCls<T> data(T t) {"));
}
@Test
public void test2() {
// setFallback();
noDebugInfo();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("TestCls<T> data(T t) {"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment