okhttp v3.8.0 Release Notes
-
2017-05-13
OkHttp now uses
@Nullable
to annotate all possibly-null values. We've added a compile-time dependency on the JSR 305 annotations. This is a [provided][maven_provided] dependency and does not need to be included in your build configuration,.jar
file, or.apk
. We use@ParametersAreNonnullByDefault
and all parameters and return types are never null unless explicitly annotated@Nullable
.Warning: this release is source-incompatible for Kotlin users. Nullability was previously ambiguous and lenient but now the compiler will enforce strict null checks.
New: The response message is now non-null. This is the "Not Found" in the status line "HTTP 404 Not Found". If you are building responses programmatically (with
new Response.Builder()
) you must now always supply a message. An empty string""
is permitted. This value was never null on responses returned by OkHttp itself, and it was an old mistake to permit application code to omit a message.The challenge's scheme and realm are now non-null. If you are calling
new Challenge(scheme, realm)
you must provide non-null values. These were never null in challenges created by OkHttp, but could have been null in application code that creates challenges.New: The
TlsVersion
of aHandshake
is now non-null. If you are callingHandshake.get()
with a null TLS version, you must instead now provide a non-nullTlsVersion
. Cache responses persisted prior to OkHttp 3.0 did not store a TLS version; for these unknown values the handshake is defaulted toTlsVersion.SSL_3_0
.New: Upgrade to Okio 1.13.0.
<dependency> <groupId>com.squareup.okio</groupId> <artifactId>okio</artifactId> <version>1.13.0</version> </dependency> com.squareup.okio:okio:1.13.0
Fix: gracefully recover when Android 7.0's sockets throw an unexpected
NullPointerException
.