Generated code does not escape parts of the package name that are keywords in Kotlin
See original GitHub issueBuild Environment SQLDelight version: 1.4.3 OS: Gradle version: 6.7 Kotlin version: 1.4.10 AGP Version (if applicable): 4.2.0-alpha15
Describe the bug
My project has the package name in.foo
(in being the TLD for India). Since in
is a Kotlin keyword, the package name should be escaped with backticks. i.e, In DatabaseImpl, I should see
`in`.foo.MyTable()
Instead I see
in.foo.MyTable()
This causes compilation errors.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Escape reserved words in an import - kotlin - Stack Overflow
One method I've found that works is to import it with an alias which is ok but it does change the name used...
Read more >Possible to disable keyword checking in package names
A code generation library would have made this easier but I'd still have to choose between altering and escaping the package names.
Read more >Escaping for Java identifiers that are keywords in Kotlin
If a Java library uses a Kotlin keyword for a method, you can still call the method, escaping it with the backtick (...
Read more >Utils class in Kotlin. Unlike Java, there is no static in…
This is an object declaration, it has a name following object keyword. ... Here is the equivalent Java code generated: a singleton and...
Read more >Vocabulary for Android Basics in Kotlin
An immutable object can't be changed after it is created. See also mutable. Import. A directive for including an API or other code...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is fixed in 1.4.4
Thanks @curioustechizen, this is very helpful. I glanced through the repo and SQLDelight code and couldn’t figure it out, unfortunately this goes beyond my knowledge of SQLDelight’s codegen. It looks like
SelectQueryGenerator
uses%T
properly when emitting the type, so something else must be wrong. Hoping that @AlecStrong or somebody else will take over and triage this.