JetBrains、ランタイム生成とホットリロード対応の KotlinLLM をオープンソース化
本文の状態
日本語全文を表示中
詳細モードで約3分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
MarkTechPost
JetBrains は IntelliJ IDEA 用プラグイン「KotlinLLM」をオープンソース化し、ランタイムでコードを生成・ホットリロードするスマートマクロ機能を実装した。
AI深層分析を開く2026年7月31日 21:53
AI深層分析
キーポイント
スマートマクロの仕組み
asLlm や mockLlm といった関数呼び出しが実行時に生成された Kotlin コードに展開され、JDI を介してランタイムでクラス再定義を行う。
動的進化ループの実装
生成ロジックと実行状況が不一致した場合、プラグインはフックをキャプチャし LLM エージェントにコード更新を依頼して即時リトライする。
実証実験の結果
Spring Petclinic プロジェクトでのテストでは 24 シナリオすべてが完了し、ホットリロード成功率は 100%、オーバーヘッドは約 1% と報告された。
現状の制限と要件
現在は研究用プロトタイプであり、IntelliJ IDEA 2025.2.x や JDK 21、OpenAI API キーが必要だが、生成されたコード自体はデプロイ可能である。
研究用プロトタイプとしての位置づけ
KotlinLLM は実験的な IntelliJ IDEA プラグインであり、現時点では本番環境での実行を想定していない。生成されたコードは通常の Kotlin ソースとしてコミット・レビュー可能で、モデル依存なしにデプロイできる。
重要な引用
KotlinLLM is an IntelliJ IDEA plugin for Kotlin/JVM projects that adds a language feature called Smart macros.
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.
On an adapted Spring Petclinic Kotlin project with 18 asLlm call sites, 24 of 24 application scenarios completed after Smart macro evolution.
Once behavior has been generated, the target project can compile and run that behavior without another LLM request for the same scenario.
編集コメントを表示
編集コメント
ランタイムでのコード生成と即時適用という概念は、従来の静的なコード生成ツールとは一線を画す革新的なアプローチである。ただし、現在は研究プロトタイプ段階であり、安定性とセキュリティの観点から本番環境への適用には慎重な検証が必要となるだろう。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
スマートマクロの進化プロセスについて解説します。
以下の埋め込みコンテンツでは、マクロ API の仕組みを解説し、9 つのステップからなるランタイムループをアニメーションで示すとともに、カバーされたシナリオが推論呼び出しのコスト増を防ぐ理由をモデル化しています。
window.addEventListener("message",function(e){if(e.data&&e.data.klmHeight){var f=document.getElementById("klm-frame");if(f&&e.data.klmHeight>200){f.style.height=e.data.klmHeight+"px";}}});
報告された結果
18 箇所に LLM 呼び出しがある Spring Petclinic Kotlin プロジェクトをベースに、スマートマクロの進化後には 24 のアプリケーションシナリオすべてが正常に完了しました。ホットリロードの成功率は 100% で、コンパイルや再定義によるランタイムオーバーヘッドは全体の約 1% です。
また、合成された「GitHub ベギナーイシューレーダー」では、20 のリポジトリと 3 万件以上の実データから実際のイシュー情報を解析し、ベギナーラベルの正解値に対する再現率(recall)が約 0.89 に達しました。
セットアップ要件
本プラグインには IntelliJ IDEA 2025.2.x および JDK 21 が必要です。OpenAI API キーは、ツールメニューから「KotlinLLM Settings」を開き、対象プロジェクト内の .kotlinllm ファイルに保存します。
Apache License 2.0 の下で公開されており、実行可能なサンプルや論文の記述、そして KotlinConf 2026 の登壇記録もリポジトリ内に用意されています。
実運用は可能でしょうか?
まだ本番環境での利用は想定されていません。JetBrains は KotlinLLM を研究用プロトタイプとして位置づけ、実験的な IntelliJ IDEA プラグインと説明しています。プラグイン自体は実験段階ですが、生成される出力は実際にデプロイ可能です。一度動作が生成されれば、対象プロジェクトはそのコードをコンパイルして実行でき、同じシナリオで再度 LLM に問い合わせる必要はありません。最終的に納品するのはモデル依存ではなく、純粋な Kotlin コードです。
企業レベルでの活用では、現在最も適しているのは R&D 部門や、中堅から大規模な Kotlin/JVM 環境を持つプラットフォームチーム、そしてプロトタイプツールのリスク許容度が高いスタートアップです。規制の厳しい企業でも、生成されたソースコードはレビュー可能なコードとして扱うべきであり、KotlinLLM はまさにその方針でソースを保存します。
適用業界としては、JVM/Kotlin の資産が豊富なフィンテックや銀行、開発者向けツールの提供、E コマース、物流、そして複雑なサードパーティ製 API のペイロードを処理する必要があるあらゆるチームが挙げられます。
具体的なユースケースには、半構造化された API 応答を型付き値に正規化すること、進化し続けるテスト用ダミーオブジェクトの構築、アップストリームのスキーマ変化への適応、ノイズの多いテキストフィールドの分類などがあります。
キーポイント
- KotlinLLM は本番環境用の実行時ではなく、JetBrains Research のプロトタイプです。
- スマートマクロが生成した Kotlin ソースは、プラグインなしでもコミット・レビュー・実行が可能です。
- 対応済みのシナリオでは LLM 呼び出しが発生しないため、レイテンシやコストの増加はありません。
- Petclinic での評価結果は、24/24 のシナリオで 100% のホットリロードが成功し、オーバーヘッドは約 1% です。
- Apache 2.0 ライセンス。Kotlin/JVM 専用で、IntelliJ IDEA 2025.2.x と JDK 21 を必要とします。
出典:JetBrains Research ブログ、kotlinllm-plugin の README、InfoWorld
JetBrains が「KotlinLLM」をオープンソース化。実行時に Kotlin ソースコードを生成し、JDI を通じてホットリロードするスマートマクロです。
この投稿は元々 MarkTechPost で公開されたものです。
原文を表示
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 CodeCopiedUse 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/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.
Explainer: how a Smart macro evolves
The embed below walks the macro API, animates the nine-step runtime loop, and models why covered scenarios stop costing inference calls.
window.addEventListener("message",function(e){if(e.data&&e.data.klmHeight){var f=document.getElementById("klm-frame");if(f&&e.data.klmHeight>200){f.style.height=e.data.klmHeight+"px";}}});
Reported results
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.
Setup requirements
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.
Is it deployable?
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.
Company level: best fit today is R&D groups, platform teams at mid-size to large Kotlin/JVM entities, and startups with tolerance for prototype tooling. Regulated enterprises should treat generated sources as reviewable code, which is exactly how KotlinLLM stores them.
Industries: fintech and banking (heavy JVM/Kotlin estates), developer tooling, e-commerce, logistics, and any team parsing messy third-party API payloads.
Applications: normalizing semi-structured API responses into typed values, building evolving test doubles, adapting to upstream schema drift, and classification over noisy text fields.
Key Takeaways
KotlinLLM is a JetBrains Research prototype, not a production runtime.
Smart macros generate Kotlin source that is committed, reviewed, and run without the plugin.
Covered scenarios trigger no further LLM call, so no added latency or cost.
Petclinic evaluation: 24/24 scenarios, 100% hot-reload, ~1% overhead.
Apache 2.0, Kotlin/JVM only, IntelliJ IDEA 2025.2.x plus JDK 21.
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.
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み