androidkotlingradlesqldelight

Why long packageName results in a line break just before the import as quantifier?


In my Android multimodule project I have: Module A:

sqldelight {
    SomeExampleDb {
        packageName = "com.example.exampleapp.feature.currency.datasource.example.localstorage"
    }
}

Module B:

sqldelight {
    SomeExampleDb {
        packageName = "com.example.exampleapp.feature.account.datasource.example.localstorage"
        dependency(project(":moduleA"))
    }
}

During build time, when compiler generates SomeExampleDb interface for module B, it results in such import:

import com.example.exampleapp.feature.currency.datasource.example.localstorage.SomeExampleDb as
    SomeExampleDb0
    
public interface SomeExampleDb : Transacter, SomeExampleDb0 {
 ...
}    

(there is line break after as) which results in such error:

e: {path to file}/SomeExampleDb.kt: (8, 101): Expecting identifier

Everything works fine when packageName is shorter. Is the maximum line length taken into account in any way during the build?

SQLDelight Version

1.5.2

Operating System

macOS Big Sur 11.2.3

Gradle Version

7.2

Kotlin Version

1.5.30

AGP Version

7.0.3


Solution

  • It is caused by the issue in kotlinpoet (api to generate kotlin files) which is used by sqldelight: https://github.com/square/kotlinpoet/issues/1169