Skip to content

Commit b577d7f

Browse files
committed
Minor cleanup
1 parent 4643caa commit b577d7f

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

src/main/java/com/fasterxml/jackson/databind/type/TypeBindings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void _addPlaceholder(String name) {
239239
protected void _resolveBindings(Type t)
240240
{
241241
if (t == null) return;
242-
242+
243243
Class<?> raw;
244244
if (t instanceof ParameterizedType) {
245245
ParameterizedType pt = (ParameterizedType) t;

src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ protected JavaType _fromParamType(ParameterizedType type, TypeBindings context)
876876

877877
// Ok: Map or Collection?
878878
if (Map.class.isAssignableFrom(rawType)) {
879+
// 19-Mar-2015, tatu: Looks like 2nd arg ough to be Map.class, but that causes fails
879880
JavaType subtype = constructSimpleType(rawType, rawType, pt);
880881
JavaType[] mapParams = findTypeParameters(subtype, Map.class);
881882
if (mapParams.length != 2) {
@@ -884,6 +885,7 @@ protected JavaType _fromParamType(ParameterizedType type, TypeBindings context)
884885
return MapType.construct(rawType, mapParams[0], mapParams[1]);
885886
}
886887
if (Collection.class.isAssignableFrom(rawType)) {
888+
// 19-Mar-2015, tatu: Looks like 2nd arg ough to be Collection.class, but that causes fails
887889
JavaType subtype = constructSimpleType(rawType, rawType, pt);
888890
JavaType[] collectionParams = findTypeParameters(subtype, Collection.class);
889891
if (collectionParams.length != 1) {

src/test/java/com/fasterxml/jackson/databind/ser/TestMapSerialization.java

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -144,32 +144,6 @@ static class MapWithTypedValues extends LinkedHashMap<String,String> { }
144144
@JsonTypeInfo(use = Id.CLASS)
145145
public static class Mixin691 { }
146146

147-
// For [databind#47]
148-
149-
public static class Wat
150-
{
151-
private final String wat;
152-
153-
@JsonCreator
154-
Wat(String wat) {
155-
this.wat = wat;
156-
}
157-
158-
@JsonValue
159-
public String getWat() {
160-
return wat;
161-
}
162-
163-
@Override
164-
public String toString() {
165-
return "(String)[Wat: " + wat + "]";
166-
}
167-
}
168-
169-
// For [databind#47]
170-
@SuppressWarnings("serial")
171-
static class WatMap extends HashMap<Wat,Boolean> { }
172-
173147
/*
174148
/**********************************************************
175149
/* Test methods
@@ -302,15 +276,15 @@ public void testNonNullValueMapViaProp() throws IOException
302276
}
303277

304278
// [databind#47]
305-
public void testMapJsonValueKey() throws Exception
279+
public void testMapJsonValueKey47() throws Exception
306280
{
307281
WatMap input = new WatMap();
308282
input.put(new Wat("3"), true);
309283

310284
ObjectMapper mapper = new ObjectMapper();
311285
String json = mapper.writeValueAsString(input);
312286
assertEquals(aposToQuotes("{'3':true}"), json);
313-
}
287+
}
314288

315289
// [databind#682]
316290
public void testClassKey() throws IOException
@@ -344,14 +318,4 @@ public void testNullJsonInTypedMap691() throws Exception {
344318
String json = mapper.writeValueAsString(map);
345319
assertEquals("{\"@class\":\"java.util.HashMap\",\"NULL\":null}", json);
346320
}
347-
348-
public void testMapJsonValueKey47() throws Exception
349-
{
350-
WatMap input = new WatMap();
351-
input.put(new Wat("3"), true);
352-
353-
ObjectMapper mapper = new ObjectMapper();
354-
String json = mapper.writeValueAsString(input);
355-
assertEquals(aposToQuotes("{'3':true}"), json);
356-
}
357321
}

src/test/java/com/fasterxml/jackson/databind/type/TestTypeBindings.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public void testAbstract() throws Exception
4545
TypeBindings b = new TypeBindings(tf, AbstractType.class);
4646
assertEquals(2, b.getBindingCount());
4747
JavaType obType = tf.constructType(Object.class);
48-
assertEquals(obType, b.findType("A"));
49-
assertEquals(obType, b.findType("B"));
48+
assertEquals(obType, b.findType("A", true));
49+
assertEquals(obType, b.findType("B", true));
5050
}
5151

5252
public void testSimple() throws Exception
@@ -55,8 +55,8 @@ public void testSimple() throws Exception
5555
// concrete class does have bindings however
5656
TypeBindings b = new TypeBindings(tf, LongStringType.class);
5757
assertEquals(2, b.getBindingCount());
58-
assertEquals(tf.constructType(Long.class), b.findType("A"));
59-
assertEquals(tf.constructType(String.class), b.findType("B"));
58+
assertEquals(tf.constructType(Long.class), b.findType("A", true));
59+
assertEquals(tf.constructType(String.class), b.findType("B", true));
6060
}
6161

6262

0 commit comments

Comments
 (0)