
The negative consequence now being that all the clients of the library now have access to those components as well. One of the reasons for this was as soon as your library grew from one package in size, the only way for code to access each other across packages (outside of using protected for inheritance) was the public modifier. Anyone who has tried to write a library would let you know that this modifier was less than ideal for trying to stop clients from accessing your code. This modifier does not have a kotlin analogue. This visibility would allow only for same package access. To begin, lets review java’s default visibility, package-private.Īs you most likely know, java by default gives you package-private visibility. I also want to examine why it is important that app developers need to start borrowing a few best practices from library developers and should start to pay attention to the proper use of visibility modifiers as well.

In this post, I want to look at why utilizing Kotlin at first seems to help with this issue and where it falls short. One of the worst reasons breaking changes can happen is because the author of the library removed members from API that you depended on but that they never intended for you to have access to in the first place. Unfortunately, there are a lot of bad ones too.

Maybe the author has decided to take the API in a different direction. There are a few reasons that this can happen. As Halloween flies by and we dress up as ghouls, ghosts and other things that go bump in the night, it occurred to me that one of the the scariest things to an Android developer (outside of Out Of Memory exceptions, of course) are unexpected breaking changes in an API when you upgrade a dependency.
