Can somebody tell me why my multiplatform project ...
# multiplatform
o
Can somebody tell me why my multiplatform project suddenly is able to use
java.time
inside of
commonMain
? I'm using
kotlinx-datetime
as a dependency.
h
Do you have multiple targets or only
jvm()
?
o
only jvm
h
Then the commoner (?)/compiler allows jvm usage
n
If I understand correctly then this seems to be a bug IMHO...
b
Commonizer is only relevant for native targets. Seems like an intellij bug
o
Yeah this seems misleading. Let's say in the future I would want to add ios() as a target. Suddenly my commonMain code breaks. One would assume commonMain is always cross platform ready
@Big Chungus note sure if it is an IDE bug, because it builds and runs successfully
h
b
@Orhan Tozan then it's definitely an ide bug. Even before commonizer you could use posix apis in shared custom native sourceSets and get the project to build - IDE was just coloring everything red. Note that commonMain sources basically just get appended to target compilation so if they're valid sources for that target it will compile while it might not for the other target
m
We had the same discussion some time ago already. https://kotlinlang.slack.com/archives/C3PQML5NU/p1644251603481339
o
Ah ok, based on what @Sebastian Sellmair [JB] is saying, is that commonMain basically allows you to write code based on the most common denominator of all targets you specified. I guess that makes sense, also in the name
Makes sense
😕 1