question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated code does not escape parts of the package name that are keywords in Kotlin

See original GitHub issue

Build 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:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
aperfilyevcommented, Aug 9, 2021

This is fixed in 1.4.4 Screenshot 2021-08-09 at 22 25 56 Screenshot 2021-08-09 at 22 25 24

1reaction
Egorandcommented, Nov 13, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found