From 6ac466a5c873117d32ee43bbf056e57eda4221c8 Mon Sep 17 00:00:00 2001 From: Oleksandr Liemiahov Date: Mon, 2 Nov 2026 20:44:32 +0200 Subject: [PATCH] Declare the Java debugger module for the AI debugger on 2026.1+ Since 2026.2 `intellij.java.debugger.impl` is an optional content module of the Java plugin with its own classloader, and a dependency on `com.intellij.modules.java` exposes only `intellij.java.backend`. So ai-debugger-jvm could not load `JavaLineBreakpointType`, and `JvmAIDebuggerBreakpointType` failed with ClassNotFoundException on startup (EDU-9198). The module dependency is inserted by processResources for 2026.1+ only, because the module does not exist in 2025.x, where these classes are part of the Java plugin's main module. --- .../ai-debugger-jvm/build.gradle.kts | 23 +++++++++++++++++++ .../resources/ai-debugger-jvm.xml | 2 ++ 2 files changed, 25 insertions(+) diff --git a/intellij-plugin/hs-features/ai-debugger-jvm/build.gradle.kts b/intellij-plugin/hs-features/ai-debugger-jvm/build.gradle.kts index ad04a74c4..1de2bc8af 100644 --- a/intellij-plugin/hs-features/ai-debugger-jvm/build.gradle.kts +++ b/intellij-plugin/hs-features/ai-debugger-jvm/build.gradle.kts @@ -2,6 +2,20 @@ plugins { id("intellij-plugin-module-conventions") } +// Since 2026.1 the Java debugger API (`JavaLineBreakpointType`, `DebugProcessImpl`, etc.) lives in the +// `intellij.java.debugger.impl` content module of the Java plugin. In 2026.1 the module is required, +// so a dependency on the Java plugin is enough to see it, but since 2026.2 it is optional and has its own classloader, +// so it must be declared explicitly. In 2025.x these classes are part of the Java plugin's main module +private val javaDebuggerModuleDependenciesMarker = "" +private val javaDebuggerModuleDependencies = if (environmentName.toInt() >= 261) { + listOf( + "intellij.java.debugger.impl", + ).joinToString("\n") { " " } +} +else { + "" +} + dependencies { intellijPlatform { intellijIde(ideaVersion) @@ -14,4 +28,13 @@ dependencies { testImplementation(project(":intellij-plugin:hs-core", "testOutput")) testImplementation(project(":intellij-plugin:hs-features:ai-debugger-core", "testOutput")) +} + +tasks.processResources { + inputs.property("javaDebuggerModuleDependencies", javaDebuggerModuleDependencies) + filesMatching("ai-debugger-jvm.xml") { + filter { line -> + if (javaDebuggerModuleDependenciesMarker in line) javaDebuggerModuleDependencies else line + } + } } \ No newline at end of file diff --git a/intellij-plugin/hs-features/ai-debugger-jvm/resources/ai-debugger-jvm.xml b/intellij-plugin/hs-features/ai-debugger-jvm/resources/ai-debugger-jvm.xml index ac4ad57fb..40dfb7dd0 100644 --- a/intellij-plugin/hs-features/ai-debugger-jvm/resources/ai-debugger-jvm.xml +++ b/intellij-plugin/hs-features/ai-debugger-jvm/resources/ai-debugger-jvm.xml @@ -3,6 +3,8 @@ + +