JetBrains/kotlin
Libraries
Active contributors: Filipp Zhinkin, Ilya Gorbunov, Sergej Jaskiewicz
The libraries/ directory hosts everything that ships with the Kotlin distribution but is not the compiler itself: the standard library, reflection, the test framework, the script engine, the Gradle/Maven plugins, the Build Tools API, kotlinx-metadata, the ABI-validation tooling, and a long tail of build-time helpers. Several different build conventions (Gradle Kotlin DSL, Gradle Groovy DSL, Maven) coexist here for historical reasons.
Pages in this section
- Standard library —
libraries/stdlib/ - kotlin-reflect —
libraries/reflect/ - kotlin-test —
libraries/kotlin.test/ - Scripting —
libraries/scripting/ - See also: tools/ — the Gradle/Maven/JPS plugin family
Top-level layout
libraries/
├── stdlib/ Kotlin standard library (multiplatform)
├── reflect/ kotlin-reflect (full reflection on JVM)
├── kotlin.test/ kotlin-test framework
├── scripting/ Kotlin scripting host and definitions
├── kotlinx-metadata/ Read/write Kotlin class metadata
├── tools/ KGP, Maven plugin, BTAPI, daemon, build helpers
├── examples/ Example projects
├── lib/ Static helper libraries
├── kotlin-dom-api-compat/ DOM API compatibility shim for legacy JS
├── ReadMe.md
├── pom.xml Maven parent POM (some libs build with Maven)
├── mvnw, mvnw.cmd Maven Wrapper
└── maven-settings.xmlWhat is the standard library?
The standard library is multiplatform from day one: a common/ source set defines the cross-platform API (with expect declarations), and per-target source sets (jvm/, js/, native-wasm/, wasm/) provide the actual implementations. There is no single canonical "stdlib jar" — there is a kotlin-stdlib for each target plus a multiplatform variant that ties them together via klibs.
See stdlib.md for the deep dive.
Reflection
Reflection on the JVM is in libraries/reflect/. It depends on stdlib and uses Kotlin's metadata format (encoded in JVM annotations on class files) to recover Kotlin-specific information at runtime. JS, Native, and Wasm have lighter reflection capabilities baked into stdlib.
Test framework
libraries/kotlin.test/ ships kotlin-test and the per-target adapter modules (kotlin-test-junit, kotlin-test-junit5, kotlin-test-testng, kotlin-test-js, ...). These give Kotlin code a uniform assertEquals / assertTrue API that works across all targets.
Scripting
libraries/scripting/ is the implementation behind kotlinc -script, .kts Gradle build scripts, and Kotlin notebooks. It defines the script-host API, the script-definition format, and the JSR-223 / Kotlin Main KTS launcher.
kotlinx-metadata
libraries/kotlinx-metadata/ is a small library that reads and writes the metadata format embedded in JVM and Kotlin/JS class files. It's used by tools that need to inspect or manipulate Kotlin declarations without invoking the full compiler.
ABI validation and binary compatibility
libraries/tools/binary-compatibility-validator/ and libraries/tools/abi-validation/ provide the tooling that verifies public API stability. Kotlin's standard library and many of its tools commit .api dumps; CI fails the build if a dump diverges from the source.
Examples
libraries/examples/ contains small projects used as examples in documentation and as smoke tests for the build.
Maven and Gradle coexistence
Most of libraries/ builds with Gradle, but the Maven plugin family (anything matching libraries/kotlin-maven-*/) builds with Maven via libraries/pom.xml and the wrapper at libraries/mvnw. The Gradle build invokes Maven for these subprojects; the Maven build also runs standalone for plugin development.
Where to start
If you're contributing to:
- stdlib —
libraries/stdlib/. Pay attention toexpect/actualparity across targets. - kotlin-test —
libraries/kotlin.test/. New asserts go in the common module first. - kotlin-reflect —
libraries/reflect/. Be careful around lazy initialization. - scripting —
libraries/scripting/. Thekotlin-main-kts/jar is a popular distribution. - build tools (KGP, Maven plugin, BTAPI) —
libraries/tools/(see tools section). - ABI validation —
libraries/tools/abi-validation/andlibraries/tools/binary-compatibility-validator/.
See tools/index.md for the build-system integrations.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.