Ben Woodworth
10/02/2025, 9:32 PMBen Woodworth
10/02/2025, 9:43 PM// library
interface Foo { // added in v1.0
fun bar(): String { // added in v1.1
return "baz"
}
}
fun consumeFoo(foo: Foo) {
println(foo.bar()) // added in v1.1
}
// library-consumer, compiled against v1.0
class FooImpl : Foo
fun main() {
consumeFoo(FooImpl())
}
If library-consumer is executed with v1.1, will consumeFoo work fine on all platforms even though FooImpl was compiled without any knowledge of the bar method? I tested this with library-consumer compiled using compileOnly("library:1.0") + runtimeOnly("library:1.1") and it seemed to work fine, though I know the *Only dependencies aren't fully supported yet on KMP so I'm not positive that's a good testandylamax
10/03/2025, 12:58 AMBen Woodworth
10/03/2025, 1:11 AMandylamax
10/03/2025, 1:15 AM