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…) 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. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.