Skip to content

chore: replace three more deprecated IntelliJ APIs of #1971 - #2040

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

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

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Part of #1971.

  • Document.addDocumentListener(DocumentListener): JsonTextField adds
    its listener, and lets others add theirs, with
    EditorTextField.addDocumentListener, which needs no Disposable and
    keeps the listener on a document that the field gets later.
    DebugAdapterServerPanel adds the listener of its attach
    configuration that way: its three owners dispose it with a direct
    call of dispose(), not through the Disposer, so it couldn't be the
    parent of the listener.
  • PluginDescriptor.getClassLoader(): ServerExtensionPointBean and
    DebugAdapterServerExtensionPointBean call getPluginClassLoader(),
    with the fallback that getClassLoader() has in 2024.2 and 2026.3, the
    class loader of the descriptor's class.

Not here, and left in #1971:

  • InspectionOptionsPanel in AbstractDelegateInspectionWithExclusions,
    which Quarkus Tools and Liberty Tools extend: an options pane would
    bind excludeList by name, which needs testing with them.
  • JarUriConverter's new URL(uri): URI.create rejects unencoded
    characters that new URL accepts.

Test: JsonTextFieldTest (new) checks that the validation handlers and
the document listeners of the field hear of each change of its document.
It and the settings and extension tests pass (42 tests). The change
compiles against 2024.2 and 2026.3.

…r#1971

Part of redhat-developer#1971.

- `Document.addDocumentListener(DocumentListener)`: `JsonTextField` adds
  its listener, and lets others add theirs, with
  `EditorTextField.addDocumentListener`, which needs no `Disposable` and
  keeps the listener on a document that the field gets later.
  `DebugAdapterServerPanel` adds the listener of its attach
  configuration that way: its three owners dispose it with a direct
  call of `dispose()`, not through the `Disposer`, so it couldn't be the
  parent of the listener.
- `PluginDescriptor.getClassLoader()`: `ServerExtensionPointBean` and
  `DebugAdapterServerExtensionPointBean` call `getPluginClassLoader()`,
  with the fallback that `getClassLoader()` has in 2024.2 and 2026.3, the
  class loader of the descriptor's class.

Not here, and left in redhat-developer#1971:
- `InspectionOptionsPanel` in `AbstractDelegateInspectionWithExclusions`,
  which Quarkus Tools and Liberty Tools extend: an options pane would
  bind `excludeList` by name, which needs testing with them.
- `JarUriConverter`'s `new URL(uri)`: `URI.create` rejects unencoded
  characters that `new URL` accepts.

Test: `JsonTextFieldTest` (new) checks that the validation handlers and
the document listeners of the field hear of each change of its document.
It and the settings and extension tests pass (42 tests). The change
compiles against 2024.2 and 2026.3.
@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

  • Bug Fixes
    • Improved loading of localized text for debug adapter and language server extensions when the plugin class loader is unavailable.
    • Attach configuration previews now continue to refresh as the configuration changes.
    • JSON settings fields now keep validation and change notifications working across document updates, helping ensure edits are consistently reflected.

The extension-point beans now use a plugin class loader with a fallback to the descriptor class’s loader. UI fields register document listeners through the field, and tests verify listener notifications after text changes.

Changes: Resource-bundle class loading

Layer / File(s) Summary
Localized bundle loader fallback
src/main/java/com/redhat/devtools/lsp4ij/dap/definitions/extension/DebugAdapterServerExtensionPointBean.java, src/main/java/com/redhat/devtools/lsp4ij/server/definition/extension/ServerExtensionPointBean.java
Both extension-point beans use the plugin class loader when available and otherwise use the descriptor class’s loader to load resource bundles.

Document-listener registration

Layer / File(s) Summary
Field-level document listeners
src/main/java/com/redhat/devtools/lsp4ij/settings/ui/JsonTextField.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/DebugAdapterServerPanel.java, src/test/java/com/redhat/devtools/lsp4ij/settings/ui/JsonTextFieldTest.java
JsonTextField registers its validation listener through its field and adds a public listener-registration method. Tests check notifications after text changes. DebugAdapterServerPanel attaches its listener to the attach-configuration field.

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

Change: Refactor

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 4eaf7

This PR replaces deprecated IntelliJ APIs for class-loader selection and document-listener registration. The visible changes keep the previous behavior, and no concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names a real and central part of the changeset: replacing deprecated IntelliJ APIs (Document.addDocumentListener and PluginDescriptor.getClassLoader) in several files, as part of the #1971 e…
Description check Passed The description is directly related to the changeset. It explains the replacement of Document.addDocumentListener with EditorTextField.addDocumentListener in JsonTextField and DebugAdapterServerPanel,…
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 a real and central part of the changeset: replacing deprecated IntelliJ APIs (Document.addDocumentListener and PluginDescriptor.getClassLoader) in several files, as part of the #1971 effort. It is concise and specific enough for a teammate to understand the primary change.

Full details: Description check

Explanation

The description is directly related to the changeset. It explains the replacement of Document.addDocumentListener with EditorTextField.addDocumentListener in JsonTextField and DebugAdapterServerPanel, and the switch to getPluginClassLoader() in the two extension point beans. It also lists deferred items, names the new test, and reports test results.

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: 9994687e-a722-4a15-86b8-0a4d11a09180
Commits

Reviewing files that changed from the base of the PR and between 13916a2 and 4eaf7c4.

Files selected for processing: 5

  • src/main/java/com/redhat/devtools/lsp4ij/dap/definitions/extension/DebugAdapterServerExtensionPointBean.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/settings/ui/DebugAdapterServerPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/server/definition/extension/ServerExtensionPointBean.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/JsonTextField.java
  • src/test/java/com/redhat/devtools/lsp4ij/settings/ui/JsonTextFieldTest.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 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.41%. Comparing base (13916a2) to head (4eaf7c4).

Files with missing lines Patch % Lines
...xtension/DebugAdapterServerExtensionPointBean.java 0.00% 3 Missing ⚠️
...definition/extension/ServerExtensionPointBean.java 0.00% 3 Missing ⚠️
...sp4ij/dap/settings/ui/DebugAdapterServerPanel.java 0.00% 1 Missing ⚠️
...hat/devtools/lsp4ij/settings/ui/JsonTextField.java 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2040      +/-   ##
==========================================
- Coverage   49.43%   49.41%   -0.02%     
==========================================
  Files         813      813              
  Lines       33324    33330       +6     
  Branches     6848     6848              
==========================================
- Hits        16473    16470       -3     
- Misses      14278    14285       +7     
- Partials     2573     2575       +2     

☔ 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 4d32448 into redhat-developer:main Nov 21, 2026
9 checks passed
lagergren added a commit that referenced this pull request Nov 26, 2026
…nguage servers of IntelliJ's settings

The plugin verifier reports `PluginDescriptor.getClassLoader()` as deprecated on 2026.1 and later (and experimental on
all the supported versions), from `JetBrainsLanguageServers.getClassLoaderOfPage`, which loads the settings service of
IntelliJ's Language Servers page for the warning of a file that both clients serve (#2077).

It now does as #2040 did in `ServerExtensionPointBean` and `DebugAdapterServerExtensionPointBean`:
`getPluginClassLoader()`, or else the class loader of the descriptor's class, which is what the default
`getClassLoader()` returns on all the supported versions. `getPluginClassLoader()` is public on 2024.2 to 2026.3, and
neither internal, experimental, deprecated nor scheduled for removal on any of them.

`JetBrainsLanguageServersTest.testTheServersAreReadThroughTheSettingsPage` covers it: with no class loader for the page,
it fails.

Part of #1971
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