Kotlin inline value class creates "cannot find symbol" when called in java

199 Views Asked by At

I have the following class in kotlin:

@JvmInline
value class ItemId(val value: String)

data class Item(
     var id: ItemId? = null
)

However if I ever call Item.getId() from a java class it will give me a cannot find symbol error while compiling.

From my understanding during compilation (according to this docs page), the value class should be converted into a String during compilation, so I don't understand why or how getId() does not exist according to the java side.

Whenever the Item constructor is called, a similar error occurs: Item(...) has private access in ...

Is there a way to solve this problem?

0

There are 0 best solutions below