Adds the binary compatibility validator plugin #938
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #634 by adding https://github.com/Kotlin/binary-compatibility-validator
See the individual commits for all checks. I started by adding the
.api
files built using the 0.14.1 release branch, to see whether we already made changes to the API.This correctly showed me:
GenericColumn
from Revert insertGenericTreeImpl #923, which probably won't cause issues as it was just used from the compiler pluginThe plugin automatically runs when
check
orbuild
runs, so that's nice :) I added it only to the public modules, skipping the examples, plugins, etc.When updating the public API we'll need to try to keep binary compatibility as best as possible, resorting to deprecating old functions instead of just removing/changing them. And if we introduce a breaking change, we'll need to inform the users in the release notes and run
apiDump
to overwrite the .api files.A non-breaking change would be a
+
in the API check, this means we simply add another function or overload. A breaking change would be a-
. Those will causeNoSuchMethodError
s when called from an older version:For more information, check https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html
Hint: Sometimes
DeprecationLevel.HIDDEN
can help to remove a function from the API while keeping it in the bytecode. The Api checker plugin still shows it as a-
, but it can still be called from a compiled library, avoiding aNoShuchMethodError
.