Skip to content

fix: no IntelliJ API scheduled for removal, and no deprecated getClassLoader(), on any supported IntelliJ - #2277

Merged
lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/no-scheduled-for-removal-api
Nov 26, 2026
Merged

lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/no-scheduled-for-removal-api

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Part of #1971

What

A follow-up to #2276, for the warnings that remain in the plugin verifier's report: the one usage of an API scheduled for removal, and a deprecated API that #2040 had already replaced elsewhere. One commit per API, to be rebase-merged:

Commit API Where Since Replaced with
fix: an installer that strips the root folder deletes what it replaces without IntelliJ API scheduled for removal FileUtil.delete(Path): scheduled for removal and deprecated from 2025.2 DownloadTask.moveContentInto #2057 NioFiles.deleteRecursively(Path)
chore: no deprecated PluginDescriptor.getClassLoader() to read the language servers of IntelliJ's settings PluginDescriptor.getClassLoader(): deprecated from 2026.1, experimental on all JetBrainsLanguageServers.getClassLoaderOfPage #2077 getPluginClassLoader(), or else the descriptor's class loader, as #2040 did

I checked both replacements with javap on the jars of the 8 IDEs that main's CI verifies (2024.2 to 2026.3 EAP). Both are public on all 8, and none of them marks either one internal, experimental, deprecated or scheduled for removal.

  • NioFiles.deleteRecursively(Path) has the same body as FileUtil.delete(Path) on all 8: FileUtilRt.deleteRecursively(path, null). So the deletion stays the same: recursive, and a no-op for a path that doesn't exist.
  • getPluginClassLoader() is abstract in PluginDescriptor on all 8. requireNonNullElse(getPluginClassLoader(), getClass().getClassLoader()) is exactly what the default getClassLoader() returns. The comment and the pattern are those of ServerExtensionPointBean and DebugAdapterServerExtensionPointBean.

