In other words, in which cases does a Kotlin libra...
# announcements
p
In other words, in which cases does a Kotlin library (not) expose
kotlin-stdlib
in its API?
g
If Kotlin stdlib is implementation details and doesn't expose types from Kotlin stdlib, than it looks correct to use implementation instead of compile/api
p
My question is, what exactly constitutes "exposes types from Kotlin stdlib"? What if the API uses kotlin.Boolean, kotlin.collections.List, a Kotlin lambda, etc.?
g
From mentioned only Function1-FunctionN (ala lambda) is kotlin stdlib type
p
That would have been my guess. Is there a spec for this?
g
Boolean and list are not exist on compiled code
p
Or even better, a tool that provides this information (yes/no).
g
I don't know such. But you can use some of tools that generate public API snapshot and check Kotlin types there (just check that you expose nothing from package kotlin)
For example kotlinx.coroutines uses such (custom) tool which generates text files with public API
p
seems like essential information for every kotlin library author
g
Only if you expect also Java users, not only Kotlin
Also you can expose kotlin stdlib, not so big issue for most cases.
But sure in general sounds as cleaner approach
One more way: just cover library public API with integration tests on java without stdlib in dependencies
p
I like to get my POMs right. Agreed that this only matters for libraries that expect non-Kotlin users.
Alas, all my tests are written in Kotlin, even tests for Java code. 🙂
g
Yes, but if your library also targets java users it's very important test java compatibility and usability and special tests for this is good way of validation
p
just not important enough right now
g
So I would worry than about stdlib which is not so important if you do not target java users
p
I do target them, I just don't have time to write a Java test suite right now
g
Mmm, just create a new module with Java only and write tests in this module