Analysis API

Last modified: 12 September 2024

The Analysis API is a powerful library for analyzing code in Kotlin. Built on top of the Kotlin PSI syntax tree, it provides access to various semantic information, including reference targets, expression types, declaration scopes, diagnostics, and more.

While the Analysis API uses the Kotlin compiler internally, the API layer itself does not expose any compiler internals. The library offers both source and binary backward compatibility for its stable parts.

The Analysis API encapsulates all challenging parts needed for efficient Kotlin code analysis, including lazy resolution and cache invalidation, so you can focus on the actual code handling logic.