Not changed: the InlayProviderSettingsModel.getMainCheckBoxLabel() override in LSPInlayHintsSettingsProvider (#1800). It is abstract on all 8 IDEs, so the override must stay. It's deprecated on all 8 with the message "Not used in new UI", with no replacement and level WARNING. Nothing in LSP4IJ reads it. The verifier will keep reporting "Deprecated method ... is overridden" until the platform makes it non-abstract or drops it.

Plugin verifier

./gradlew verifyPlugin over the 8 IDEs that main's CI verifies, locally. These are the counts of the summary line, as in the CI log, written scheduled-for-removal / deprecated / experimental / internal. "Before" is main 01b5528; CI run 45794351150 gives the same counts.

IDE Before: main After: main + this PR main + #2276 + this PR
IU 2024.2 (242.26775.15) 0 / 9 / 243 / 2 0 / 9 / 242 / 2 0 / 10 / 238 / 0
IU 2024.3 (243.28141.41) 0 / 14 / 243 / 4 0 / 14 / 242 / 4 0 / 14 / 238 / 0
IU 2025.1 (251.29188.72) 0 / 16 / 235 / 4 0 / 16 / 234 / 4 0 / 16 / 230 / 0
IU 2025.2 (252.28539.166) 1 / 18 / 231 / 4 0 / 18 / 230 / 4 0 / 18 / 230 / 0
IU 2025.3 (253.33813.120) 1 / 21 / 231 / 4 0 / 21 / 230 / 4 0 / 23 / 230 / 0
IU 2026.1 (261.27258.169) 1 / 25 / 219 / 4 0 / 24 / 218 / 4 0 / 26 / 218 / 0
IU 2026.2 (262.12573.58) 1 / 27 / 211 / 4 0 / 26 / 210 / 4 0 / 28 / 210 / 0
IU 2026.3 EAP (263.8311.30) 1 / 30 / 211 / 6 0 / 29 / 210 / 6 0 / 31 / 210 / 0

Tests

  • New test: DownloadTaskArchiveRootTest.testStripRootFolderReplacesTheFileAndTheFolderOfAnEarlierInstall. stripRootFolder replaces the server file and a lib/ folder that an earlier install left. The folder's stale file and nested folder are deleted, not merged with the new folder.
  • Red-green (IC 2024.2, headless), with one mutation for each fix:
    • Without the deletion in moveContentInto, the new test fails: the install fails, as the move finds the server file in place.
    • With no class loader for the settings page, JetBrainsLanguageServersTest.testTheServersAreReadThroughTheSettingsPage fails: it reads no servers.
    • With the change, both pass.
  • Headless, read from the JUnit XMLs: installation.*, JetBrainsLanguageServersTest, JetBrainsLanguageServerEditorNotificationProviderTest and features.inlayhint.*. No test covers LSPInlayHintsSettingsProvider, which is unchanged.
Platform Classes Tests Failures Errors Skipped
IC 2024.2 26 279 0 0 0
IC 2025.3 26 279 0 0 0
IU 2026.3 26 279 0 0 0

Behaviour change

None: the deletion and the class loader are the same as before.

…s without IntelliJ API scheduled for removal

The plugin verifier reports `FileUtil.delete(Path)` as an API scheduled for removal, and deprecated, on 2025.2 and
later, from `DownloadTask.moveContentInto`, which `stripRootFolder` uses to replace the files and folders of an earlier
install (redhat-developer#2057).

`moveContentInto` now deletes them with `NioFiles.deleteRecursively(Path)`. It's public on all the supported versions,
2024.2 to 2026.3, and neither internal, experimental, deprecated nor scheduled for removal on any of them. On all of
them, `FileUtil.delete(Path)` and `NioFiles.deleteRecursively(Path)` have the same body,
`FileUtilRt.deleteRecursively(path, null)`: the deletion is the same, recursive, and does nothing for a path that
doesn't exist.

`DownloadTaskArchiveRootTest` gets a test that `stripRootFolder` replaces the server file and a folder of an earlier
install, the folder's files and folders included, instead of merging the new folder into the old one. Without the
deletion, the install fails, as the move finds the file in place.

Part of redhat-developer#1971
…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 (redhat-developer#2077).

It now does as redhat-developer#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 redhat-developer#1971
@lagergren lagergren added this to the 0.30.2 milestone Nov 26, 2026
@lagergren lagergren added the bug Something isn't working label Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Reinstalling a language server now replaces files from the previous installation, preventing outdated files from remaining alongside the new version.
    • Language server pages can now use a fallback loading mechanism when the preferred plugin loader is unavailable.

The changes update cleanup during archive installation and add a fallback class loader for page lookup. A regression test checks replacement of files and directories from an earlier installation.

Changes: Archive installation

Layer / File(s) Summary
Replace existing archive destinations
src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/DownloadTask.java, src/test/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/DownloadTaskArchiveRootTest.java
moveContentInto recursively deletes an existing destination before moving extracted content. A regression test checks that old library files and a nested directory are removed.

Page class-loader lookup

Layer / File(s) Summary
Add descriptor class-loader fallback
src/main/java/com/redhat/devtools/lsp4ij/ui/JetBrainsLanguageServers.java
getClassLoaderOfPage returns the plugin class loader when available. If it is null, the method returns the plugin descriptor class loader.

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

Change: Refactor

Merge Risk: Minimal · up to 54317

This change replaces two deprecated or scheduled-for-removal IntelliJ APIs with their supported equivalents. It keeps the existing behavior, and a new test covers replacing an earlier install. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: removal of an API scheduled for removal, and removal of a deprecated getClassLoader() call. The changeset matches both: DownloadTask replaces FileUtil.delete(Path…
Description check Passed The description matches the changeset. It covers the two API replacements in DownloadTask and JetBrainsLanguageServers, the verifier results, the new DownloadTaskArchiveRootTest test, and the red-gree…
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 two main changes: removal of an API scheduled for removal, and removal of a deprecated getClassLoader() call. The changeset matches both: DownloadTask replaces FileUtil.delete(Path) with NioFiles.deleteRecursively(Path), and JetBrainsLanguageServers replaces PluginDescriptor.getClassLoader() with getPluginClassLoader() plus a fallback. The title is long (105 characters) and uses the 'fix:' prefix for a change that also includes a chore, but it still reflects the primary change.

Full details: Description check

Explanation

The description matches the changeset. It covers the two API replacements in DownloadTask and JetBrainsLanguageServers, the verifier results, the new DownloadTaskArchiveRootTest test, and the red-green checks. It also lists the InlayProviderSettingsModel override that stays unchanged.

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: 764371a9-fb9a-4a88-afa6-957b3e10ec12
Commits

Reviewing files that changed from the base of the PR and between 079e459 and 543171b.

Files selected for processing: 3

  • src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/DownloadTask.java
  • src/main/java/com/redhat/devtools/lsp4ij/ui/JetBrainsLanguageServers.java
  • src/test/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/DownloadTaskArchiveRootTest.java

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

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.06%. Comparing base (079e459) to head (543171b).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2277      +/-   ##
==========================================
+ Coverage   58.05%   58.06%   +0.01%     
==========================================
  Files         848      848              
  Lines       36436    36438       +2     
  Branches     5717     5717              
==========================================
+ Hits        21152    21159       +7     
+ Misses      12295    12288       -7     
- Partials     2989     2991       +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

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 26, 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.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant