Kotlin MPP conflates JVM code into my common codebase... how to force pure "common"

55 views Asked by At

My MPP library has android and jvm build: kotlin { android(); jvm { /*...*/ } }.

I've written a function that takes kotlinx.datetime.DayOfWeek and kotlinx.datetime.Month as parameters, but then inside of commonTest, the parameter types are translated into JVM, resulting in a type mismatch:

enter image description here

The function I'm calling is pretty ordinary:

enter image description here

So you can see that within commonMain, the provided type is not yet seen as a jvm type.

Is this an issue with kotlinx.datetime? Is it not appropriate to include types from kotlinx.datetime in the api exposed by my common codebase? Is there a way to dissuade the gradle plugin and compiler from making any optimizations to commonMain, which change its type signatures?

0

There are 0 answers