1 package com.fasterxml.jackson.databind.type; 2 3 import com.fasterxml.jackson.databind.*; 4 5 public class TestGenericFieldInSubtype extends BaseMapTest 6 { 7 // [JACKSON-677] test677()8 public void test677() throws Exception 9 { 10 ObjectMapper mapper = new ObjectMapper(); 11 // and bit more checking as per later comments 12 JavaType t677 = mapper.constructType(Result677.Success677.class); 13 assertNotNull(t677); 14 Result677.Success677<Integer> s = new Result677.Success677<Integer>(Integer.valueOf(4)); 15 String json = mapper.writeValueAsString(s); 16 assertEquals("{\"value\":4}", json); 17 } 18 19 // [JACKSON-887] testInnerType()20 public void testInnerType() throws Exception 21 { 22 ObjectMapper mapper = new ObjectMapper(); 23 BaseType.SubType<?> r = mapper.readValue("{}", BaseType.SubType.class); 24 assertNotNull(r); 25 } 26 27 } 28 29 class Result677<T> { 30 public static class Success677<K> extends Result677<K> { 31 public K value; 32 Success677()33 public Success677() { } Success677(K k)34 public Success677(K k) { value = k; } 35 } 36 } 37 38 abstract class BaseType<T> { 39 public T value; 40 41 public final static class SubType<T extends Number> extends BaseType<T> 42 { 43 } 44 } 45