Teach Kotlin to play well with Java - Optimization tips for Interoperability
summary
Kotlin-to-Java interoperability covers 11 practical fixes: rename generated classes to avoid AmazingUtilsKt with @file:JvmName and @JvmMultifileClass; avoid signature clashes and give extension functions clear Java names with @JvmName; expose companion utilities as real statics with @JvmStatic or fields with @JvmField/const/lateinit; generate overloads for default parameters with @JvmOverloads; advertise checked exceptions with @Throws; prefer Java SAM interfaces for clean Java lambdas; defensively copy Kotlin immutable collections; expose coroutines as CompletableFuture for Java consumption.
AI-written summary · about
chapters (14)
- 0:00Introduction and motivation
- 6:11Access scopes in Kotlin
- 9:27Top-level functions naming
- 12:34Extension function naming
- 14:41Signature clash in extensions
- 16:47Getters and setters naming
- 18:35Companion objects and static methods
- 20:00Avoiding getters and setters
- 23:06Default parameters with Java
- 25:31Checked exceptions in Kotlin
- 29:50Higher-order functions in Java
- 34:03Immutability with Java
- 35:48Coroutines for Java interop
- 39:01Q&A








