Skip to content

Commit 3bcde97

Browse files
authored
Merge pull request #1457 from Spikhalskiy/1456-failingTest
Provide a failing test for the issue #1456
2 parents 8771ed4 + 7703813 commit 3bcde97

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
4+
import com.fasterxml.jackson.databind.JavaType;
5+
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import org.junit.Test;
7+
8+
import java.lang.reflect.Method;
9+
import java.lang.reflect.Type;
10+
11+
import static org.junit.Assert.assertEquals;
12+
13+
public class GenericParameterTypeFactory1456Test {
14+
public static class BaseController<Entity extends BaseEntity> {
15+
public void process(Entity entity) {}
16+
}
17+
18+
public static class ImplController extends BaseController<ImplEntity> {}
19+
20+
public static class BaseEntity {}
21+
22+
public static class ImplEntity extends BaseEntity {}
23+
24+
@Test
25+
public void testGenericParameterHierarchy() throws NoSuchMethodException {
26+
Method proceed = BaseController.class.getMethod("process", BaseEntity.class);
27+
Type entityType = proceed.getGenericParameterTypes()[0];
28+
29+
JavaType resolvedType = new ObjectMapper().getTypeFactory().constructType(entityType, ImplController.class);
30+
assertEquals(ImplEntity.class, resolvedType.getRawClass());
31+
}
32+
}

0 commit comments

Comments
 (0)