How Meta Translates Java to Kotlin at Scale
Original post Translating Java to Kotlin at Scale
Article Summary
Meta is rewriting 10 million lines of perfectly good Java code to Kotlin. Jocelyn Luizzi, Jingbo Yang, and Eve Matthaey reveal why they built custom infrastructure to automate what most companies would never attempt.
Meta has been translating its entire Android codebase from Java to Kotlin since going Kotlin-first in 2020. Rather than just writing new code in Kotlin like most companies, they're converting virtually everything, including some of the most complex files in one of the world's largest Android codebases. They're now past the halfway point.
Key Takeaways
- Built 'Kotlinator' with 200+ custom steps to automate translations at scale
- Six-phase process includes headless J2K, preprocessing, postprocessing, and build error fixes
- Collaborated with JetBrains to improve J2K and add custom extension hooks
- Null safety validation required before translation to prevent NPE regressions
- Over 40,000 files converted so far using fully automated remote conversions
Meta automated Java to Kotlin translation at unprecedented scale by building custom tooling around JetBrains' J2K, converting over half their Android codebase with 200+ transformation steps.
Continue reading
This page summarizes “Translating Java to Kotlin at Scale” by Meta, published Dec 18, 2024. All credit for the original work goes to the authors.