What Kotlin Does
- Null safety — types distinguish nullable (
String?) from non-null (String) - Data classes — auto-generate equals, hashCode, copy
- Extension functions — add methods to existing classes
- Coroutines — structured concurrency with suspend functions
- Smart casts — compiler narrows types after checks
- Type inference — minimal explicit typing
- Functional — higher-order, lambdas, collections DSL
- Multiplatform — share code across JVM, JS, Native, iOS, Android
- Compose — Jetpack Compose (Android) and Compose Multiplatform (desktop/web/iOS)
- Full Java interop — call Java from Kotlin and vice versa
Architecture
Kotlin compiler targets JVM bytecode by default (also JS, Native via LLVM, WASM). The Kotlin Multiplatform toolchain compiles shared code for multiple targets. Coroutines are implemented as a compiler transform + runtime library — no OS thread per coroutine.
Self-Hosting
Language toolchain.
Key Features
- Null safety in the type system
- Data classes
- Extension functions
- Coroutines (structured concurrency)
- Higher-order functions and lambdas
- Operator overloading
- Sealed classes + when expressions
- Kotlin Multiplatform
- Jetpack Compose (Android UI)
- Compose Multiplatform (desktop + iOS)
- Gradle Kotlin DSL
Comparison
| Language | Target | Null Safety | Coroutines |
|---|---|---|---|
| Kotlin | JVM/JS/Native | Yes | Yes |
| Java | JVM | Optional | Project Loom |
| Scala | JVM | Option type | Yes |
| Swift | Native | Yes | async/await + actors |
| C# | CLR | Nullable ref types | async/await |
| Go | Native | No | Goroutines |
FAQ
Q: Compared to Java? A: Kotlin is Java's improved version: null safety, data classes, lambdas, extension functions, coroutines, and less boilerplate. Most Java projects can gradually migrate to Kotlin, and the two languages can coexist in the same project.
Q: Must I use Kotlin for Android? A: Not required, but Google strongly recommends it. Since 2019, new APIs, official docs, and Android KTX are Kotlin-first.
Q: Is Compose Multiplatform mature? A: In 2024, Desktop and Android are stable, iOS is gradually stabilizing, and Web is still maturing. Usable for production but evaluate against your own needs.
Sources
- Docs: https://kotlinlang.org/docs
- GitHub: https://github.com/JetBrains/kotlin
- License: Apache 2.0