Skip to content

fix: defer platform detection until first use#9467

Open
cyphercodes wants to merge 1 commit into
square:masterfrom
cyphercodes:fix-jdk9-platform-class-init-9462
Open

fix: defer platform detection until first use#9467
cyphercodes wants to merge 1 commit into
square:masterfrom
cyphercodes:fix-jdk9-platform-class-init-9462

Conversation

@cyphercodes
Copy link
Copy Markdown

Summary

  • Defer OkHttp platform detection until Platform.get() is first used.
  • Add an isolated JVM regression test proving Class.forName("okhttp3.internal.platform.Jdk9Platform") no longer trips the superclass initialization cycle.

Fixes #9462

Testing

  • ./gradlew :okhttp:jvmTest --tests okhttp3.internal.platform.Jdk9PlatformInitializationTest --no-daemon --rerun-tasks
  • ./gradlew :okhttp:jvmTest --tests okhttp3.internal.platform.Jdk9PlatformTest --no-daemon --rerun-tasks
  • git diff --check

Note: locally I had to point Gradle's daemon JVM criteria at the installed Ubuntu OpenJDK 21 to run the checks; that generated file was restored before committing.

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.

Class.forName(Jdk9Platform) throws during warm up

1 participant