Meta Dec 18, 2024

Translating Java to Kotlin at Scale

Article Summary

Meta is rewriting 10 million lines of perfectly good Java code into Kotlin. Why would anyone do that?

Meta's Android team has been on a multi-year mission to convert their entire codebase from Java to Kotlin since going Kotlin-first in 2020. They're now past the halfway point on one of the world's largest Android codebases, having built custom infrastructure to automate translation at scale rather than leaving existing Java untouched.

Key Takeaways

Critical Insight

Meta automated the translation of millions of lines of Java to Kotlin by building sophisticated tooling around JetBrains' J2K converter, complete with preprocessing, postprocessing, and build error fixes.

The hardest part isn't the translation itself: it's the seemingly simple transformations that turn out to be surprisingly tricky (like nullable booleans and initialization vs getters).

Recent from Meta

Related Articles