Open-Source Wikis

/

Kotlin

/

Fun facts

JetBrains/kotlin

Fun facts

A few things that surprised us while exploring the repository.

The codebase remembers 2008

The very first commit ("Initial Contribution") landed on 21 October 2008. That predates the public announcement of the Kotlin language by almost three years. There are 17+ years of git history in this tree, and over 136,000 commits (git log --oneline | wc -l).

Over 62,000 Kotlin files

Counting just .kt files, the repository contains roughly 62,000 of them. A large share are testData/ snippets — small Kotlin programs used as inputs for diagnostic, codegen, and IR tests. The compiler is its own most demanding user.

The TODO graveyard

A grep for TODO, FIXME, and HACK across .kt sources turns up about 3,150 files with at least one such marker. The compiler is aware of itself: there's an entire subsystem (compiler/tests-mutes/) dedicated to muting (temporarily disabling) tests with explanations attached.

Test data outweighs production code

In compiler/, the directory with ~38,000 .kt/.java files, the majority are not compiler source — they are test inputs. The Kotlin team takes test data seriously: there are dedicated AGENTS.md files explaining test-data formats and a Gradle task (generateTests) whose only job is to produce JUnit runners from the test data tree.

A vendored LLVM

The Kotlin/Native backend (kotlin-native/) ships with a vendored LLVM. The repository's kotlin-native/dependencies/ and kotlin-native/llvmInterop/, kotlin-native/llvmDebugInfoC/, kotlin-native/libllvmext/ directories together hold the native interface that the Kotlin code uses to drive LLVM. Building Kotlin/Native pulls in roughly 70,000 lines of C++ headers and 37,000 lines of C++ in the runtime.

Two frontends, both alive

The repository hosts two frontends in production at the same time: K1 (compiler/frontend/) and K2/FIR (compiler/fir/). K2 has been the default since Kotlin 2.0 (May 2024), but K1 stays in the tree because the IntelliJ Kotlin plugin needs it for a long compatibility window. Many features must be implemented twice — once in compiler/frontend/ and once in compiler/fir/checkers/.

The Ka prefix

If you see a type starting with Ka (KaSession, KaSymbol, KaFirResolver), it's part of the Analysis API. If you see LL, it's the low-level FIR API. If you see Fir*, it's K2. If you see Kt*, it's PSI. If you see Ir*, it's backend IR. Five concurrent prefix conventions, one repository.

A 50KB build script

The root build.gradle.kts is just over 50,000 bytes. The settings file settings.gradle.kts is ~52,000 bytes. They are not generated — they are hand-maintained Kotlin DSL declarations enumerating the module graph and version logic.

CODEOWNERS using JetBrains Space syntax

The CODEOWNERS file lives at .space/CODEOWNERS, not .github/CODEOWNERS. It uses JetBrains Space CODEOWNERS syntax, which extends the GitHub format with directives like SPACE_OWNER, USER_OWNER, GITHUB_BRANCH_RULE, and UNKNOWN. The file is checked at build time by org.jetbrains.kotlin.code.SpaceCodeOwnersTest.

A peak of 13,000 commits in 2020

2020 was the peak commit year (about 13,000 commits) — a combination of the IR migration, the early FIR work, and a pandemic-era push. Every year since has held steady around 10,000–11,500 commits, indicating that the project is operating at sustained capacity, not in bursts.

The settings file is bigger than most production files

Both the root build.gradle.kts and settings.gradle.kts are larger than nearly every individual production source file in the repository. Build configuration is genuinely the biggest single text file most engineers touch in this codebase.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Fun facts – Kotlin wiki | Factory