I'd like to have a common source set for both a JV...
# kotlin-native
a
I'd like to have a common source set for both a JVM library and a KLib, but I'd like the JVM library to have nice Java Interop so I have a few
@JvmStatic
and
@Throws
annotations thrown in there. These are however giving me
error: Unresolved reference
in the compileConan task. Anyone got suggestions for how to deal with this with a common codebase? I thought maybe I'd create typealiases to dummy annotations for these in the Kotlin/Native library. But then I don't know how to deal with the annotation argument for Throws... (KClass also doesn't exist for Native). edit: (using the Konan Gradle Plugin)
r
Might want to ask in #multiplatform, though I think the answer will be that there's not support for this yet.
k
I had the same problem, but i was trying to use JVM-only and JS-only annotations and still build on native. I solved it (hackily) copying the relevant annotations from the jvm/js kotlin source and compiling them in: https://github.com/kyonifer/koma/tree/master/core/external
in the source i import
koma.polyfill.*
, which then brings in the right annotations for the platform (i.e. when building on the jvm you cant include those defs twice or it'll error)
j
a
Thanks!