[#1247] Add test which shows the problem with concrete classes that pass in the type based on a generic

This commit is contained in:
Norman Maurer 2013-04-10 07:08:08 +02:00
parent e8ee6a2772
commit 73db1f886d

View File

@ -16,8 +16,11 @@
package io.netty.util.internal;
import org.junit.Ignore;
import org.junit.Test;
import java.util.Date;
import static org.junit.Assert.*;
public class TypeParameterMatcherTest {
@ -128,4 +131,20 @@ public class TypeParameterMatcherTest {
TypeParameterMatcher m = TypeParameterMatcher.find(new V<String>().u, U.class, "E");
assertTrue(m.match(new Object()));
}
private abstract class W<E> {
// Noop
}
private class X<T, E> extends W<E> {
// Noop
}
@Ignore("Fail currently because of #1247")
@Test
public void testConcreteClassWithGeneric() throws Exception {
TypeParameterMatcher m = TypeParameterMatcher.find(new X<String, Date>(), W.class, "E");
assertTrue(m.match(new Date()));
assertFalse(m.match(new Object()));
}
}