Skip to content

Commit 01c7f58

Browse files
committed
Fix an issue with Java 7 compilation
1 parent 54c6bc6 commit 01c7f58

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,13 @@ protected static ObjectMapper newObjectMapper() {
234234

235235
// @since 2.10
236236
protected static ObjectMapper.Builder objectMapperBuilder() {
237-
return (ObjectMapper.Builder)(Object) ObjectMapper.builder();
237+
/* 27-Aug-2018, tatu: Now this is weird -- with Java 7, we seem to need
238+
* explicit type parameters, but not with Java 8.
239+
* This need renders builder-approach pretty much useless for Java 7,
240+
* which is ok for 3.x (where baseline is Java 8), but potentially
241+
* problematic for 2.10. Oh well.
242+
*/
243+
return (ObjectMapper.Builder) ObjectMapper.<ObjectMapper,ObjectMapper.Builder>builder();
238244
}
239245

240246
// @since 2.7

src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public void testConfigForPropertySorting() throws Exception
228228
assertFalse(dc.shouldSortPropertiesAlphabetically());
229229

230230
// but when enabled, should be visible:
231-
m = ObjectMapper.builder()
231+
m = objectMapperBuilder()
232232
.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)
233233
.build();
234234
sc = m.getSerializationConfig();

src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerWithViews.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public void testIssue560() throws Exception
174174
A a = new A("myname", 29, "mysurname");
175175

176176
// Property SerializationConfig.SerializationFeature.DEFAULT_VIEW_INCLUSION set to false
177-
ObjectMapper mapper = ObjectMapper.builder()
177+
ObjectMapper mapper = objectMapperBuilder()
178178
.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, Boolean.FALSE)
179179
.addMixIn(A.class, AMixInAnnotation.class)
180180
.build();

0 commit comments

Comments
 (0)