Skip to content

Restore missing OkHttp3 Additions in okhttp-android and okhttp-jvm#1434

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/okhttp3-additions-fix
Open

Restore missing OkHttp3 Additions in okhttp-android and okhttp-jvm#1434
Copilot wants to merge 3 commits into
mainfrom
copilot/okhttp3-additions-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

The OkHttp3 Additions (hand-written helper/extension APIs) were dropped when the okhttp binding was split into okhttp-android (Square.OkHttp3.Android) and okhttp-jvm (Square.OkHttp3.JVM) for 5.x. Consumers lost APIs such as ICall.ExecuteAsync():

Square.OkHttp3.ICall call;
await call.ExecuteAsync(); // CallExtensions was no longer available

Changes

  • Restored Additions into both new binding projects (each .csproj already globs Additions/*.cs):
    • Call.csCallExtensions.ExecuteAsync(this ICall) and Enqueue(this ICall, Action<ICall,Response>, Action<ICall,IOException>) + internal ICallback adapter
    • Dispatcher.csDispatcher.SetIdleCallback(IRunnable)
    • OkHttpClient.Builder.csFunc-based overloads for AddInterceptor, AddNetworkInterceptor, Authenticator, ProxyAuthenticator, Dns, HostnameVerifier + delegate adapters
    • ResponseBody.csBytesAsync(), StringAsync()
  • Backward compat: added a TypeForwardedTo for the new Square.OkHttp3.CallExtensions type in the okhttp shim. Other additions are members of already-forwarded types and need no entry.
  • PublicAPI: added the 12 new members to PublicAPI.Unshipped.txt for both projects, in generator-matching sorted positions.

Notes

  • Mirrored into both okhttp-android and okhttp-jvm so .Android and .JVM consumers reach parity with the pre-split okhttp package.
  • IAuthenticator.Authenticate now has a nullable Route? parameter in 5.x; the restored Func<Route, Response, Request> signature is preserved as previously shipped, yielding a benign (non-fatal) nullability warning rather than a behavior/API change.

Copilot AI and others added 2 commits June 3, 2026 15:56
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing additions in OkHttp3 after update to Android and JVM Restore missing OkHttp3 Additions in okhttp-android and okhttp-jvm Jun 3, 2026
Copilot AI requested a review from jonathanpeppers June 3, 2026 16:02
@jonathanpeppers jonathanpeppers marked this pull request as ready for review June 3, 2026 16:50
Copilot AI review requested due to automatic review settings June 3, 2026 16:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores previously shipped OkHttp3 “Additions” (hand-written helper APIs) that were lost when the okhttp binding split into okhttp-android (Square.OkHttp3.Android) and okhttp-jvm (Square.OkHttp3.JVM) for 5.x, and adds a type-forward in the okhttp shim to preserve source/binary compatibility for the newly reintroduced CallExtensions type.

Changes:

  • Reintroduces helper APIs into both okhttp-android and okhttp-jvm (async helpers, delegate-based builder overloads, dispatcher helper, call extensions).
  • Adds TypeForwardedTo for Square.OkHttp3.CallExtensions in the okhttp shim assembly.
  • Updates PublicAPI.Unshipped.txt for both bindings to include the restored public surface area.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
source/com.squareup.okhttp3/okhttp/Additions/TypeForwards.cs Adds a type-forward for the newly restored Square.OkHttp3.CallExtensions type for backward compatibility.
source/com.squareup.okhttp3/okhttp-android/Additions/Call.cs Restores CallExtensions helpers (ExecuteAsync, delegate-based Enqueue).
source/com.squareup.okhttp3/okhttp-android/Additions/Dispatcher.cs Adds Dispatcher.SetIdleCallback(IRunnable) helper.
source/com.squareup.okhttp3/okhttp-android/Additions/OkHttpClient.Builder.cs Adds Func-based overloads for interceptors/authenticators/DNS/hostname verification via adapter implementations.
source/com.squareup.okhttp3/okhttp-android/Additions/ResponseBody.cs Adds async convenience methods for ResponseBody (BytesAsync, StringAsync).
source/com.squareup.okhttp3/okhttp-android/PublicAPI/PublicAPI.Unshipped.txt Declares the new public members/types for the Android binding in the API baseline.
source/com.squareup.okhttp3/okhttp-jvm/Additions/Call.cs Restores CallExtensions helpers (ExecuteAsync, delegate-based Enqueue).
source/com.squareup.okhttp3/okhttp-jvm/Additions/Dispatcher.cs Adds Dispatcher.SetIdleCallback(IRunnable) helper.
source/com.squareup.okhttp3/okhttp-jvm/Additions/OkHttpClient.Builder.cs Adds Func-based overloads for interceptors/authenticators/DNS/hostname verification via adapter implementations.
source/com.squareup.okhttp3/okhttp-jvm/Additions/ResponseBody.cs Adds async convenience methods for ResponseBody (BytesAsync, StringAsync).
source/com.squareup.okhttp3/okhttp-jvm/PublicAPI/PublicAPI.Unshipped.txt Declares the new public members/types for the JVM binding in the API baseline.

Comment thread source/com.squareup.okhttp3/okhttp-android/Additions/Dispatcher.cs
Comment thread source/com.squareup.okhttp3/okhttp-jvm/Additions/ResponseBody.cs
Comment thread source/com.squareup.okhttp3/okhttp-jvm/Additions/Dispatcher.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OkHttp3 Additions missing when updated to .Android and .JVM

3 participants