Skip to content
CAI
Software that uses CAICheck a score

square/kotlinpoet

58.5

Adequate · 13 November 2026

7.6k

lines of production code

Kotlin

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Kotlin/JS and Kotlin/Wasm JS platform implementations for code point and utility functions

This change introduces platform-specific implementations for \CodePoint\ and \Util\ in the \kotlinpoet\ library, enabling support for Kotlin/JS and Kotlin/Wasm JS targets. The diff adds new source files in \jsMain\, \nonJvmMain\, and \wasmJsMain\ that provide \actual\ implementations for functions such as \codePointAt\, \isLowerCase\, \isUpperCase\, \isIdentifier\, and immutable collection conversions. These implementations bridge JVM-specific character handling and utility methods to non-JVM environments using JavaScript interop (e.g., \String.codePointAt\, \RegExp\) and standard Kotlin collections, ensuring consistent behavior across supported platforms.

kotlinpoet/src/jsMain, kotlinpoet/src/nonJvmMain, kotlinpoet/src/wasmJsMain · high confidence

Initial KSP interop support for KotlinPoet

This release introduces the \interop/ksp\ module, providing extension functions to convert KSP symbols (such as \KSAnnotation\, \KSType\, \KSClassDeclaration\, and \Modifier\) into KotlinPoet types (\AnnotationSpec\, \TypeName\, \ClassName\, and \KModifier\). This enables users to generate Kotlin code using KotlinPoet directly from KSP analysis results, including support for type aliases, generic type parameters, and annotation arguments.

interop/ksp · high confidence

Initial project scaffolding and documentation site setup

The repository is initialized with essential configuration and documentation files. This includes an .editorconfig for consistent code formatting (2-space indentation, UTF-8, trailing whitespace trimming), .gitattributes for line-ending normalization, and a .gitignore for build artifacts and IDE files. A standard Apache 2.0 LICENSE.txt is added, along with a README.md introducing KotlinPoet and a RELEASING.md guide for version management. The project also sets up a MkDocs-based documentation website (mkdocs.yml) featuring a Material theme with dark mode support, navigation for API docs and interop modules, and includes Gradle wrapper scripts (gradlew, gradlew.bat) to ensure consistent build execution.

(repo-wide) · high confidence

KotlinPoet API surface expanded with new interfaces and methods

The public API for code generation has been extended to support more granular control and new language features. Users can now add comments directly to code blocks via the new \addComment\ method on \CodeBlock.Builder\ and the \CodeBlockHolder\ interface. Support for Kotlin's context parameters and context receivers has been introduced through new \ContextParameter\, \ContextParameterizable\, and \ContextReceivable\ types, allowing builders to define and manage these constructs. Additionally, the API exposes new builder interfaces for annotatable and documentable constructs, facilitating better extensibility for custom code generation logic.

kotlinpoet/api · high confidence

New JVM-specific annotation helpers for KotlinPoet

Added a new \JvmAnnotations.kt\ file in the JVM source set that provides extension functions for \FileSpec\, \TypeSpec\, \FunSpec\, \PropertySpec\, and \TypeName\ builders. These helpers allow users to easily add JVM-specific annotations such as \@JvmName\, \@JvmStatic\, \@JvmOverloads\, \@JvmSuppressWildcards\, \@JvmInline\, \@JvmRecord\, \@Throws\, \@Synchronized\, \@Strictfp\, \@JvmField\, \@Transient\, and \@Volatile\ to generated code. The file also includes deprecated stubs for \jvmDefault\ to maintain API compatibility while the underlying compiler flag support is updated.

kotlinpoet/src/jvmMain/kotlin/com/squareup/kotlinpoet/jvm · high confidence

New Kotlin metadata interop module for reading Kotlin class metadata

A new \kotlin-metadata\ interop module has been added to KotlinPoet, enabling the reading of Kotlin class metadata from compiled bytecode. This module introduces a \ClassInspector\ interface with two implementations: \ElementsClassInspector\ for use with the Java Compiler API and \ReflectiveClassInspector\ for runtime reflection. It provides utilities to convert Kotlin metadata (KmClass, KmType, etc.) into KotlinPoet's \TypeSpec\ and \FileSpec\ representations, allowing users to generate code that mirrors the structure of existing Kotlin classes based on their metadata annotations.

