https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

robstoll

05/05/2018, 11:56 AM
I am struggling with StringBuilder. I have a common module which uses StringBuilder but I cannot call the function from the JVM module since
java.lang.StringBuilder
does not seem to be the actual type of it. What is the actual type in JVM?
k

kpgalligan

05/05/2018, 12:46 PM
Can you post expect/actual code?
r

robstoll

05/05/2018, 12:49 PM
I have no expect/actual, I am having something like:
Copy code
fun foo(sb: StringBuilder){}
in common module and I want to call it from jvm module
k

karelpeeters

05/05/2018, 12:53 PM
Where is the common
StringBuilder
decared?
r

robstoll

05/05/2018, 1:24 PM
kotlin.text.StringBuilder
Unfortunately I cannot search for implementations or rather intellij does not find them
it seems like they missed to add
actual
to the type alias
kotlin.text.StringBuilder
in the JVM module
k

kpgalligan

05/05/2018, 2:50 PM
Intellij doesn't see it, but doing a gradle build works
In common, I have a var declared as follows:
var sb : StringBuilder = StringBuilder()
In jvm:
sb = java.lang.StringBuilder()
Intellij flags it, but it'll compile
r

robstoll

05/05/2018, 4:37 PM
oh... interesting, I'll try it out
you're right, works perfectly fine, I'll file a bug
k

kpgalligan

05/05/2018, 7:47 PM
👍