Idiomatic Interop with Kotlin
summary
Kotlin–Java interop works but has sharp edges: concrete fixes and gotchas are shown, with bytecode-focused tools like @JvmOverloads and @file:JvmName to preserve Java signatures, jsr305 package-info to eliminate platform-nullability, and explicit use of reified generics limitations and inline-function performance pitfalls. The talk documents how annotations, JVM-defaults, @Throws, SAM limits, visibility hacks (backtick names + typealiases) and data-class copy helpers change real APIs and whether each approach actually compiles, preserves discoverability, and avoids runtime NPEs.
AI-written summary · about
chapters (28)
- 0:00Start
- 1:01Who should be thinking about this?
- 2:29Your interop story should be
- 4:03@Jvm Annotations
- 4:19@JvmOverloads
- 6:17Don't get too carried away
- 7:35@JvmStatic
- 9:23A less nested way?
- 11:15@JvmDefault
- 12:38@Throws
- 14:16Extension functions
- 18:25Inline functions
- 19:48Reified generics workaround
- 21:32internal
- 22:42"Kotlin-only visibility" (hack!)
- 25:08Nullability Annotations!
- 28:42Annotating a package
- 29:17DIY Default Nullability Annotations
- 31:04Living the dream
- 31:31Nulls in libraries
- 32:57Lambdas and SAMs
- 35:36Lambda signatures
- 36:32Special Types
- 36:47Unit
- 39:03Data classes
- 40:31Overall Interop Thoughts
- 41:04Quick Tip
- 41:23Resources
related talks
43mIdiomatic Interop
39mTeach Kotlin to play well with Java - Optimization tips for Interoperability
50mWriting Java-friendly Kotlin Code
38mKids, Play Nice! - Writing With Kotlin-Java Interop
36mKotlin, Beyond the Basics
34mKotlin: Uncovered
41mKotlin: Facts You Might Not Know
52mKotlin for Java Programmers
