Skip to content

chore: replace three more deprecated APIs of #1971 - #2088

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

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

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Part of #1971.

  • new URL(String) in JarUriConverter becomes new URI(uri).toURL().
    • URI rejects characters that new URL accepted, such as spaces, so a URI that URI rejects is percent-encoded first: the characters that no part of a URI allows, a % that starts no escape, a # after the first, and [ and ] in a jrt: URI.
    • As new URL did, it drops whitespace at the ends and, on Windows, reads the backslashes of a jar: URI as slashes.
    • VfsUtil.findFileByURL decodes the escapes again, so the URI finds the same file. A URI that URI accepts is used as it is.
    • Left different, as they come from URI.toURL() itself or from odd input: a jrt: URI with several ? is cut at the last one instead of the first, and whitespace just before ? or # is encoded.
  • ExtensionPoint.addExtensionPointListener(listener, false, this) in LanguageServersRegistry and ServerInstallerManager becomes ExtensionPointName.addExtensionPointListener(scope, listener).
    • That overload exists in 2024.2, isn't deprecated up to 2026.3, and doesn't call the listener for extensions already loaded either.
    • The scope belongs to the service, and dispose() cancels it, so the listeners still end when the service is disposed.
    • Not the CoroutineScope that a service can get in its constructor: it would end earlier. When LSP4IJ is unloaded, the platform cancels its plugin scope before it removes the extensions of the plugins unloaded with it, so the registry wouldn't hear that their servers go.
    • Not ExtensionPointName.addExtensionPointListener(listener, Disposable), which is deprecated in 2026.3.
  • InspectionOptionsPanel() in AbstractDelegateInspectionWithExclusions: createOptionsPanel() becomes getOptionsPane(), with OptPane.stringList("excludeList", label).
    • The panel edits excludeList in place with the same ListEditForm as before.
    • excludeList keeps its name and type, and is saved as before, as saving doesn't use the options pane.
    • Quarkus Tools and Liberty Tools, which extend the class, pass a label to its constructor, add default exclusions to excludeList, and read and add to it. Neither overrides or calls createOptionsPanel(), which the subclasses now inherit from InspectionProfileEntry, as other inspections with an options pane do.

