https://kotlinlang.org logo
#android
Title
# android
y

yuriy.stetsyk

12/17/2017, 12:31 PM
Hello folks. Have anybody used Room with Kotlin? I have a problem using type converters to parse list of enums. Here are classes that I use: https://gist.github.com/zamahaka/584963739a010842dfee90a545e34d1d This is the build failure: http://joxi.ru/RmzZPQWTWzv6lm Have anybody encounter same problem?
Well, manage to figure it out. This is new User class https://gist.github.com/zamahaka/23cc8f3f8528ff867b84ecde49ef8241 and type converters https://gist.github.com/zamahaka/f4928d3ad959b423ba40021d07f9d7a7 Found this solution after digging generated User.java class. Property 'types' has type of java.util.List<? extends UserType> when 'types' has type of List<UserType> in *.kt file. After switching ti MutableList<UserType> everything compiles, at least 😀 .
a

araqnid

12/17/2017, 3:25 PM
Maybe the
@JvmSuppressWildcards
annotation on the type parameter would also work, then
y

yuriy.stetsyk

12/18/2017, 9:34 PM
Yeah,
@JvmSuppressWildcards
works. Didn't test for CRUD, but it compiles.