Anyone have experience with binary compatibility t...
# library-development
r
Anyone have experience with binary compatibility tooling in a mixed java/kotlin codebase? Is using binary-compatibility-verifier sufficient for tracking both Java and Kotlin changes, or is there Java-specifiic tooling I should consider as well?
m
BCV should get you mostly covered. It works on binary
.class
(and
.klib
) files so it doesn't matter if you build your classes from Kotlin or Java. Actually it does because it parses Kotlin metadata
One big thing to remember is that BCV doesn't actually validate anything, it just dumps the ABI and it's on you to check whether the changes are compatible or not.
Other contenders that do some amount of validation • Metalava from Google will tell you about some source breaking changes like changing parameter names in Kotlin • JapiCmp is the historical JVM tool to do this. It has very detailed output but it works on binary files so it's harder to integrate in your CI workflow.
r
One big thing to remember is that BCV doesn't actually validate anything, it just dumps the ABI and it's on you to check whether the changes are compatible or not.
Yeah, I'm used to that behavior. Mostly wondering if there's any footguns to watch out for when exposing things to Java specifically. For example, are there edge cases with internal declarations in Kotlin that BCV doesn't report but that are public to Java? Thanks for the other recommendations.
m
are there edge cases with internal declarations in Kotlin that BCV doesn't report but that are public to Java?
Mmmm that's a good question. I'm curious now too
Yup, can confirm BCV doesn't catch this
JapiCmp is probably your best bet for this I guess
it doesn't matter if you build your classes from Kotlin or Java
I take that back then. If you're building from Kotlin it does matter since BCV is going to read the metadata and decide to hide some declarations