---
title: "From zero to 10 million lines of Kotlin"
description: "Meta has converted its Android codebase to over 10 million lines of Kotlin by wrapping JetBrains' J2K converter in an automated pipeline called Kotlinator."
url: "https://swe.quest/articles/from-zero-to-10-million-lines-of-kotlin-e0f9a5140a87605f"
canonical: "https://engineering.fb.com/2022/10/24/android/android-java-kotlin-migration/"
source: "Meta Engineering"
published: "2022-10-24"
difficulty: "medium"
kind: "Case study"
reading_minutes: 13
tags: ["jvm","refactoring","mobile","developer-tools"]
---

# From zero to 10 million lines of Kotlin

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2022-10-24, 13 min read, Case study. Original: [https://engineering.fb.com/2022/10/24/android/android-java-kotlin-migration/](https://engineering.fb.com/2022/10/24/android/android-java-kotlin-migration/)

## Summary

Meta has converted its Android codebase to over 10 million lines of Kotlin by wrapping JetBrains' J2K converter in an automated pipeline called Kotlinator. The pipeline preprocesses Java packages, runs J2K headlessly through Android Studio, then applies automated refactors and linters built on the Kotlin compiler's PSI AST. Those refactors fix issues such as JUnit @Rule annotations needing @JvmField or @get:Rule, and replace TextUtils.isEmpty with isNullOrEmpty. Meta chose a full conversion over Kotlin-for-new-code-only to avoid platform-type null risks from Java interop. Results: about 11% fewer lines, no runtime performance regression in A/B tests, negligible APK size impact after Proguard/Redex, and longer build times as the main cost.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- Java and Kotlin basics ([easy posts on Java & JVM](https://swe.quest/tags/jvm.md?difficulty=easy))
- Android development ([easy posts on Mobile](https://swe.quest/tags/mobile.md?difficulty=easy))
- JVM bytecode basics ([easy posts on Java & JVM](https://swe.quest/tags/jvm.md?difficulty=easy))

## Keywords

Kotlin, J2K, Kotlinator, Redex, Ktfmt, Android Studio, JUnit, Kotlin PSI

## Related posts

- [Translating Java to Kotlin at Scale](https://swe.quest/articles/translating-java-to-kotlin-at-scale-3648a1737157b36f.md): Meta Engineering · 2024-12-18 · Medium · 13 min read · Java & JVM, Refactoring & migrations, Mobile, Static analysis, Developer tools
  Meta is translating roughly ten million lines of Android Java to Kotlin using the Kotlinator, an automated pipeline built around a headless version of JetBrains' J2K.
- [Kotlin Multiplatform in Production: Two Real-World Use Cases from Booking.com](https://swe.quest/articles/kotlin-multiplatform-in-production-two-real-world-use-cases-from-booking-com-12a191bfb36fb8d9.md): Booking.com Engineering · 2026-06-05 · Medium · 14 min read · Mobile, Java & JVM, Design systems, Refactoring & migrations
  Booking.com applied Kotlin Multiplatform in two production cases: a shared experimentation library replacing drifting Java/Kotlin and Objective-C implementations, and a Compose Multiplatform (Kotlin/JS) web playground that renders the real Android BUI design-system components in a browser.
- [How we use Kotlin for backend services at Zalando](https://swe.quest/articles/how-we-use-kotlin-for-backend-services-at-zalando-86a4c360d01f2393.md): Zalando Engineering · 2021-06-30 · Easy · 4 min read · Java & JVM, Engineering culture, API design
  Zalando moved Kotlin from TRIAL to ADOPT on its Tech Radar, making it the third supported JVM language alongside Java and Scala after 100+ new Kotlin applications were written in a year.
- [It’s a non-transitive R class world](https://swe.quest/articles/it-s-a-non-transitive-r-class-world-dc7be71b63e01554.md): Slack Engineering · 2023-02-01 · Medium · 5 min read · Mobile, Build systems, Refactoring & migrations, Static analysis, Developer productivity
  Slack migrated its 400+ module Android codebase to non-transitive R classes, where each module's R class contains only its own resources, yielding ~14% faster incremental builds after resource or layout changes and an ~8.5% (about 5.5MB) APK/DEX size reduction.
- [Enabling Kotlin incremental compilation on Buck2](https://swe.quest/articles/enabling-kotlin-incremental-compilation-on-buck2-bd5307852c0570ff.md): Meta Engineering · 2025-08-26 · Medium · 10 min read · Build systems, Java & JVM, Compilers, Developer productivity, Mobile
  Meta integrated the Kotlin incremental compiler into Buck2 via Kotlin's experimental Build Tools API, making some large Android modules build up to 3x faster and improving incremental build times about 30% for the average developer.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
