JetBrains Open-Sources KotlinLLM: Smart Macros That Generate Kotlin Source Code at Runtime and Hot-Reload It Through JDI
JetBrains Research Open-Sources KotlinLLM. KotlinLLM is an IntelliJ IDEA plugin for Kotlin/JVM projects that provides a language function referred to as Smart macros. A Smart macro is a daily Kotlin perform name whose physique is generated Kotlin code. The public API is intentionally small. asLlm<F, T>(from, trace) converts an enter of sort F right into a typed worth T, akin to a knowledge class, enum, listing, or primitive. mockLlm<T>() generates a stateful implementation of an interface T, whose habits depends upon which strategies are referred to as on it.
val issuesApiUrl: String = asLlm(repoInput, trace = "GitHub API URL: get all points, together with closed")
val points: List<Issue> = asLlm(response, trace = "Return all beginner-friendly points for this repository")
The runtime loop
When a challenge launches by the KotlinLLM run configuration, the plugin scans for asLlm and mockLlm calls, updates generated bootstrap/supplier/parser/mock information, launches the run configuration below JDI, and registers breakpoints on generated regenerate hooks. If generated logic doesn’t match a runtime situation, execution reaches a hook. The plugin captures runtime values and sort data from the suspended body, the LLM agent submits a code replace, and the plugin compiles it and redefines the loaded class earlier than retrying the unique name.
KotlinLLM targets Kotlin/JVM particularly as a result of the runtime evolution loop depends upon JVM class redefinition by JDI.
Explainer: how a Smart macro evolves
The embed beneath walks the macro API, animates the nine-step runtime loop, and fashions why lined situations cease costing inference calls.
Reported outcomes
On an tailored Spring Petclinic Kotlin challenge with 18 asLlm name websites, 24 of 24 utility situations accomplished after Smart macro evolution, with a 100% hot-reload success fee and compilation/redefinition including roughly 1% of complete runtime overhead. An artificial “GitHub Beginner Issue Radar” parsed actual subject information throughout 20 repositories and 30k+ points, reaching about 0.89 recall on ground-truth newbie labels.
Setup necessities
The plugin requires IntelliJ IDEA 2025.2.x, JDK 21, and an OpenAI API key saved within the goal challenge’s .kotlinllm file by way of Tools > KotlinLLM Settings. It is launched below the Apache License 2.0, with runnable examples, the thesis write-up, and the KotlinConf 2026 talk recording within the repository.
Is it deployable?
Not as a manufacturing runtime, at least not but. JetBrains labels KotlinLLM a analysis prototype, and it’s described it as an experimental IntelliJ IDEA plugin. The plugin is experimental, however its output is deployable. Once habits has been generated, the goal challenge can compile and run that habits with out one other LLM request for a similar situation. You ship plain Kotlin, not a mannequin dependency.
- Company degree: finest match in the present day is R&D teams, platform groups at mid-size to giant Kotlin/JVM entities, and startups with tolerance for prototype tooling. Regulated enterprises ought to deal with generated sources as reviewable code, which is precisely how KotlinLLM shops them.
- Industries: fintech and banking (heavy JVM/Kotlin estates), developer tooling, e-commerce, logistics, and any crew parsing messy third-party API payloads.
- Applications: normalizing semi-structured API responses into typed values, constructing evolving check doubles, adapting to upstream schema drift, and classification over noisy textual content fields.
Key Takeaways
- KotlinLLM is a JetBrains Research prototype, not a manufacturing runtime.
- Smart macros generate Kotlin supply that’s dedicated, reviewed, and run with out the plugin.
- Covered situations set off no additional LLM name, so no added latency or price.
- Petclinic analysis: 24/24 situations, 100% hot-reload, ~1% overhead.
- Apache 2.0, Kotlin/JVM solely, IntelliJ IDEA 2025.2.x plus JDK 21.
Sources: JetBrains Research blog, the kotlinllm-plugin README, and InfoWorld
The put up JetBrains Open-Sources KotlinLLM: Smart Macros That Generate Kotlin Source Code at Runtime and Hot-Reload It Through JDI appeared first on MarkTechPost.
