https://kotlinlang.org logo
#ktor
Title
# ktor
n

nordiauwu

07/20/2021, 8:14 PM
Why is StringValuesBuilder marked as @InternalAPI? It's used in Headers#build which is a public API
t

Trevor Stone

07/20/2021, 10:42 PM
Because they don't want you to use the StringValuesBuilder directly externally, they want you to use the
HeadersBuilder
n

nordiauwu

07/21/2021, 9:11 AM
HeadersBuilder
also counts as @InternalAPI
n

Nikolay Kasyanov

07/21/2021, 9:40 AM
yep, and with Kotlin 1.5.30-M1 I’m getting compilation errors when I use
append
in
HeadersBuilder
closure because of that.
Is it a compiler regression? 🤔
a

Aleksei Tirman [JB]

07/21/2021, 10:34 AM
@Nikolay Kasyanov I think it's intended behavior. You can add
@OptIn(InternalAPI::class)
annotation to make an error go away. Btw,
InternalAPI
annotation will be removed in version 2.0.0.
n

nordiauwu

07/21/2021, 10:47 AM
@Aleksei Tirman [JB] Isn't it a breaking change? Are you sure they can just release it like it's nothing?
n

Nikolay Kasyanov

07/21/2021, 10:50 AM
@Aleksei Tirman [JB] to clarify, are clients not supposed to use
Headers.build
at all? 🤔
most of the
HeadersBuilder
API surface is now an internal API, if it’s an intended change
the only usable thing I could find is the
HeadersBuilder.etag
extension method
(thanks for sharing the escape hatch via
@OptIn
though)
I’d appreciate a blessed way to build
Headers
instances that don’t rely on internal APIs, if there are any.
@Aleksei Tirman [JB]
Btw, InternalAPI  annotation will be removed in version 2.0.0.
Could you share please what the destiny of APIs currently marked with it would be?
a

Aleksei Tirman [JB]

07/21/2021, 12:02 PM
It will stay wihout
InternalAPI
annotation, e.g. StringValuesBuilder.
🙏 1
5 Views