https://kotlinlang.org logo
b

Bruno_

02/14/2020, 9:27 AM
I've found this in the source code
Copy code
// exposed as public
@PublishedApi
internal fun timer(name: String?, daemon: Boolean) = if (name == null) Timer(daemon) else Timer(name, daemon)
docs of published contains:
Copy code
When applied to a class or a member with internal visibility allows to use it from public inline functions and makes it effectively public.
the question is: since it's internal why should I care about not making breaking changes to the declaration? It's just there for the purpose of chopping up big public inline functions, no? so published internal inline fun is like a private fun in class, right?
d

Dico

02/14/2020, 9:31 AM
Api consumers can effectively call this by calling a public inline function that calls it. Therefore, modifying the declaration can break binary compatibility.
b

Bruno_

02/14/2020, 10:23 AM
yeah they
technically
call it because the call in a public inline fun is effectively replaced by the code but still it's not like
timer("foo", false)
i

ilya.gorbunov

02/14/2020, 10:58 PM
Why not like? In the generated client code you get exactly
timer("foo", false)
when calling public
timer("foo", ...)
for example.
d

Dico

02/14/2020, 11:30 PM
It won't break source code if you got rid of the function
Im not an expert on the topic of compatibility though
2 Views