What’s New

Room 2.6.0-alpha01

2.6.0-alpha01

Version 2.6.0-alpha01

Supporting value classes in Room for KSP. Room is now able to support value classes in Entities. ( 4194095) Kotlin code generation(or "Kotlin CodeGen") can now be enabled in Room ( 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. Guarding against meaningless usage of nullable collections in DAO method return types. ( I777dc, b/253271782, b/259426907) Add an API for creating a Flow that emits invalidation tracker changes. The API is useful for creating streams that need to react to database changes. ( I8c790, b/252899305) Disallow abstract properties as DAO getters or DAO queries in Kotlin codegen, instead they should be rewritten as functions to avoid the false notion that the property value is immutable and has a fixed stored result. ( If6a13, b/127483380, b/257967987)

View original

Discussion