Search code examples
androidandroid-roomandroidxdeprecation-warningandroid-lint

How to suppress Lint warnings in generated sources?


With Room version 2.1.0-alpha04:

implementation "androidx.room:room-runtime:2.1.0-alpha04"
annotationProcessor "androidx.room:room-compiler:2.1.0-alpha04"
testImplementation "androidx.room:room-testing:2.1.0-alpha04"

The @Dao implementations of the RoomDatabase causes these warnings, per generatedDao_Impl:

[deprecation] setTransactionSuccessful() in RoomDatabase has been deprecated
[deprecation] beginTransaction() in RoomDatabase has been deprecated
[deprecation] endTransaction() in RoomDatabase has been deprecated

And also this one for the @Database class:

[deprecation] mCallbacks in RoomDatabase has been deprecated

The problem is, that these files are located in mobile/build/generated/source/apt/debug, while only paths alike <ignore path="src/main/..."/> seem to catch. What I've tried so far, along with absolute and relative paths and **/ - as well as qualified class names, with and without wildcards:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="Deprecated" severity="informational">
        <ignore regexp="androidx.room.RoomDatabase" />
    </issue>

    <issue id="Deprecated">
        <ignore regexp="com.acme.database.dao.*Dao_Impl" />
    </issue>
</lint>

How to suppress these deprecation warnings in build/generated/source with lint.xml - or is there a newer/stable version or RoomDatabase, which works (and does not cause these warnings)?


Solution

  • Updating Room to version 2.2.0-alpha02 removes the deprecation warnings:

    annotationProcessor "androidx.room:room-compiler:2.2.6"
    testImplementation "androidx.room:room-testing:2.2.6"
    implementation "androidx.room:room-runtime:2.2.6"