Skip to content

chore: replace the deprecated IntelliJ APIs that have a replacement in 2024.2 - #2032

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:chore/replace-deprecated-apis
Nov 20, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:chore/replace-deprecated-apis

Conversation

@lagergren

@lagergren lagergren commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1971.

The plugin verifier reports 50 uses of deprecated IntelliJ APIs against
2026.3. This replaces 14 of them, whose replacement exists in 2024.2,
LSP4IJ's minimum, and isn't deprecated up to 2026.3:

  • ProcessAdapter becomes ProcessListener, whose methods have
    defaults (ExecTask).
  • The override of InlayHintsProviderFactory.getProvidersInfo(Project)
    is removed: its default calls getProvidersInfo(), which
    LSPInlayHintProvidersFactory overrides.
  • FileChooserDescriptorFactory.createSingleFileDescriptor() becomes
    new FileChooserDescriptor(true, true, true, true, false, false),
    which is what it returns in 2024.2: a file, a folder or a jar.
    createSingleFileNoJarsDescriptor() and singleFile() only take
    files, and a program to debug can be a folder, such as a Go package
    (DebugAdapterServerPanel).
  • new URL(String) becomes URI.create(String).toURL()
    (GitHubAssetFetcher, MavenArtifactFetcher). Both URLs are built
    from a template's owner and repository, or from an encoded query, and
    an IllegalArgumentException lands in the same catch (Exception).
  • ReadAction.compute and ReadAction.run become
    Application.runReadAction (LSPPendingHoverDocumentationTarget,
    LSPLinkedEditingRangeSynchronizer, LSPParameterInfoHandler,
    DAPValue). The calls that return a value cast their lambda to
    Computable, since 2026.3 has no runReadAction(ThrowableComputable).
  • DynamicBundle(String) becomes DynamicBundle(Class, String)
    (LanguageServerBundle, DAPBundle).
  • Document.addDocumentListener(DocumentListener) becomes
    addDocumentListener(DocumentListener, Disposable) in
    WorkspaceFoldersPanel, which LanguageServerPanel disposes.

