Coil: -Xjvm-default=all requirement for 1.0.0 causes havoc with KAPT / Room

Created on 26 Aug 2020  路  4Comments  路  Source: coil-kt/coil

Describe the bug
I've tried to add freeCompilerArgs = listOf("-Xjvm-default=all") to my kotlinOptions block, but the code for my Jetpack Room DAO's do not compile correctly anymore, giving errors about annotations which apparently were dropped. Maybe this is more of a kapt bug, but makes it impossible to use the latest version of Coil.

Expected behavior
My project still compiles.

To Reproduce
Use a Room DAO with coil 1.0.0 and kapt.

Logs/Screenshots

../build/tmp/kapt3/stubs/appDebug/com/foo/bar/localdb/MyDetailsDao.java:27: error: 
An abstract DAO method must be annotated with one and only one of the following annotations: Insert,Delete,Query,Update,RawQuery
    public com.foo.bar.MyDetails insertOrUpdate(@org.jetbrains.annotations.NotNull()
 ^../build/tmp/kapt3/stubs/appDebug/com/foo/bar/localdb/MyDetailsDao.java:15: error: 
 Abstract method in DAO must be annotated with interface androidx.room.Query AND interface androidx.room.Insert
public abstract interface AugmentedSkuDetailsDao {

Version
1.0.0-rc1

bug

Most helpful comment

Just replace interface with an abstract class
source

All 4 comments

Just replace interface with an abstract class
source

Yep, it seems like the jvm-default flag is slightly buggy in Kotlin 1.4.0 (the compiler also fails to compile the library with jvm-default=all-compatibility). I'd like to introduce this change as part of the 1.0.0 release as it's a binary incompatible change, however if the flag is unstable, I'll revert the change. In the meantime I'd recommend using Coil 0.12.0 - it's the same release, however compiled with 1.3.72.

Just replace interface with an abstract class
source

This solution works for me

1.0.0-rc3 removes the -Xjvm-default=all requirement due to instability.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dafi picture dafi  路  5Comments

mare011 picture mare011  路  5Comments

vegeta2102 picture vegeta2102  路  6Comments

adesamp picture adesamp  路  3Comments

RubenGonzalezGonzalez picture RubenGonzalezGonzalez  路  6Comments