How to call a method on an object originating in Java called “in”, which is a kotlin reserved word

Backticks around the reserved word.

I found this working with JOOQ’s implementation of the SQL IN predicate. You can’t write myJavaLibObject.in(…) in Kotlin. You’ll get “Element expected” because in is a reserved word in Kotlin. Instead you need backticks: myJavaLibObject.`in`(…) will do the trick.

Leave a Reply

Your email address will not be published.