I am working on a Java-based library, and I'd like to start using Kotlin. However, there are over 10k known direct consumers, and I don't want to introduce a new dependency to all of the consumers.
For consumers that are already using Kotlin, I especially don't want to force them to upgrade or downgrade their Kotlin Stdlib version in order to use the latest version of the library, or introduce a classpath conflict of any sort.
Is it possible to use Kotlin in a way that doesn't "export" a new dependency to all of the library consumers?
My question is similar to Using Kotlin libraries as dependencies in a Java project, but it (a) does not have an accepted answer, and (b) is trying to completely hide the existence of Kotlin types from Java consumers whereas I'm just trying to avoid causing any conflicting dependency requirements.
I'm currently using Maven, but wanting to switch to Gradle. A solution that works for Maven or Gradle is acceptable since using Kotlin is of greater importance than using a particular build system.
I ask the above question to avoid posing an XY Problem. My theoretical solution is to shade/relocate a specific version of the Kotlin Stdlib—but is it even possible, given that the Kotlin Stdlib seems to have some special treatment in the Kotlin compiler?
There is almost an exact match of this question on the Kotlinlang discussion board (What is the proper way to repackage/shade Kotlin dependencies), but it also does not have an answer.