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 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<F, T>(from, hint) converts an input of type F into a typed value T, such as a data class, enum, list, or primitive. mockLlm<T>() generates a stateful implementation of an interface T, whose behavior depends on which methods are called on it. Copy Code Copied Use a different Browser val issuesApiUrl: String = asLlm(repoInput, hint = "GitHub API URL: get all issues, including closed") val issues: List<Issue> = asLlm(response, hint = "Return all beginner-friendly issues for this repository") The runtime loop When a project launches through the KotlinLLM run configuration, the plugin scans for asLlm and mockLlm calls, updates generated bootstrap/provider/...
