提交 f57dfb3f 编写于 作者: S Skylot

test: check method override with generic arguments (#701)

上级 c3f7a049
package jadx.tests.integration.generics;
import org.junit.jupiter.api.Test;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.hamcrest.MatcherAssert.assertThat;
public class TestGenericsMthOverride extends IntegrationTest {
public static class TestCls {
public interface I<X, Y> {
Y method(X x);
}
public static class A<X, Y> implements I<X, Y> {
@Override
public Y method(X x) {
return null;
}
}
public static class B<X, Y> implements I<X, Y> {
@Override
public Y method(Object x) {
return null;
}
}
public static class C<X extends Exception, Y> implements I<X, Y> {
@Override
public Y method(Exception x) {
return null;
}
}
public static class D<X, Y> implements I<X, Y> {
@Override
public Object method(Object x) {
return null;
}
}
}
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
assertThat(code, containsOne("public Y method(X x) {"));
assertThat(code, containsOne("public Y method(Object x) {"));
assertThat(code, containsOne("public Y method(Exception x) {"));
assertThat(code, containsOne("public Object method(Object x) {"));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册