Skip to content

Commit 8269b5d

Browse files
committed
fix: support for IJ 2025.3 EAP
Signed-off-by: azerr <azerr@redhat.com>
1 parent c61c1cf commit 8269b5d

File tree

3 files changed

+56
-7
lines changed

3 files changed

+56
-7
lines changed

build.gradle.kts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ plugins {
3030
group = prop("pluginGroup")
3131
version = prop("pluginVersion")
3232

33+
val platformVersion = prop("platformVersion")
34+
val ideaVersionInt = when {
35+
// e.g. '20XY.Z'
36+
platformVersion.length == 6 -> platformVersion.replace(".", "").substring(2).toInt()
37+
// e.g. '2XY.ABCDE.12'
38+
else -> platformVersion.substringBefore(".").toInt()
39+
}
40+
3341
val quarkusVersion = prop("quarkusVersion")
3442
val lsp4mpVersion = prop("lsp4mpVersion")
3543
val quarkusLsVersion = prop("quarkusLsVersion")
@@ -75,10 +83,16 @@ sourceSets {
7583

7684
dependencies {
7785
intellijPlatform {
78-
create(prop("platformType"), prop("platformVersion"))
86+
create(prop("platformType"), platformVersion)
7987
// Bundled Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
8088
val platformBundledPlugins = ArrayList<String>()
8189
platformBundledPlugins.addAll(providers.gradleProperty("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }.get())
90+
/*
91+
* platformVersion check for JSON breaking changes since 2024.3
92+
*/
93+
if (ideaVersionInt >= 243) {
94+
platformBundledPlugins.add("com.intellij.modules.json")
95+
}
8296
bundledPlugins(platformBundledPlugins)
8397
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
8498
val platformPlugins = ArrayList<String>()
@@ -151,10 +165,10 @@ dependencies {
151165
testImplementation(libs.junit)
152166
}
153167

154-
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
168+
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+., and Java 21 for 2025.3+.
155169
kotlin {
156170
jvmToolchain {
157-
languageVersion = JavaLanguageVersion.of(17)
171+
languageVersion = JavaLanguageVersion.of(21)
158172
vendor = JvmVendorSpec.JETBRAINS
159173
}
160174
}

src/main/java/com/redhat/devtools/intellij/quarkus/run/dashboard/QuarkusRunDashboardCustomizer.java

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.intellij.ide.projectView.PresentationData;
1919
import com.intellij.openapi.module.Module;
2020
import com.intellij.openapi.project.Project;
21+
import com.intellij.openapi.util.Key;
2122
import com.intellij.ui.SimpleColoredComponent;
2223
import com.intellij.ui.SimpleTextAttributes;
2324
import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.project.PsiMicroProfileProject;
@@ -29,6 +30,7 @@
2930
import org.jetbrains.annotations.NotNull;
3031
import org.jetbrains.annotations.Nullable;
3132

33+
import java.lang.reflect.Method;
3234
import java.util.HashMap;
3335
import java.util.Map;
3436

@@ -42,22 +44,26 @@
4244
*/
4345
public class QuarkusRunDashboardCustomizer extends RunDashboardCustomizer {
4446

47+
private static final @Nullable Method putUserData = getPutUserDataMethod();
48+
49+
private static final @Nullable Key<Map<Object, Object>> NODE_LINKS = getNODE_LINKS();
50+
4551
@Override
4652
public boolean isApplicable(@NotNull RunnerAndConfigurationSettings settings, @Nullable RunContentDescriptor descriptor) {
4753
return settings.getConfiguration() instanceof QuarkusRunConfiguration;
4854
}
4955

5056
@Override
5157
public boolean updatePresentation(@NotNull PresentationData presentation, @NotNull RunDashboardRunConfigurationNode node) {
52-
if (!(node.getConfigurationSettings().getConfiguration() instanceof QuarkusRunConfiguration)) {
58+
var quarkusRunConfiguration = node.getConfigurationSettings().getConfiguration() instanceof QuarkusRunConfiguration config ? config : null;
59+
if (quarkusRunConfiguration == null) {
5360
return false;
5461
}
5562
RunContentDescriptor descriptor = node.getDescriptor();
5663
if (descriptor != null) {
5764
ProcessHandler processHandler = descriptor.getProcessHandler();
5865
if (processHandler != null && !processHandler.isProcessTerminated()) {
5966
// The Quarkus run configuration is running
60-
QuarkusRunConfiguration quarkusRunConfiguration = (QuarkusRunConfiguration) node.getConfigurationSettings().getConfiguration();
6167
Module module = quarkusRunConfiguration.getModule();
6268
if (QuarkusModuleUtil.isQuarkusWebAppModule(module)) {
6369
PsiMicroProfileProject mpProject = PsiMicroProfileProjectManager.getInstance(module.getProject()).getMicroProfileProject(module);
@@ -95,11 +101,41 @@ public void run() {
95101
TelemetryManager.instance().send(TelemetryEventName.UI_OPEN_DEV_UI);
96102
}
97103
});
98-
node.putUserData(RunDashboardCustomizer.NODE_LINKS, links);
104+
updateLinks(node, links);
99105
}
100106
}
101107
}
102108
return true;
103109
}
104110

111+
private void updateLinks(@NotNull RunDashboardRunConfigurationNode node, Map<Object, Object> links) {
112+
if (putUserData == null) {
113+
return;
114+
}
115+
try {
116+
putUserData.invoke(node, NODE_LINKS, links);
117+
} catch (Exception e) {
118+
119+
}
120+
}
121+
122+
private static @Nullable Method getPutUserDataMethod() {
123+
try {
124+
// We need to use Java Reflection since IU 2025.3 has removed RunDashboardRunConfigurationNode.putUserData
125+
return RunDashboardRunConfigurationNode.class.getMethod("putUserData", Key.class, Object.class);
126+
} catch (Exception e) {
127+
return null;
128+
}
129+
}
130+
131+
private static @Nullable Key<Map<Object, Object>> getNODE_LINKS() {
132+
try {
133+
// We need to use Java Reflection since IU 2025.3 has removed RunDashboardCustomizer.NODE_LINKS
134+
var field = RunDashboardCustomizer.class.getDeclaredField("NODE_LINKS");
135+
return (Key<Map<Object, Object>>) field.get(RunDashboardCustomizer.class);
136+
} catch (Exception e) {
137+
return null;
138+
}
139+
}
140+
105141
}

src/main/java/com/redhat/devtools/intellij/qute/psi/internal/extensions/renarde/RenardeResolvedJavaTypeFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.redhat.qute.commons.jaxrs.JaxRsMethodKind;
2727
import com.redhat.qute.commons.jaxrs.JaxRsParamKind;
2828
import com.redhat.qute.commons.jaxrs.RestParam;
29-
import org.gradle.internal.impldep.org.testng.annotations.IAnnotation;
3029

3130
/**
3231
* Custom Factory to create an {@link ResolvedJavaTypeInfo} instance for Renarde

0 commit comments

Comments
 (0)