Any reason why users of inline classes cannot use ...
# language-proposals
q
Any reason why users of inline classes cannot use @PublishedApi internal constructors? I see them in the Result<T> KEEP and I think "forcing" Kotlin users to use a factory function to get an instance has many use cases. Currently I've resorted to just marking the constructor deprecated and hoping users don't use it/
l
You can mark it as experimental, and make the experimental annotation deprecated with error level (but add it from Gradle in your module)
q
Can you give me an example?
l
You can search for experimental annotations in this Slack and on Google and you'll find examples.
m
Copy code
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
inline class Rating internal constructor(val value: Double)
May break at any time though as Kotlin changes.