NPE when updated to IntelliJ EAP 5

Hi. I am updating my IntelliJ plugin to support IntelliJ 2025.1 EAP 5 ( 2025.1 EAP build 251.21418.62) and ran into an issue with terminal widget compatibility.
Previously, I used:

TerminalWidget terminalWidget = terminalToolWindowManager.createShellWidget(
    project.getBasePath(), libertyModule.getName(), true, true);

the returned widget was an instance of JBTerminalWidget$TerminalWidgetBridge . I was able to convert it to ShellTerminalWidget using:

ShellTerminalWidget shellWidget = ShellTerminalWidget.toShellJediTermWidgetOrThrow(terminalWidget);

However, in IntelliJ 2025.1 EAP build 251.21418.62 , createShellWidget(...) now returns TerminalWidgetImpl , which is not compatible with ShellTerminalWidget .
Attempting to convert it using JBTerminalWidget.asJediTermWidget(terminalWidget) returns null , leading to an incompatible types error when assigning it to ShellTerminalWidget .
What is the correct way to handle TerminalWidgetImpl in 2025.1? Is there an official way to retrieve a ShellTerminalWidget from TerminalWidgetImpl.
Has ShellTerminalWidget been deprecated or replaced in the new API?

Any guidance on handling these API changes would be greatly appreciated! Thanks

1 Like

Inside asJediTermWidget, the following check is performed:

if (widget instanceof TerminalWidgetBridge bridge) {
    var10000 = bridge.widget();
} else {
    var10000 = null;
}

In previous versions, widget instanceof TerminalWidgetBridge bridge returned true because the created TerminalWidget was com.intellij.terminal.JBTerminalWidget$TerminalWidgetBridge . However, starting from IntelliJ EAP 5, this check now returns false since the created TerminalWidget is org.jetbrains.plugins.terminal.block.TerminalWidgetImpl , causing asJediTermWidget to return null .

1 Like

@Anusree_Lakshmi have you been able to figure this out yet? If not, have you tried looking at how current code in community is creating ShellTerminalWidget at all yet?

Or have you had a chance to look at this response to either question yet? :backhand_index_pointing_right: Execute command in Intellij terminal - #10 by Sergey.Simonchik

@chriscarini Thanks for your reply. This no longer occurs in the latest beta versions. So I have not investigated it further

This is caused by enabling an updated terminal implementation in 2025.1 EAPs. Please avoid casting to ShellTerminalWidget with ShellTerminalWidget.toShellJediTermWidgetOrThrow(terminalWidget). Instead, please use com.intellij.terminal.ui.TerminalWidget directly. Is there any API missing for you?