Test

  • JarUriConverterTest (new): it finds a jar entry under a folder with a space, {, }, ^, `, %, [ and ] in its name, from an unencoded and from an encoded URI, as new URL did. For 13 URIs, it checks that the VFS URL is the one new URL gave.
  • AbstractDelegateInspectionWithExclusionsTest (new): the exclusions are written and read as the XML of before (these expectations also pass on the code before this change), the options pane binds excludeList, and its panel renders.
  • ExtensionPointListenerLifetimeTest (new): the registry and the installer manager hear of extensions that are added and removed until they are disposed, and no longer after. Without the cancel in dispose(), both fail.
  • Results: these and the tests of the URI, extension and installer classes pass on 2024.2 and on IU 2026.3 (88 tests each). The change compiles against 2024.2, 2025.3 and 2026.3.

- JarUriConverter: new URL(uri) becomes new URI(uri).toURL(). A URI
  that URI rejects and new URL accepted, such as one with spaces, is
  percent-encoded first, and VfsUtil.findFileByURL decodes it again, so
  it finds the same file.
- LanguageServersRegistry and ServerInstallerManager: the deprecated
  ExtensionPoint.addExtensionPointListener(listener, false, this)
  becomes ExtensionPointName.addExtensionPointListener(scope, listener),
  with a scope that dispose() cancels, so that the listeners still end
  with the service.
- AbstractDelegateInspectionWithExclusions: createOptionsPanel(), with
  InspectionOptionsPanel, becomes getOptionsPane(), with an
  OptPane.stringList bound to excludeList, whose name, type and saved
  XML stay the same.
@lagergren lagergren added this to the 0.30.2 milestone Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved resolution of JAR and runtime image resources when paths contain spaces, special characters, fragments, or other characters that are not accepted in standard URI syntax.
  • Improvements
    • Inspection exclusions remain available in the inspection options and continue to be saved and restored.
    • Extension registrations are no longer observed after the associated service is disposed, helping prevent stale registrations from affecting the application.

The changes update extension-point listener lifetimes, replace a Swing inspection options panel with an options pane, and add URI parsing and encoding for JAR and JRT resource lookup.

Changes: Extension-point listener lifetimes

Layer / File(s) Summary
Scope listeners and verify disposal
src/main/java/com/redhat/devtools/lsp4ij/LanguageServersRegistry.java, src/main/java/com/redhat/devtools/lsp4ij/installation/definition/ServerInstallerManager.java, src/test/java/com/redhat/devtools/lsp4ij/ExtensionPointListenerLifetimeTest.java
Both services register extension-point listeners with coroutine scopes and cancel those scopes in dispose(). Tests check that disposing a registration or service stops it from observing extensions.

Inspection exclusion options

Layer / File(s) Summary
Define and test exclusion options
src/main/java/com/redhat/devtools/lsp4ij/inspections/AbstractDelegateInspectionWithExclusions.java, src/test/java/com/redhat/devtools/lsp4ij/inspections/AbstractDelegateInspectionWithExclusionsTest.java
The inspection replaces its Swing options panel with an OptStringList option for excludeList. Tests cover editing the list, creating the options panel, and reading and writing exclusions.

JAR and JRT URI conversion

Layer / File(s) Summary
Parse, encode, and test URI conversion
src/main/java/com/redhat/devtools/lsp4ij/internal/uri/JarUriConverter.java, src/test/java/com/redhat/devtools/lsp4ij/internal/uri/JarUriConverterTest.java
findResourceFor uses toURL and returns null for URI syntax and URL conversion failures. toURL retries URI parsing after encoding disallowed characters. Tests cover JAR entries, unusual characters, JRT paths, and inputs without entries.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Suggested reviewers: angelozerr, commandertvis

Merge Risk: Minimal · up to 71d31

This change replaces three deprecated APIs while keeping the same behavior, with new tests covering each replacement. No concrete defect was identified in the supplied changes. The remaining uncertainty is whether the platform releases listeners immediately when a service is disposed, and that is not established as a problem.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "chore: replace three more deprecated APIs of #1971" matches the changeset. The PR replaces deprecated extension-point listener registration in LanguageServersRegistry and ServerInstallerMan…
Description check Passed The description relates directly to the changeset. It explains the three API replacements (new URL to new URI(...).toURL() in JarUriConverter, the extension-point listener overload in LanguageServersR…
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 "chore: replace three more deprecated APIs of #1971" matches the changeset. The PR replaces deprecated extension-point listener registration in LanguageServersRegistry and ServerInstallerManager, replaces new URL(String) with URI-based conversion in JarUriConverter, and replaces createOptionsPanel() with getOptionsPane() in AbstractDelegateInspectionWithExclusions. It is a concise, single-sentence summary of the main change.

Full details: Description check

Explanation

The description relates directly to the changeset. It explains the three API replacements (new URL to new URI(...).toURL() in JarUriConverter, the extension-point listener overload in LanguageServersRegistry and ServerInstallerManager, and createOptionsPanel() to getOptionsPane() in AbstractDelegateInspectionWithExclusions). It also lists the new tests and the 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: b65667f0-e243-49c5-b2df-3940a0a3dd7f
Commits

Reviewing files that changed from the base of the PR and between 9b3dd91 and 71d31a9.

Files selected for processing: 7

  • src/main/java/com/redhat/devtools/lsp4ij/LanguageServersRegistry.java
  • src/main/java/com/redhat/devtools/lsp4ij/inspections/AbstractDelegateInspectionWithExclusions.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/definition/ServerInstallerManager.java
  • src/main/java/com/redhat/devtools/lsp4ij/internal/uri/JarUriConverter.java
  • src/test/java/com/redhat/devtools/lsp4ij/ExtensionPointListenerLifetimeTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/inspections/AbstractDelegateInspectionWithExclusionsTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/internal/uri/JarUriConverterTest.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 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.43%. Comparing base (8b83e2d) to head (71d31a9).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
.../devtools/lsp4ij/internal/uri/JarUriConverter.java 81.25% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2088      +/-   ##
==========================================
+ Coverage   50.24%   50.43%   +0.18%     
==========================================
  Files         816      816              
  Lines       33699    33816     +117     
  Branches     5261     6974    +1713     
==========================================
+ Hits        16931    17054     +123     
+ Misses      14127    14114      -13     
- Partials     2641     2648       +7     

☔ 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 added the debt label Nov 22, 2026
@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit 35eb012 into redhat-developer:main Nov 22, 2026
9 checks passed
lagergren added a commit that referenced this pull request Nov 26, 2026
…P4IJ

The plugin verifier reported `ExtensionPointName.addExtensionPointListener(CoroutineScope, ExtensionPointListener)` as
an internal API usage on 2024.3 to 2026.2, from `LanguageServersRegistry.registerEpListener` and the constructor of
`ServerInstallerManager` (35eb012, #2088).

No overload is public and not deprecated on all the supported versions, 2024.2 to 2026.3:

| Overload | Internal | Deprecated | Missing |
|---|---|---|---|
| `ExtensionPointName.addExtensionPointListener(CoroutineScope, listener)`, of #2088 | 2024.3 to 2026.2 | | |
| `ExtensionPointName.addExtensionPointListener(listener, Disposable)` | | 2025.3 to 2026.3 | |
| `ExtensionPoint.addExtensionPointListener(listener, boolean, Disposable)`, of before #2088 | | 2025.2 to 2026.3 | |
| `ExtensionPoint.addExtensionPointListener(CoroutineScope, boolean, listener)` | | | 2024.2 to 2025.1 |

So both use `ExtensionPointName.addExtensionPointListener(listener, Disposable)`, which is never internal, and
deprecated on the fewest versions. A deprecation is a warning, and an internal usage blocks the Marketplace. #2088 said
that it's deprecated only in 2026.3; it is from 2025.3.

The behaviour is the one of #2088:
- The parent of the listeners is a Disposable of the service, which `dispose()` disposes, as it cancelled their scope
  before: they end when the service is disposed.
- The overload calls the listener only for the extensions added later, not those already loaded
  (`invokeForLoadedExtensions` is false on every version).

`ExtensionPointListenerLifetimeTest` checks both services. Without the disposal in `dispose()`, both of its tests fail.

Part of #2274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant