Skip to content

Commit f7780a4

Browse files
committed
Warnings removal
1 parent 2445f78 commit f7780a4

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalBasicTest.java

+32-31
Original file line numberDiff line numberDiff line change
@@ -157,44 +157,45 @@ public void testSerOptDefault() throws Exception {
157157
assertEquals("{\"myString\":null}", value);
158158
}
159159

160-
public void testSerOptNull() throws Exception {
161-
OptionalData data = new OptionalData();
162-
data.myString = null;
163-
String value = mapperWithModule().setSerializationInclusion(
164-
JsonInclude.Include.NON_NULL).writeValueAsString(data);
165-
assertEquals("{}", value);
166-
}
160+
public void testSerOptNull() throws Exception {
161+
OptionalData data = new OptionalData();
162+
data.myString = null;
163+
String value = mapperWithModule().setSerializationInclusion(
164+
JsonInclude.Include.NON_NULL).writeValueAsString(data);
165+
assertEquals("{}", value);
166+
}
167167

168-
public void testSerOptDisableAsNull() throws Exception {
169-
final OptionalData data = new OptionalData();
170-
data.myString = Optional.empty();
168+
@SuppressWarnings("deprecation")
169+
public void testSerOptDisableAsNull() throws Exception {
170+
final OptionalData data = new OptionalData();
171+
data.myString = Optional.empty();
171172

172-
Jdk8Module mod = new Jdk8Module().configureAbsentsAsNulls(false);
173-
ObjectMapper mapper = new ObjectMapper().registerModule(mod)
174-
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
173+
Jdk8Module mod = new Jdk8Module().configureAbsentsAsNulls(false);
174+
ObjectMapper mapper = new ObjectMapper().registerModule(mod)
175+
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
175176

176-
assertEquals("{\"myString\":null}", mapper.writeValueAsString(data));
177+
assertEquals("{\"myString\":null}", mapper.writeValueAsString(data));
177178

178-
// but do exclude with NON_EMPTY
179-
mapper = new ObjectMapper().registerModule(mod)
180-
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
181-
assertEquals("{}", mapper.writeValueAsString(data));
179+
// but do exclude with NON_EMPTY
180+
mapper = new ObjectMapper().registerModule(mod)
181+
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
182+
assertEquals("{}", mapper.writeValueAsString(data));
182183

183-
// and with new (2.6) NON_ABSENT
184-
mapper = new ObjectMapper().registerModule(mod)
185-
.setSerializationInclusion(JsonInclude.Include.NON_ABSENT);
186-
assertEquals("{}", mapper.writeValueAsString(data));
187-
}
184+
// and with new (2.6) NON_ABSENT
185+
mapper = new ObjectMapper().registerModule(mod)
186+
.setSerializationInclusion(JsonInclude.Include.NON_ABSENT);
187+
assertEquals("{}", mapper.writeValueAsString(data));
188+
}
188189

189-
public void testSerOptNonEmpty() throws Exception {
190-
OptionalData data = new OptionalData();
191-
data.myString = null;
192-
String value = mapperWithModule().setSerializationInclusion(
193-
JsonInclude.Include.NON_EMPTY).writeValueAsString(data);
194-
assertEquals("{}", value);
195-
}
190+
public void testSerOptNonEmpty() throws Exception {
191+
OptionalData data = new OptionalData();
192+
data.myString = null;
193+
String value = mapperWithModule().setSerializationInclusion(
194+
JsonInclude.Include.NON_EMPTY).writeValueAsString(data);
195+
assertEquals("{}", value);
196+
}
196197

197-
public void testWithTypingEnabled() throws Exception {
198+
public void testWithTypingEnabled() throws Exception {
198199
final ObjectMapper objectMapper = mapperWithModule();
199200
// ENABLE TYPING
200201
objectMapper.activateDefaultTyping(new NoCheckSubTypeValidator(),

datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/DecimalUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static BigDecimal toBigDecimal(long seconds, int nanoseconds)
9494
}
9595
return BigDecimal.valueOf(seconds).setScale(9);
9696
}
97-
return NumberInput.parseBigDecimal(toDecimal(seconds, nanoseconds));
97+
return NumberInput.parseBigDecimal(toDecimal(seconds, nanoseconds), false);
9898
}
9999

100100
/**

datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/InstantDeserializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ protected T _fromString(JsonParser p, DeserializationContext ctxt,
407407
return _fromLong(ctxt, NumberInput.parseLong(string));
408408
}
409409
if (dots == 1) {
410-
return _fromDecimal(ctxt, NumberInput.parseBigDecimal(string));
410+
return _fromDecimal(ctxt, NumberInput.parseBigDecimal(string, false));
411411
}
412412
} catch (NumberFormatException e) {
413413
// fall through to default handling, to get error there

0 commit comments

Comments
 (0)