Skip to content

Comments

fix(okhttp): remove internal API usage and fix deprecated OkHttp 5 calls#7444

Merged
manusa merged 1 commit intofabric8io:mainfrom
manusa:fix/okhttp5-compatibility
Feb 18, 2026
Merged

fix(okhttp): remove internal API usage and fix deprecated OkHttp 5 calls#7444
manusa merged 1 commit intofabric8io:mainfrom
manusa:fix/okhttp5-compatibility

Conversation

@manusa
Copy link
Member

@manusa manusa commented Feb 18, 2026

Summary

Follow-up to #7422 (OkHttp 4.12.0 → 5.3.2 bump) addressing compatibility issues identified during review:

  • Remove okhttp3.internal.http.HttpMethod usage: Replace the internal API call HttpMethod.requiresRequestBody() with a local constant set. OkHttp 5.2+ enforces Java 9 module boundaries (module-info.java), which will cause package okhttp3.internal.http is not visible errors for users on the module path. This internal API has been fragile since the 3.x → 4.x upgrade (9fa6296 feat:deps: bumped OkHttp from 3.12.12 to 4.12.0 #6441).
  • Reorder RequestBody.create() parameters: The create(MediaType, content) overloads were deprecated in OkHttp 4.x in favor of create(content, MediaType). Updated all three call sites to use the non-deprecated signature.
  • Add explicit okhttp-jvm dependency: In OkHttp 5.x, the okhttp artifact is a Kotlin Multiplatform root that may resolve to an empty JAR for Maven users. The httpclient-okhttp module was relying on logging-interceptor to transitively pull in okhttp-jvm. Added the explicit dependency to prevent breakage if transitive resolution changes.

Test plan

  • mvn clean install -pl httpclient-okhttp -am -DskipTests passes
  • mvn test -pl httpclient-okhttp — all 84 tests pass
  • mvn spotless:check -pl httpclient-okhttp — formatting clean

🤖 Generated with Claude Code

Replace okhttp3.internal.http.HttpMethod.requiresRequestBody() with a
local constant to avoid JPMS visibility issues in OkHttp 5.2+. Reorder
RequestBody.create() parameters to the non-deprecated (content, MediaType)
signature. Add explicit okhttp-jvm dependency to httpclient-okhttp.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@ash-thakur-rh ash-thakur-rh left a comment

Choose a reason for hiding this comment

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

LGTM!

@manusa manusa added this to the 7.6.0 milestone Feb 18, 2026 — with automated-tasks
@manusa manusa merged commit 03cc34f into fabric8io:main Feb 18, 2026
19 of 21 checks passed
@manusa manusa deleted the fix/okhttp5-compatibility branch February 18, 2026 15:03
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.

2 participants