retrofit v2.5.0 Release Notes

Release Date: 2018-11-18 // over 5 years ago
    • New: Built-in support for Kotlin's Unit type. This behaves the same as Java's Void where the body content is ignored and immediately discarded.
    • New: Built-in support for Java 8's Optional and CompletableFuture types. Previously the 'converter-java8' and 'adapter-java8' dependencies were needed and explicitly adding Java8OptionalConverterFactory and/or Java8CallAdapterFactory to your Retrofit.Builder in order to use these types. Support is now built-in and those types and their artifacts are marked as deprecated.
    • New: Invocation class provides a reference to the invoked method and argument list as a tag on the underlying OkHttp Call. This can be accessed from an OkHttp interceptor for things like logging, analytics, or metrics aggregation.
    • New: Kotlin extension for Retrofit which allows you call create passing the interface type only as a generic parameter (e.g., retrofit.create<MyService>()).
    • New: Added Response.success overload which allows specifying a custom 2xx status code.
    • New: Added Calls.failure overload which allows passing any Throwable subtype.
    • New: Minimal R8 rules now ship inside the jar requiring no client configuration in the common case.
    • Fix: Do not propagate fatal errors to the callback. They are sent to the thread's uncaught exception handler.
    • Fix: Do not enqueue/execute an otherwise useless call when the RxJava type is disposed by onSubscribe.
    • Fix: Call RxJavaPlugins assembly hook when creating an RxJava 2 type.
    • Fix: Ensure both the Guava and Java 8 Optional converters delegate properly. This ensures that converters registered prior to the optional converter can be used for deserializing the body type.
    • Fix: Prevent @Path values from participating in path-traversal. This ensures untrusted input passed as a path value cannot cause you to make a request to an un-intended relative URL.
    • Fix: Simple XML converter (which is deprecated) no longer wraps subtypes of RuntimeException or IOException when it fails.
    • Fix: Prevent JAXB converter from loading remote entities and DTDs.
    • Fix: Correctly detect default methods in interfaces on Android (API 24+). These still do not work, but now a correct exception will be thrown when detected.
    • Fix: Report more accurate exceptions when a @QueryName or @QueryMap precedes a @Url parameter.
    • Update OkHttp dependency to 3.12.