JetBrains Open-Sources KotlinLLM: Smart Macros That Generate Kotlin Source Code at Runtime and Hot-Reload It Through JDI
JetBrains Research Open-Sources KotlinLLM.

JetBrains Research Open-Sources KotlinLLM. KotlinLLM is an IntelliJ IDEA plugin for Kotlin/JVM projects that adds a language feature called Smart macros . A Smart macro is a regular Kotlin function call whose body is generated Kotlin code. The public API is deliberately small. asLlm(from, hint) converts an input of type F into a typed value T, such as a data class, enum, list, or primitive. mockLlm() generates a stateful implementation of an interface T, whose behavior depends on which methods are called on it.
When a project launches through the KotlinLLM run configuration, the plugin scans for asLlm and mockLlm calls, updates generated bootstrap/provider/parser/mock files, launches the run configuration under JDI, and registers breakpoints on generated regenerate hooks. If generated logic does not match a runtime scenario, execution reaches a hook. The plugin captures runtime values and type information from the suspended frame, the LLM agent submits a code update, and the plugin compiles it and redefines the loaded class before retrying the original call.
KotlinLLM targets Kotlin/JVM specifically because the runtime evolution loop depends on JVM class redefinition through JDI.
The embed below walks the macro API, animates the nine-step runtime loop, and models why covered scenarios stop costing inference calls.
On an adapted Spring Petclinic Kotlin project with 18 asLlm call sites, 24 of 24 application scenarios completed after Smart macro evolution, with a 100% hot-reload success rate and compilation/redefinition adding roughly 1% of total runtime overhead. A synthetic “GitHub Beginner Issue Radar” parsed real issue data across 20 repositories and 30k+ issues, reaching about 0.89 recall on ground-truth beginner labels.
The plugin requires IntelliJ IDEA 2025.2.x, JDK 21, and an OpenAI API key stored in the target project’s .kotlinllm file via Tools > KotlinLLM Settings . It is released under the Apache License 2.0, with runnable examples, the thesis write-up , and the KotlinConf 2026 talk recording in the repository .
Not as a production runtime, at least not yet. JetBrains labels KotlinLLM a research prototype , and it is described it as an experimental IntelliJ IDEA plugin. The plugin is experimental, but its output is deployable . Once behavior has been generated, the target project can compile and run that behavior without another LLM request for the same scenario. You ship plain Kotlin, not a model dependency.
Sources: JetBrains Research blog , the kotlinllm-plugin README , and InfoWorld
The post JetBrains Open-Sources KotlinLLM: Smart Macros That Generate Kotlin Source Code at Runtime and Hot-Reload It Through JDI appeared first on MarkTechPost .
Source: MarkTechPost