Android 12 Developer Preview is here! Try it out, and give us your feedback!

RoomWarnings

open class RoomWarnings
kotlin.Any
   ↳ androidx.room.RoomWarnings

The list of warnings that are produced by Room.

You can use these values inside a SuppressWarnings annotation to disable the warnings.

Summary

Constants
static String

Reported when Room cannot verify database queries during compilation.

static String

The warning dispatched by Room when the return value of a Query method does not exactly match the fields in the query result.

static String

Reported when a POJO has multiple constructors, one of which is a no-arg constructor.

static String

Reported when an Entity that has a Embeddedd field whose type is another Entity and that Entity has some indices defined.

static String

Reported when an Entity field that is annotated with Embedded has a sub field which has a ColumnInfo annotation with index = true.

static String

Reported when an Entity inherits a field from its super class and the field has a ColumnInfo annotation with index = true.

static String

Reported when an Entity's parent declares an Index.

static String

Reported when an `@Entity` field's type do not exactly match the getter type.

static String

Reported when an `@Entity` field's type do not exactly match the setter type.

static String

When there is a foreign key from Entity A to Entity B, it is a good idea to index the reference columns in B, otherwise, each modification on Entity A will trigger a full table scan on Entity B.

static String

Reported when a junction entity whose column is used in a `@Relation` field with a `@Junction` does not contain an index.

static String

Reported when Room cannot verify database queries during compilation due to lack of tmp dir access in JVM.

static String

Reported when a `room.

static String

Reported when an Entity field that is annotated with Embedded has a sub field which is annotated with PrimaryKey but the PrimaryKey is dropped while composing it into the parent object.

static String

Reported when a @Query method returns a POJO that has relations but the method is not annotated with @Transaction.

static String

Reported when a Relation Entity's SQLite column type does not match the type in the parent.

Public constructors

Constants

CANNOT_CREATE_VERIFICATION_DATABASE

static val CANNOT_CREATE_VERIFICATION_DATABASE: String

Reported when Room cannot verify database queries during compilation. This usually happens when it cannot find the SQLite JDBC driver on the host machine.

Room can function without query verification but its functionality will be limited.

Value: "ROOM_CANNOT_CREATE_VERIFICATION_DATABASE"

CURSOR_MISMATCH

static val CURSOR_MISMATCH: String

The warning dispatched by Room when the return value of a Query method does not exactly match the fields in the query result.

Value: "ROOM_CURSOR_MISMATCH"

DEFAULT_CONSTRUCTOR

static val DEFAULT_CONSTRUCTOR: String

Reported when a POJO has multiple constructors, one of which is a no-arg constructor. Room will pick that one by default but will print this warning in case the constructor choice is important. You can always guide Room to use the right constructor using the @Ignore annotation.

Value: "ROOM_DEFAULT_CONSTRUCTOR"

INDEX_FROM_EMBEDDED_ENTITY_IS_DROPPED

static val INDEX_FROM_EMBEDDED_ENTITY_IS_DROPPED: String

Reported when an Entity that has a Embeddedd field whose type is another Entity and that Entity has some indices defined. These indices will NOT be created in the containing Entity. If you want to preserve them, you can re-define them in the containing Entity.

Value: "ROOM_EMBEDDED_ENTITY_INDEX_IS_DROPPED"

INDEX_FROM_EMBEDDED_FIELD_IS_DROPPED

static val INDEX_FROM_EMBEDDED_FIELD_IS_DROPPED: String

Reported when an Entity field that is annotated with Embedded has a sub field which has a ColumnInfo annotation with index = true.

You can re-define the index in the containing Entity.

Value: "ROOM_EMBEDDED_INDEX_IS_DROPPED"

INDEX_FROM_PARENT_FIELD_IS_DROPPED

static val INDEX_FROM_PARENT_FIELD_IS_DROPPED: String

Reported when an Entity inherits a field from its super class and the field has a ColumnInfo annotation with index = true.

These indices are dropped for the Entity and you would need to re-declare them if you want to keep them. Alternatively, you can set Entity#inheritSuperIndices() to true.

Value: "ROOM_PARENT_FIELD_INDEX_IS_DROPPED"

INDEX_FROM_PARENT_IS_DROPPED

static val INDEX_FROM_PARENT_IS_DROPPED: String

Reported when an Entity's parent declares an Index. Room does not automatically inherit these indices to avoid hidden costs or unexpected constraints.

If you want your child class to have the indices of the parent, you must re-declare them in the child class. Alternatively, you can set Entity#inheritSuperIndices() to true.

Value: "ROOM_PARENT_INDEX_IS_DROPPED"

MISMATCHED_GETTER

static val MISMATCHED_GETTER: String

Reported when an `@Entity` field's type do not exactly match the getter type. For instance, in the following class:

<code>@</code>Entity
      class Foo {
          ...
          private Boolean value;
          public boolean getValue() {
              return value == null ? false : value;
          }
      }
      
Trying to insert this entity into database will always set value column to false when Foo.value is null since Room will use the getValue method to read the value. So even thought the database column is nullable, it will never be inserted as null if inserted as a Foo instance.

Value: "ROOM_MISMATCHED_GETTER_TYPE"

MISMATCHED_SETTER

static val MISMATCHED_SETTER: String

Reported when an `@Entity` field's type do not exactly match the setter type. For instance, in the following class:

<code>@</code>Entity
      class Foo {
          ...
          private Boolean value;
          public void setValue(boolean value) {
              this.value = value;
          }
      }
      
If Room reads this entity from the database, it will always set Foo.value to false when the column value is null since Room will use the setValue method to write the value.

Value: "ROOM_MISMATCHED_SETTER_TYPE"

MISSING_INDEX_ON_FOREIGN_KEY_CHILD

static val M