diff --git a/pom.xml b/pom.xml index 25fc114b5a..f8243d7498 100644 --- a/pom.xml +++ b/pom.xml @@ -204,6 +204,11 @@ jackson-databind ${jackson.version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + javax.xml.bind jaxb-api diff --git a/src/main/java/com/twilio/http/TwilioRestClient.java b/src/main/java/com/twilio/http/TwilioRestClient.java index 837cf09e7a..61acfc6679 100644 --- a/src/main/java/com/twilio/http/TwilioRestClient.java +++ b/src/main/java/com/twilio/http/TwilioRestClient.java @@ -1,6 +1,7 @@ package com.twilio.http; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import java.util.function.Predicate; @@ -27,6 +28,12 @@ private TwilioRestClient(Builder b) { this.edge = b.edge; this.httpClient = b.httpClient; this.objectMapper = new ObjectMapper(); + + // This module configures the ObjectMapper to use + // public API methods for manipulating java.time.* + // classes. The alternative is to use reflection which + // generates warnings from the module system on Java 9+ + objectMapper.registerModule(new JavaTimeModule()); } /**