Is it possible to have a class implemented in the common
source set, while
also overriding it in a specific language.
For example, if I’m implementing a Base64 encoder/decoder. I have a default, multiplatform implementation in the common
source set. However, as Java as its own Base64 implementation,
which is arguably much better optimized than mine, I’d like to add that as an actual
override for
my multiplatform implementation, while still having my implementation as a fallback for e.g. the JS platform.
The only way I can figure is to use an expect
declaration in the common source set, and then an actual
declaration in the JVM source set using Java’s encoder, and then copy my fallback implementation into every other source set as the actual
declaration. But this sounds like an absolutely terrible idea and a nightmare to maintain.
Any solutions?