Not here, and left in #1971:

  • DebugAdapterServerPanel's addDocumentListener: the owners of the panel (DebugAdapterServerView, DAPSettingsEditor, NewDebugAdapterServerDialog) dispose it with a direct call of dispose(), not through the Disposer, so it can't be the parent of a listener. (Corrected after the merge: this said that nothing disposes the panel. chore: replace three more deprecated IntelliJ APIs of #1971 #2040 moves the listener to EditorTextField.addDocumentListener.)
  • JarUriConverter's new URL(uri): URI.create rejects unencoded characters that new URL accepts.
  • JsonTextField's addDocumentListener, which needs a Disposable passed in.

Tests

  • The tests of the changed classes pass on 2024.2 (134 tests in 13 classes, among them LSPLinkedEditingRangeSynchronizerTest, LSPParameterInfoHandlerTest, HoverWithoutWaitingTest, DAPValueSourcePositionTest, WorkspaceFoldersPanelTest, ExecTaskFactoryTest and the inlay hint tests).
  • compileJava passes against IU 2026.3 too (-PplatformVersion=2026.3 -PplatformType=IU).
  • Compiled against 2024.2, the calls go to runReadAction(Computable) and runReadAction(Runnable), which 2026.3 has (checked with javap).
  • The plugin verifier should report 36 uses of deprecated API against 2026.3 instead of 50.

…n 2024.2

Part of redhat-developer#1971.

The plugin verifier reports 50 uses of deprecated IntelliJ APIs against
2026.3. This replaces 14 of them, whose replacement exists in 2024.2,
LSP4IJ's minimum, and isn't deprecated up to 2026.3:

- `ProcessAdapter` becomes `ProcessListener`, whose methods have
  defaults (`ExecTask`).
- The override of `InlayHintsProviderFactory.getProvidersInfo(Project)`
  is removed: its default calls `getProvidersInfo()`, which
  `LSPInlayHintProvidersFactory` overrides.
- `FileChooserDescriptorFactory.createSingleFileDescriptor()` becomes
  `new FileChooserDescriptor(true, true, true, true, false, false)`,
  which is what it returns in 2024.2: a file, a folder or a jar.
  `createSingleFileNoJarsDescriptor()` and `singleFile()` only take
  files, and a program to debug can be a folder, such as a Go package
  (`DebugAdapterServerPanel`).
- `new URL(String)` becomes `URI.create(String).toURL()`
  (`GitHubAssetFetcher`, `MavenArtifactFetcher`). Both URLs are built
  from a template's owner and repository, or from an encoded query, and
  an `IllegalArgumentException` lands in the same `catch (Exception)`.
- `ReadAction.compute` and `ReadAction.run` become
  `Application.runReadAction` (`LSPPendingHoverDocumentationTarget`,
  `LSPLinkedEditingRangeSynchronizer`, `LSPParameterInfoHandler`,
  `DAPValue`). The calls that return a value cast their lambda to
  `Computable`, since 2026.3 has no `runReadAction(ThrowableComputable)`.
- `DynamicBundle(String)` becomes `DynamicBundle(Class, String)`
  (`LanguageServerBundle`, `DAPBundle`).
- `Document.addDocumentListener(DocumentListener)` becomes
  `addDocumentListener(DocumentListener, Disposable)` in
  `WorkspaceFoldersPanel`, which `LanguageServerPanel` disposes.
@lagergren lagergren added this to the 0.30.2 milestone Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Debug adapter configuration now lets you select files, folders, or JARs when choosing a path.
  • Refactor
    • Updated several internal operations related to language server features, debugging, installation, and workspace settings. No additional user-facing behavior changes are noted.

This PR updates bundle initialization, read-action calls, UI configuration, installation utilities, and the inlay-provider API.

Changes: Platform API and UI Updates

Layer / File(s) Summary
Bundle initialization
src/main/java/com/redhat/devtools/lsp4ij/LanguageServerBundle.java, src/main/java/com/redhat/devtools/lsp4ij/dap/DAPBundle.java
Both constructors now pass the bundle class and resource name to DynamicBundle.
Read-action calls
src/main/java/com/redhat/devtools/lsp4ij/dap/client/variables/DAPValue.java, src/main/java/com/redhat/devtools/lsp4ij/features/documentation/LSPPendingHoverDocumentationTarget.java, src/main/java/com/redhat/devtools/lsp4ij/features/linkedEditingRange/LSPLinkedEditingRangeSynchronizer.java, src/main/java/com/redhat/devtools/lsp4ij/features/signatureHelp/LSPParameterInfoHandler.java
These call sites now use ApplicationManager.getApplication().runReadAction(...) instead of ReadAction methods. Existing checks and callback behavior remain unchanged.
UI controls and listener lifecycle
src/main/java/com/redhat/devtools/lsp4ij/dap/settings/ui/DebugAdapterServerPanel.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/WorkspaceFoldersPanel.java
The DAP file chooser now permits files, folders, or jars. The workspace JSON document listener is registered with the panel as its parent disposable.
Installation utilities
src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/ExecTask.java, src/main/java/com/redhat/devtools/lsp4ij/installation/download/GitHubAssetFetcher.java, src/main/java/com/redhat/devtools/lsp4ij/installation/download/MavenArtifactFetcher.java
ExecTask now registers a ProcessListener while retaining its output handling. The GitHub and Maven fetchers convert URL strings with URI.create(...).toURL().
Inlay provider overload removal
src/main/java/com/redhat/devtools/lsp4ij/features/LSPInlayHintProvidersFactory.java
The getProvidersInfo(@NotNull Project project) overload and its Project import are removed.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Refactor

Suggested reviewers: angelozerr, hgschmie, muescha

Merge Risk: Minimal · up to f04fd

This change replaces deprecated platform API calls with supported equivalents, and no user-facing regression has been identified. It looks safe to merge after the normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: replacing deprecated IntelliJ APIs that have a replacement in 2024.2. The changeset replaces 14 such API usages across many files, which matches the title. The 'chore:…
Description check Passed The description states the scope: 14 deprecated API usages replaced, with each replacement listed per file. It also gives the test results, the 2026.3 compile check, and the items deferred to #1971. I…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: replacing deprecated IntelliJ APIs that have a replacement in 2024.2. The changeset replaces 14 such API usages across many files, which matches the title. The 'chore:' prefix is a conventional-commit type and does not affect the match.

Full details: Description check

Explanation

The description states the scope: 14 deprecated API usages replaced, with each replacement listed per file. It also gives the test results, the 2026.3 compile check, and the items deferred to #1971. It matches the changeset.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 98354b70-e081-4bad-b8e4-9a1e6dc71200
Commits

Reviewing files that changed from the base of the PR and between b354c38 and f04fdc3.

Files selected for processing: 12

  • src/main/java/com/redhat/devtools/lsp4ij/LanguageServerBundle.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/DAPBundle.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/client/variables/DAPValue.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/settings/ui/DebugAdapterServerPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/LSPInlayHintProvidersFactory.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/documentation/LSPPendingHoverDocumentationTarget.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/linkedEditingRange/LSPLinkedEditingRangeSynchronizer.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/signatureHelp/LSPParameterInfoHandler.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/ExecTask.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/download/GitHubAssetFetcher.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/download/MavenArtifactFetcher.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/WorkspaceFoldersPanel.java
Files with no reviewable changes: 1

  • src/main/java/com/redhat/devtools/lsp4ij/features/LSPInlayHintProvidersFactory.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.39%. Comparing base (b354c38) to head (f04fdc3).

Files with missing lines Patch % Lines
...sp4ij/dap/settings/ui/DebugAdapterServerPanel.java 0.00% 2 Missing ⚠️
...umentation/LSPPendingHoverDocumentationTarget.java 80.00% 0 Missing and 1 partial ⚠️
...lsp4ij/installation/definition/tasks/ExecTask.java 0.00% 1 Missing ⚠️
...p4ij/installation/download/GitHubAssetFetcher.java 0.00% 1 Missing ⚠️
...ij/installation/download/MavenArtifactFetcher.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2032      +/-   ##
==========================================
- Coverage   49.39%   49.39%   -0.01%     
==========================================
  Files         813      813              
  Lines       33323    33324       +1     
  Branches     5191     5191              
==========================================
  Hits        16461    16461              
+ Misses      14290    14288       -2     
- Partials     2572     2575       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren
lagergren merged commit 5b23165 into redhat-developer:main Nov 20, 2026
13 of 14 checks passed
lagergren added a commit that referenced this pull request Nov 21, 2026
…#2035)

`DAPLoopbackConnectionTest.withoutAnAddressTheWaitForTheDAPServerSeesItsSocketOnTheIPv6LoopbackAddress`
failed in the 2026.3 job of #2032, which doesn't touch DAP:

    org.opentest4j.AssertionFailedError: expected: <false> but was: <true>
        at ...DAPLoopbackConnectionTest.java:59

The three tests of the class listen on a port of `::1` that the system
picks, and expect nothing on the same port of `127.0.0.1`: a connection
there must be refused, and a client without an address must fall through
to `::1`. A port that is free on `::1` can be in use on `127.0.0.1` by
another program or test, and then the connection is accepted and the
test fails.

The tests now also bind that port of `127.0.0.1` with a socket that
doesn't listen, and take another port when it is in use. While it is
bound, nothing else can listen there, so a connection to it is refused.

### Tests

Checked on macOS, with another process as the other program:
- a program can listen on `127.0.0.1` on the port that the test has on `::1`, and a connection to it is then accepted, which is the failure of the job;
- then the reservation can't bind the port (`Address already in use`), and the test takes another one;
- once the port is reserved, another program can't listen on it, even with `SO_REUSEADDR`, nor can a `ServerSocket` with `SO_REUSEADDR`, and a connection to it is refused.

`DAPLoopbackConnectionTest` passes on a default JVM and on one that prefers IPv6 addresses.

Not here: two tests of `SocketStreamConnectionProviderTest` have the same race, `testWithoutAHostItReachesALanguageServerWhichListensOnTheIPv6LoopbackAddressOnly` and `testAnIPv4AddressAsTheHostIsNotTriedOverIPv6`. #2033 and #2034 change that file, so they can follow once those are merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant