What’s New

Room 2.6.0

2.6.0

Version 2.6.0

The option to enable Kotlin code generation (or "Kotlin CodeGen") is now available in Room KSP. ( 4297ec0). To turn on Kotlin CodeGen in Room, add the room.generateKotlin option name to your processor options for KSP. For more details on how to pass processor options for KSP, see the KSP documentation. Note: When using Kotlin CodeGen, it is important to note that there are additional restrictions that have been added. Abstract properties as DAO getters or DAO queries in Kotlin CodeGen are disallowed, and instead expected to be rewritten as functions to avoid the false notion that the property value is immutable and has a fixed stored result. Another restriction that has been added is that Nullable collection return types are no longer allowed in Room for Kotlin CodeGen. Warning: You may find that your projects are more strict in terms of nullability when using Kotlin CodeGen. In Kotlin CodeGen, the nullability of type arguments is important, wheras in Java this is mostly ignored. For example, let's say you have a Flow return type and the table is empty. In Java CodeGen, this will not cause any issues, but in Kotlin CodeGen, you will get an error. To avoid this, you will need to use Flow , assuming a null is emitted. The new artifact for the Room Gradle Plugin has been added to Room with the id androidx.room, which solves various existing issues in Room regarding having inputs and outputs of schemas via Gradle annotation processor options. For more details, refer to the Room Version 2.6.0-alpha02 release notes. Value classes in Room Entities are now supported for KSP. ( 4194095) Nested Map return types in DAO functions are now supported in Room. ( I13f48, 203008711)

View original

Discussion