Kotlin Website Documentation

repository·master·Indexed 23 days ago

https://github.com/jetbrains/kotlin-web-site

Source code, content, and templates for kotlinlang.org. This repository manages documentation, landing pages, and community information using Jinja2 templates, a Python-based server, and Next.js. It includes guides for customizing Dokka HTML output, managing internal and external content sources, configuring website navigation, adding Kotlin User Groups and Case Studies, and generating documentation PDFs.

Tokens
290.1K
Snippets
839
Records
1.5K
Agent score
77%

What's inside jetbrains-kotlin-web-site

  1. What is the Power-assert compiler plugin?

    master

    The Kotlin Power-assert compiler plugin improves the debugging experience by providing detailed failure messages with contextual information. When an assertion fails, the plugin automatically generates a message that displays the values of variables and sub-expressions involved in the assertion, helping you understand why a test failed without needing complex assertion libraries.

    Key Features:

    • Enhanced error messages: Captures and displays values of variables and sub-expressions.
    • Runtime library: Provides the @PowerAssert annotation and CallExplanation class for integration.
    • Support for multiple functions: Transforms assert() by default, but can be configured to transform require(), check(), assertTrue(), etc.
  2. Overview of Kotlin/JavaScript (Kotlin/JS)

    master

    Kotlin/JavaScript (Kotlin/JS) transpiles Kotlin code, the Kotlin standard library, and compatible dependencies into JavaScript. This allows Kotlin applications to run in any JavaScript-supported environment.

    Key technical details:

    • Target Standards: Currently targets ES5 and ES2015 standards.
    • Configuration: Managed via the Kotlin Multiplatform Gradle plugin using the kotlin.multiplatform ID.
    • Module Systems: Compatible with ESM, CommonJS, UMD, and AMD.
    • Interoperability: Supports using third-party JavaScript/TypeScript libraries via custom type-safe wrappers, community wrappers, or the dynamic type (which bypasses strict typing).
  3. Overview of Kotlin 2.2.0 release highlights

    master

    Kotlin 2.2.0 introduces several major updates across the ecosystem:

    • Language: New preview features (e.g., context parameters) and new stable features (guard conditions, non-local break and continue, and multi-dollar interpolation).
    • Compiler: Unified management of compiler warnings.
    • Kotlin/JVM: Changes to default method generation for interface functions.
    • Kotlin/Native: LLVM 19 support and new memory consumption tracking/adjustment features.
    • Kotlin/Wasm: Separated Wasm target and per-project Binaryen configuration.
    • Kotlin/JS: Fix for the copy() method in @JsPlainObject interfaces.
    • Gradle: Binary compatibility validation included in the Kotlin Gradle plugin.
    • Standard Library: Stable Base64 and HexFormat APIs.
  4. What's new in Kotlin 2.2.20

    master

    Kotlin 2.2.20 introduces several key updates, particularly for web development and Kotlin Multiplatform:

    Kotlin/Wasm (Beta)

    • Improvements to exception handling in JavaScript interop.
    • Separated npm dependency management.
    • Built-in browser debugging support without additional configuration.
    • A new shared source set for js and wasmJs targets.

    Kotlin Multiplatform

    • Swift export is now available by default.
    • Stable cross-platform compilation for Kotlin libraries.
    • A new approach for declaring common dependencies.

    Kotlin/JS

    • Long values are now compiled into JavaScript BigInt.

    Kotlin/Native

    • Support for Xcode 26.
    • Support for stack canaries.
    • Smaller binary sizes for release binaries.

    Language Improvements

    • Improved overload resolution for lambdas with suspend function types.
    • Support for return statements in expression bodies with explicit return types.
    • Data-flow-based exhaustiveness checks for when expressions.
    • Support for reified types in catch clauses.
    • Improved Kotlin contracts.
  5. Understand the Kotlin website structure and content sources

    master

    The Kotlin website is composed of various content types stored in different locations within the repository or in external repositories:

    Internal Content

    • Main page: templates/pages/index.html
    • Kotlin docs: docs/topics
    • Backend: pages/backend
    • Multiplatform: pages/multiplatform
    • Case Studies: pages/case-studies
    • Community: pages/community
    • Education: pages/education

    External Content Sources

    Certain documentation is maintained in separate repositories:

    • Kotlin Multiplatform docs: kotlin-multiplatform-dev-docs
    • Coroutines docs: kotlinx.coroutines
    • Serialization docs: kotlinx.serialization
    • Lincheck docs: kotlinx.lincheck
    • Dokka docs: dokka
    • Library creators' guidelines: api-guidelines
    • Language specification: kotlin-spec

    Auto-generated Content

    • API reference documentation: Generated from Kotlin code comments.
    • Kotlin grammar reference: Generated from the Kotlin grammar definition using the website-grammar-generator.
  6. Kotlin 2.4.0 Release Highlights

    master

    Kotlin 2.4.0 introduces significant updates across multiple platforms:

    Platform Highlights

    • Kotlin/JVM: Support for Java 26 and annotations in metadata enabled by default.
    • Kotlin/Native: Support for Swift packages as dependencies, updates to Swift export, and CMS GC enabled by default.
    • Kotlin/Wasm: Incremental compilation enabled by default and support for WebAssembly Component Model.
    • Kotlin/JS: Support for value class export and ES2015 features in JS code inlining.
    • Gradle: Compatibility with Gradle 9.5.0.
    • Maven: Automatic alignment between Java and JVM target versions.

    For bug fix details regarding version 2.4.10, refer to the official changelog.

  7. Kotlin/JVM: Support for Java 26 and Metadata Annotations

    master

    Kotlin 2.4.0 includes the following JVM updates:

    • Java 26 Support: The compiler can generate classes containing Java 26 bytecode.
    • Annotations in Metadata: Support for reading and writing annotations in Kotlin metadata is enabled by default. This allows annotation processors and tools to manipulate annotations at the metadata level without reflection or source code modification.
  8. Update Kotlin/Native targets and tiers

    master

    Starting with Kotlin 1.8.20, Kotlin/Native targets are organized into tiers. Some targets have been deprecated and will be removed in version 1.9.20.

    Deprecated targets (to be removed in 1.9.20):

    • iosArm32
    • watchosX86
    • wasm32
    • mingwX86
    • linuxArm32Hfp
    • linuxMips32
    • linuxMipsel32

    Library authors should use the target tiers to decide which targets to test on CI tools and which ones to skip.

  9. Handle Kotlin 2.0.0 Language Compatibility Changes

    master

    The Kotlin 2.0.0 release introduces several breaking changes to the core language, moving many previous warnings to errors. Key areas of impact include:

    Type System and Generics

    • Contravariant captured types: Errors are now raised for problematic calls (previously warnings in 1.8.20).
    • Star-projections: Passing a star-projection of a generic type that violates self upper bounds is now an error.
    • Intersection types: Assigning a value that is not a subtype of an intersection type is now an error.
    • Raw-type parameters: Overriding a Java method containing a raw-type parameter now requires a star-projected type.
    • Nullability: Projected types now account for all in-place not-null types.

    Property and Member Access

    • Initialization: Accessing a property value before initialization is now an error.
    • Private members: Exposing private class members through non-private inline functions is now an error (PRIVATE_CLASS_MEMBER_FROM_INLINE).
    • Backing fields: Properties with a backing field and a custom setter must be immediately initialized (previously a warning).

    Syntax and Expressions

    • If conditions: Using an if condition with only one branch where an expression is required is now an error.
    • Lambdas: Kotlin lambdas are now generated using invokedynamic and LambdaMetafactory by default.
    • Destructuring: The real type of a destructuring variable is now consistent with the explicit type when specified.

    Resolution and Overloading

    • Ambiguity: Errors are reported for ambiguous imports of classes with the same name via star imports, and for ambiguity between a property and an enum entry at the same scope level.
    • Extension functions: Overload resolution now prioritizes local extension function calls over invoke conventions of local functional type properties.
    • Companion objects: Companion property resolution is now preferred over enum entries.
  10. What's new in Kotlin 2.0.20

    master

    Kotlin 2.0.20 introduces several language, compiler, and platform updates:

    Language & Compiler

    • Data class copy function: The copy function now has the same visibility as the primary constructor.
    • Context Parameters: Phased replacement of context receivers with context parameters.
    • K2 Compiler: Improved performance and library compatibility (refer to the K2 compiler migration guide).

    Kotlin Multiplatform

    • Source Sets: Added static accessors for source sets from the default target hierarchy.
    • Plugin Deprecations: Deprecated compatibility with the Kotlin Multiplatform Gradle plugin and Gradle Java plugins.
    • Swift Package Export: Improved setup for Kotlin/Native output to be consumed by Swift Package Manager (SPM).

    Kotlin/Native

    • Garbage Collector: Introduced concurrent marking in the GC.
    • GC Monitoring: Changes to GC performance monitoring using signposts.
    • Swift/Objective-C Interop: Ability to call Kotlin suspending functions from Swift/Objective-C on non-main threads.
    • Bitcode: Support for bitcode embedding has been removed.

    IDE Support

    • General improvements to IDE support for the 2.0.20 release.