square/retrofit (com.squareup.retrofit2:converter-gson)
### [`v2.10.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#2100---2024-03-18)
[Compare Source](https://togithub.com/square/retrofit/compare/2.9.0...2.10.0)
**New**
- Support using `Unit` as a response type. This can be used for non-body HTTP methods like `HEAD` or body-containing HTTP methods like `GET` where the body will be discarded without deserialization.
- kotlinx.serialization converter!
This was imported from [github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/](https://togithub.com/JakeWharton/retrofit2-kotlinx-serialization-converter/) and remains unchanged from its 1.0.0 release.
The Maven coordinates are `com.squareup.retrofit2:converter-kotlinx-serialization`.
- JAXB 3 converter!
The Maven coordinates are `com.squareup.retrofit2:converter-jaxb3`.
- `@Header`, `@Headers`, and `@HeaderMap` can now set non-ASCII values through the `allowUnsafeNonAsciiValues` annotation property. These are not technically compliant with the HTTP specification, but are often supported or required by services.
- Publish a BOM of all modules. The Maven coordinates are `com.squareup.retrofit2:retrofit-bom`.
- `Invocation` now exposes the service `Class>` and the instance on which the method was invoked. This disambiguates the source when service inheritence is used.
- A response type keeper annotation processor is now available for generating shrinker rules for all referenced types in your service interface. In some cases, it's impossible for static shrinker rules to keep the entirety of what Retrofit needs at runtime. This annotation processor generates those additional rules. For more info see [its README](https://togithub.com/square/retrofit/tree/trunk/retrofit-response-type-keeper#readme).
**Changed**
- Add shrinker rules to retain the generic signatures of built-in types (`Call`, `Response`, etc.) which are used via reflection at runtime.
- Remove backpressure support from RxJava 2 and 3 adapters. Since we only deliver a single value and the Reactive Streams specification states that callers must request a non-zero subscription value, we never need to honor backpressure.
- Kotlin `Retrofit.create` function now has a non-null lower bound. Even if you specified a nullable type before this function would never return null.
- Suspend functions now capture and defer all `Throwable` subtypes (not just `Exception` subtypes) to avoid Java's `UndeclaredThrowableException` when thrown synchronously.
- Eagerly reject `suspend fun` functions that return `Call`. These are never correct, and should declare a return type of `Body` directly.
- Support for Java 14-specific and Java 16-specific reflection needed to invoke default methods on interfaces have been moved to separate versions of a class through a multi-release jar. This should have no observable impact other than the jar now contains classes which target Java 14 and Java 16 bytecode that might trip up some static analysis tools which are not aware of multi-release jars.
- Parameter names are now displayed in exception messages when available in the underlying Java bytecode.
- Jackson converter now supports binary formats by using byte streams rather than character streams in its implementation. Use the `create(ObjectMapper, MediaType)` overload to supply the value of the `Content-Type` header for your format.
**Fixed**
- Do not include synthetic methods when doing eager validation.
- Use per-method rather than per-class locking when parsing annotations. This eliminates contention when multiple calls are made in quick succession at the beginning of the process lifetime.
### [`v2.9.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#290---2020-05-20)
[Compare Source](https://togithub.com/square/retrofit/compare/2.8.2...2.9.0)
- New: RxJava 3 adapter!
The Maven coordinates are `com.squareup.retrofit2:adapter-rxjava3`.
Unlike the RxJava 1 and RxJava 2 adapters, the RxJava 3 adapter's `create()` method will produce asynchronous HTTP requests by default. For synchronous requests use `createSynchronous()` and for synchronous on a scheduler use `createWithScheduler(..)`.
### [`v2.8.2`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#282---2020-05-18)
- Fix: Detect running on the Android platform by using system property rather than the presence of classes.
This ensures that even when you're running on the JVM with Android classes present on the classpath you
get JVM semantics.
- Fix: Update to OkHttp 3.14.9 which contains an associated Android platform detection fix.
### [`v2.8.1`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#281---2020-03-25)
- Fix: Do not access `MethodHandles.Lookup` on Android API 24 and 25. The class is only available
on Android API 26 and higher.
### [`v2.8.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#Version-280--2020-03-23-)
- New: Add `Call.timeout()` which returns the `okio.Timeout` of the full call.
- Fix: Change `Call.awaitResponse()` to accept a nullable response type.
- Fix: Support default methods on Java 14+. We had been working around a bug in earlier versions of
Java. That bug was fixed in Java 14, and the fix broke our workaround.
### [`v2.7.2`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#272---2020-02-24)
- Fix: Update to OkHttp 3.14.7 for compatibility with Android R (API 30).
### [`v2.7.1`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#Version-271--2020-01-02-)
- Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact.
### [`v2.7.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#270---2019-12-09)
**This release changes the minimum requirements to Java 8+ or Android 5+.**
See [this blog post](https://cashapp.github.io/2019-02-05/okhttp-3-13-requires-android-5) for more information on the change.
- New: Upgrade to OkHttp 3.14.4. Please see [its changelog for 3.x](https://square.github.io/okhttp/changelog\_3x/).
- Fix: Allow service interfaces to extend other interfaces.
- Fix: Ensure a non-null body is returned by `Response.error`.
### [`v2.6.4`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#264---2020-01-02)
- Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact.
### [`v2.6.3`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#263---2019-12-09)
- Fix: Change mechanism for avoiding `UndeclaredThrowableException` in rare cases from using `yield`
an explicit dispatch which ensures that it will work even on dispatchers which do not support yielding.
### [`v2.6.2`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#262---2019-09-23)
- Fix: Avoid `IOException`s being wrapped in `UndeclaredThrowableException` in rare cases when using
`Response<..>` as a return type for Kotlin 'suspend' functions.
### [`v2.6.1`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#261---2019-07-31)
- Fix: Avoid `IOException`s being wrapped in `UndeclaredThrowableException` in rare cases.
- Fix: Include no-content `ResponseBody` for responses created by `Response.error`.
- Fix: Update embedded R8/ProGuard rules to not warn about nested classes used for Kotlin extensions.
### [`v2.6.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#260---2019-06-05)
- New: Support `suspend` modifier on functions for Kotlin! This allows you to express the asynchrony of HTTP requests
in an idiomatic fashion for the language.
```kotlin
@GET("users/{id}")
suspend fun user(@Path("id") id: Long): User
```
Behind the scenes this behaves as if defined as `fun user(...): Call` and then invoked with `Call.enqueue`.
You can also return `Response` for access to the response metadata.
Currently this integration only supports non-null response body types. Follow
[issue 3075](https://togithub.com/square/retrofit/issues/3075) for nullable type support.
- New: **`@Tag`** parameter annotation for setting tags on the underlying OkHttp `Request` object. These can be read
in `CallAdapter`s or OkHttp `Interceptor`s for tracing, analytics, varying behavior, and more.
- New: **`@SkipCallbackExecutor`** method annotation will result in your `Call` invoking its `Callback` on the
background thread on which the HTTP call was made.
- New: Support OkHttp's `Headers` type for `@HeaderMap` parameters.
- New: Add `Retrofit.Builder.baseUrl(URL)` overload.
- Fix: Add embedded R8/ProGuard rule which retains Retrofit interfaces (while still allowing obfuscation). This
is needed because R8 running in 'full mode' (i.e., not in ProGuard-compatibility mode) will see that there are
no subtypes of these interfaces and rewrite any code which references instances to null.
- Fix: Mark `HttpException.response()` as `@Nullable` as serializing the exception does not retain this instance.
- Fix: Fatal errors (such as stack overflows, out of memory, etc.) now propagate to the OkHttp `Dispatcher` thread
on which they are running.
- Fix: Ensure JAX-B converter closes the response body when an exception is thrown during deserialization.
- Fix: Ignore static methods when performing eager validation of interface methods.
- Fix: Ensure that calling `source()` twice on the `ResponseBody` passed to a `Converter` always returns the same
instance. Prior to the fix, intermediate buffering would cause response data to be lost.
### [`v2.5.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#250---2018-11-18)
- 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()`).
- 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.
### [`v2.4.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#240---2018-03-14)
- New: `Retrofit.Builder` exposes mutable lists of the added converter and call adapter factories.
- New: Call adapter added for Scala's `Future`.
- New: Converter for JAXB replaces the now-deprecated converter for Simple XML Framework.
- New: Add Java 9 automatic module names for each artifact corresponding to their root package.
- Fix: Do not swallow `Error`s from callbacks (usually `OutOfMemoryError`).
- Fix: Moshi and Gson converters now assert that the full response was consumed. This prevents
hiding bugs in faulty adapters which might not have consumed the full JSON input which would
then cause failures on the next request over that connection.
- Fix: Do not conflate OkHttp `Call` cancelation with RxJava unsubscription/disposal. Prior to
this change, canceling of a `Call` would prevent a cancelation exception from propagating down
the Rx stream.
### [`v2.3.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#230---2017-05-13)
- **Retrofit 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: Converters added for Java 8's and Guava's `Optional` which wrap a potentially-nullable
response body. These converters still rely on normal serialization library converters for parsing
the response bytes into an object.
- New: String converters that return `null` for an `@Query` or `@Field` parameter are now skipped.
- New: The mock module's `NetworkBehavior` now throws a custom subclass of `IOException` to more
clearly indicate the exception's source.
- RxJava 1.x converter updated to 1.3.0 which stabilizes the use of `Completable`.
- Fix: Add explicit handling for `OnCompleteFailedException`, `OnErrorFailedException`, and
`OnErrorNotImplementedException` for RxJava 1.x to ensure they're correct delivered to the
plugins/hooks for handling.
- Fix: `NoSuchElementException` thrown when unsubscribing from an RxJava 1.x `Single`.
### [`v2.2.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#220---2017-02-21)
- RxJava 2.x is now supported with a first-party 'adapter-rxjava2' artifact.
- New: `@QueryName` annotation allows creating a query parameter with no '=' separator or value.
- New: Support for messages generated by Protobuf 3.0 or newer when using the converter for Google's
protobuf.
- New: RxJava 1.x call adapter now correctly handles broken subscribers whose methods throw exceptions.
- New: Add `toString()` implementations for `Response` and `Result`.
- New: The Moshi converter factory now offers methods for enabling null serialization and lenient
parsing.
- New: Add `createAsync()` to RxJava 1.x call adapter factory which executes requests using
`Call.enqueue()` using the underlying HTTP client's asynchronous support.
- New: `NetworkBehavior` now allows setting an error percentage and returns HTTP errors when triggered.
- `HttpException` has been moved into the main artifact and should be used instead of the versions
embedded in each adapter (which have been deprecated).
- Promote the response body generic type on `CallAdapter` from the `adapt` method to the enclosing
class. This is a source-incompatible but binary-compatible change which is only relevant if you are
implementing your own `CallAdapter`s.
- Remove explicit handling of the now-defunct RoboVM platform.
- Fix: Close response on HTTP 204 and 205 to avoid resource leak.
- Fix: Reflect the canceled state of the HTTP client's `Call` in Retrofit's `Call`.
- Fix: Use supplied string converters for the `String` type on non-body parameters. This allows user
converters to handle cases such as when annotating string parameters instead of them always using
the raw string.
- Fix: Skip a UTF-8 BOM (if present) when using the converter for Moshi.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
2.1.0
->2.10.0
2.1.0
->2.9.0
Release Notes
square/retrofit (com.squareup.retrofit2:converter-gson)
### [`v2.10.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#2100---2024-03-18) [Compare Source](https://togithub.com/square/retrofit/compare/2.9.0...2.10.0) **New** - Support using `Unit` as a response type. This can be used for non-body HTTP methods like `HEAD` or body-containing HTTP methods like `GET` where the body will be discarded without deserialization. - kotlinx.serialization converter! This was imported from [github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/](https://togithub.com/JakeWharton/retrofit2-kotlinx-serialization-converter/) and remains unchanged from its 1.0.0 release. The Maven coordinates are `com.squareup.retrofit2:converter-kotlinx-serialization`. - JAXB 3 converter! The Maven coordinates are `com.squareup.retrofit2:converter-jaxb3`. - `@Header`, `@Headers`, and `@HeaderMap` can now set non-ASCII values through the `allowUnsafeNonAsciiValues` annotation property. These are not technically compliant with the HTTP specification, but are often supported or required by services. - Publish a BOM of all modules. The Maven coordinates are `com.squareup.retrofit2:retrofit-bom`. - `Invocation` now exposes the service `Class>` and the instance on which the method was invoked. This disambiguates the source when service inheritence is used. - A response type keeper annotation processor is now available for generating shrinker rules for all referenced types in your service interface. In some cases, it's impossible for static shrinker rules to keep the entirety of what Retrofit needs at runtime. This annotation processor generates those additional rules. For more info see [its README](https://togithub.com/square/retrofit/tree/trunk/retrofit-response-type-keeper#readme). **Changed** - Add shrinker rules to retain the generic signatures of built-in types (`Call`, `Response`, etc.) which are used via reflection at runtime. - Remove backpressure support from RxJava 2 and 3 adapters. Since we only deliver a single value and the Reactive Streams specification states that callers must request a non-zero subscription value, we never need to honor backpressure. - Kotlin `Retrofit.create` function now has a non-null lower bound. Even if you specified a nullable type before this function would never return null. - Suspend functions now capture and defer all `Throwable` subtypes (not just `Exception` subtypes) to avoid Java's `UndeclaredThrowableException` when thrown synchronously. - Eagerly reject `suspend fun` functions that return `Call`. These are never correct, and should declare a return type of `Body` directly. - Support for Java 14-specific and Java 16-specific reflection needed to invoke default methods on interfaces have been moved to separate versions of a class through a multi-release jar. This should have no observable impact other than the jar now contains classes which target Java 14 and Java 16 bytecode that might trip up some static analysis tools which are not aware of multi-release jars. - Parameter names are now displayed in exception messages when available in the underlying Java bytecode. - Jackson converter now supports binary formats by using byte streams rather than character streams in its implementation. Use the `create(ObjectMapper, MediaType)` overload to supply the value of the `Content-Type` header for your format. **Fixed** - Do not include synthetic methods when doing eager validation. - Use per-method rather than per-class locking when parsing annotations. This eliminates contention when multiple calls are made in quick succession at the beginning of the process lifetime. ### [`v2.9.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#290---2020-05-20) [Compare Source](https://togithub.com/square/retrofit/compare/2.8.2...2.9.0) - New: RxJava 3 adapter! The Maven coordinates are `com.squareup.retrofit2:adapter-rxjava3`. Unlike the RxJava 1 and RxJava 2 adapters, the RxJava 3 adapter's `create()` method will produce asynchronous HTTP requests by default. For synchronous requests use `createSynchronous()` and for synchronous on a scheduler use `createWithScheduler(..)`. ### [`v2.8.2`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#282---2020-05-18) - Fix: Detect running on the Android platform by using system property rather than the presence of classes. This ensures that even when you're running on the JVM with Android classes present on the classpath you get JVM semantics. - Fix: Update to OkHttp 3.14.9 which contains an associated Android platform detection fix. ### [`v2.8.1`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#281---2020-03-25) - Fix: Do not access `MethodHandles.Lookup` on Android API 24 and 25. The class is only available on Android API 26 and higher. ### [`v2.8.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#Version-280--2020-03-23-) - New: Add `Call.timeout()` which returns the `okio.Timeout` of the full call. - Fix: Change `Call.awaitResponse()` to accept a nullable response type. - Fix: Support default methods on Java 14+. We had been working around a bug in earlier versions of Java. That bug was fixed in Java 14, and the fix broke our workaround. ### [`v2.7.2`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#272---2020-02-24) - Fix: Update to OkHttp 3.14.7 for compatibility with Android R (API 30). ### [`v2.7.1`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#Version-271--2020-01-02-) - Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact. ### [`v2.7.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#270---2019-12-09) **This release changes the minimum requirements to Java 8+ or Android 5+.** See [this blog post](https://cashapp.github.io/2019-02-05/okhttp-3-13-requires-android-5) for more information on the change. - New: Upgrade to OkHttp 3.14.4. Please see [its changelog for 3.x](https://square.github.io/okhttp/changelog\_3x/). - Fix: Allow service interfaces to extend other interfaces. - Fix: Ensure a non-null body is returned by `Response.error`. ### [`v2.6.4`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#264---2020-01-02) - Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact. ### [`v2.6.3`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#263---2019-12-09) - Fix: Change mechanism for avoiding `UndeclaredThrowableException` in rare cases from using `yield` an explicit dispatch which ensures that it will work even on dispatchers which do not support yielding. ### [`v2.6.2`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#262---2019-09-23) - Fix: Avoid `IOException`s being wrapped in `UndeclaredThrowableException` in rare cases when using `Response<..>` as a return type for Kotlin 'suspend' functions. ### [`v2.6.1`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#261---2019-07-31) - Fix: Avoid `IOException`s being wrapped in `UndeclaredThrowableException` in rare cases. - Fix: Include no-content `ResponseBody` for responses created by `Response.error`. - Fix: Update embedded R8/ProGuard rules to not warn about nested classes used for Kotlin extensions. ### [`v2.6.0`](https://togithub.com/square/retrofit/blob/HEAD/CHANGELOG.md#260---2019-06-05) - New: Support `suspend` modifier on functions for Kotlin! This allows you to express the asynchrony of HTTP requests in an idiomatic fashion for the language. ```kotlin @GET("users/{id}") suspend fun user(@Path("id") id: Long): User ``` Behind the scenes this behaves as if defined as `fun user(...): CallConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR has been generated by Mend Renovate. View repository job log here.