interop/kotlin-metadata/src/main · high confidence

New class-inspector data models for Kotlin metadata

The kotlin-metadata interop module introduces a new set of data classes and utilities to represent parsed Kotlin metadata for the ClassInspector. This includes ContainerData, ClassData, FileData, EnumEntryData, ConstructorData, MethodData, PropertyData, and FieldData, which collectively model classes, file facades, constructors, methods, properties, and fields along with their annotations and modifiers. Supporting utilities in ClassInspectorUtil handle annotation filtering, literal code generation, and JVM field inference, while a lightweight Optional wrapper supports non-null collections. These changes provide a structured, spec-based representation of Kotlin metadata that the ClassInspector can consume.

kotlin-metadata · high confidence

Support for KSP incremental processing via originating file tracking

Added new KotlinPoet APIs to support KSP incremental compilation. The \OriginatingKSFiles\ interface and associated extension functions (\originatingKSFiles\, \addOriginatingKSFile\) allow users to tag generated code with the source files that produced it. Additionally, \FileSpec.writeTo\ now accepts a \CodeGenerator\ and optional originating files to correctly register dependencies, ensuring that KSP can properly invalidate caches when source inputs change.

ksp · high confidence

API

Stable KSP interop APIs and Kotlin Metadata ABI definitions

The KSP interop module now exposes stable public APIs for converting Kotlin Symbol Processing (KSP) types to KotlinPoet types, including functions to transform annotations, class declarations, types, type parameters, modifiers, and visibility. It also provides utilities to manage originating KSP files on builders and write generated code directly to the KSP code generator. Additionally, the kotlin-metadata module publishes its public API surface, defining the contract for class inspectors and data models used to inspect Kotlin metadata.

interop · high confidence

Behavioural changes

KotlinPoet JVM source files restructured into new package layout

The JVM-specific implementation files for KotlinPoet (including core types like CodeBlock, ClassName, FunSpec, and FileSpec, along with supporting interfaces and utilities) have been moved into the com.squareup.kotlinpoet package under the jvmMain source set. This change reorganizes the existing JVM codebase into a new directory structure without altering the public API or behavior of the library.

kotlinpoet/src/jvmMain/kotlin/com/squareup/kotlinpoet · high confidence

Migrate core KotlinPoet components to Kotlin Multiplatform

KotlinPoet has migrated several core internal and public components from JVM-only to common code, enabling usage across Kotlin Multiplatform targets. This change introduces common implementations for \LineWrapper\ (including support for the new \♢\ modifier for wrapping spaces), \NameAllocator\ (with added \contains\ API for checking allocated tags), \KModifier\, \KOperator\, \Import\, and utility classes like \CodePoint\ and \Util\. Additionally, delicate and experimental API markers (\DelicateKotlinPoetApi\, \ExperimentalKotlinPoetApi\) are now available in common, and string literal generation now correctly preserves carriage returns and raw-string newlines.

kotlinpoet/src/commonMain · high confidence

Test coverage

Added JVM test coverage for Java annotation arrays and type names; Added KSP interop test coverage for type resolution and annotation processing; Added KSP test processor infrastructure; Added test coverage for Kotlin metadata specs and class inspectors; Migrate test suite to AssertK.

Dependencies

Upgrade Gradle wrapper to version 9.8.0

The project's Gradle wrapper has been updated to use Gradle 9.8.0 (bin distribution). This change ensures that builds are executed with the specified version and includes configuration for SHA-256 checksum validation and network timeout settings to improve build reliability and security.

gradle · high confidence

Upgrade to Kotlin 2.4 and KSP 2.3 with multiplatform support

The build system has been upgraded to Kotlin 2.4.20 and KSP 2.3.12, enabling the main KotlinPoet library to target JVM, JS, and WasmJs platforms. This change also updates the KSP interop module to use KSP 2.3.12 and adopts Gradle version catalogs for dependency management, while configuring the project to publish to the Sonatype Central Portal.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 57 → 59 (+1.3)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 94 → 90 (-3.4)
  • Architecture 98 → 98 (+0.0)
  • Maturity 50 → 45 (-4.7)
  • Readiness 49 → 57 (+7.5)
  • Security 80 → 77 (-2.3)

