okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

OkHttpClient.Builder overrides with kotlin.time.Duration

Open JakeWharton opened this issue 6 years ago • 8 comments

Once they're stable, or we could propagate their experimental nature with their experimental annotation.

JakeWharton avatar Aug 01 '19 21:08 JakeWharton

+1, but I think we should generally wait until they are stable. I assume we hide from java?

I think API usage by a common library like OkHttp, will result in user pain and in general experimental features probably don't compose well through transient libraries. Once they are broadly adopted but experimental, it's going to be an awkward upgrade no matter what.

yschimke avatar Aug 08 '19 05:08 yschimke

They're automatically hidden from Java since Duration is an inline class.

JakeWharton avatar Aug 08 '19 12:08 JakeWharton

The Kotlin Duration API is now stable with Kotlin 1.6+. Is this enhancement still being considered?

https://kotlinlang.org/docs/whatsnew16.html#stable-duration-api

AllanHasegawa avatar May 05 '22 16:05 AllanHasegawa

Unfortunately Gradle is determined to ruin all Kotlin libraries by keeping them 1-2 years behind the latest toys. See #7267.

JakeWharton avatar May 05 '22 16:05 JakeWharton

Is this useful as an extension? Or does it mainly make sense when internal representation uses this and the legacy API is the converter?

We could stick useful extensions in okhttp-coroutines ( make it modern kotlin).

yschimke avatar May 08 '22 13:05 yschimke

An extension is okay, but putting it in a separate artifact doesn't really make sense.

JakeWharton avatar May 08 '22 14:05 JakeWharton

Does it still work with apiVersion if we land https://github.com/square/okhttp/pull/7267

Or do you prefer shading it like okio like your suggestion in https://github.com/square/okio/pull/960

yschimke avatar May 08 '22 14:05 yschimke

Unfortunately not. You'd have to compile it separately and bundle its class in the JVM artifact. Not sure how you would do other targets. Although they don't need to have their API version kept artificially low since they can't run inside Gradle.

JakeWharton avatar May 10 '22 14:05 JakeWharton