Resolved (8)

  • Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no project overview (docs/objects.md)
  • Duplicated block (16 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Duplicated block (5 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Off-boarding risk: anonymized user #1
  • Orphaned file (kotlinpoet/src/commonMain/kotlin/com/squareup/kotlinpoet/LineWrapper.kt)
  • Orphaned file (kotlinpoet/src/jvmMain/kotlin/com/squareup/kotlinpoet/WildcardTypeName.kt)

New (55)

  • Duplicated block (12 lines × 2) (kotlinpoet/src/jvmMain/kotlin/com/squareup/kotlinpoet/TypeVariableName.kt)
  • Duplicated block (14 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Duplicated block (18 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Duplicated block (21 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Duplicated block (5 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Duplicated block (7 lines × 2) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Edited copy of a member (10 corresponding lines) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Edited copy of a member (10 corresponding lines) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Edited copy of a member (10 corresponding lines) (kotlinpoet/src/jsMain/kotlin/com/squareup/kotlinpoet/CodePoint.js.kt)
  • Edited copy of a member (10 corresponding lines) (kotlinpoet/src/jsMain/kotlin/com/squareup/kotlinpoet/CodePoint.js.kt)
  • Edited copy of a member (18 corresponding lines) (kotlinpoet/src/jvmMain/kotlin/com/squareup/kotlinpoet/TypeVariableName.kt)
  • Edited copy of a member (249 corresponding lines) (interop/kotlin-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/classinspectors/ElementsClassInspector.kt)
  • Off-boarding risk: anonymized user #1
  • Outdated (compile): com.fasterxml.jackson.core:jackson-annotations
  • Outdated (compile): com.fasterxml.jackson.core:jackson-core
  • Outdated (compile): com.fasterxml.jackson.core:jackson-databind
  • Outdated (compile): com.fasterxml.jackson.dataformat:jackson-dataformat-xml
  • Outdated (compile): com.fasterxml.jackson.module:jackson-module-kotlin
  • Outdated (compile): com.fasterxml.jackson:jackson-bom
  • Outdated (compile): com.fasterxml.woodstox:woodstox-core
  • …and 35 more

Changes since last survey

  • 17 commits — 16 feature/other, 1 fixes

By area

  • .github/workflows — 7 commits
  • gradle/libs.versions.toml — 3 commits
  • gradle/wrapper — 2 commits
  • kotlinpoet/src — 2 commits
  • docs/changelog.md — 1 commit
  • docs/functions.md — 1 commit
  • interop/ksp — 1 commit

Notable commits

  • fix: fix: Preserve KSP type-use annotations during TypeName conversion (#2422)
  • change: Deprecate support for context receivers
  • change: Emit long lines in linear time (#2420)
  • change: Preserve subtype return types when copying type names (#2429)
  • change: Update Gradle to v9.9.0 (#2419)
  • change: Update Gradle to v9.9.1 (#2426)
  • change: Update dependency click to v8.5.1 (#2421)
  • change: Update dependency lunr to v0.8.1 (#2416)
  • change: Update dependency mkdocs-material to v9.8.1 (#2423)
  • change: Update dependency pymdown-extensions to v13 (#2424)
  • change: Update dependency pymdown-extensions to v13.1 (#2428)
  • change: Update dependency python-dateutil to v4 (#2415)
  • change: Update dependency tornado to v6.6.1 (#2425)
  • change: Update ksp monorepo to v2.3.13 (#2414)
  • change: Update plugin dokka to v2.3.0 (#2418)
  • change: Update plugin spotless to v8.11.0 (#2417)
  • change: docs: show how to generate reified type parameters (#2427)

Architecture

  • Unchanged — 0 containers · 3 contexts · 2 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

square/kotlinpoet was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 13 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 5a120729f764333857b522523c12a8f4bd1dd3fc — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.64+preprod-569132d3dfbe.