Skip to content

fix: compile against IntelliJ 2025.3 - #1906

Merged
angelozerr merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/compile-against-intellij-2025.3
Nov 9, 2026
Merged

angelozerr merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/compile-against-intellij-2025.3

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #1903.

LSP4IJ didn't compile against IntelliJ 2025.3. Users weren't affected: the plugin is built against 2024.2, and the plugin verification finds it compatible with every IDE from 2024.2 to 2026.3, since the changes below keep the erased signatures. It mattered for building against a newer platform, as when platformVersion moves.

  • WillRenameFilesMoveHandler.retargetUsages and WillRenameFilesRefactoringHelper.prepareOperation. 2025.3 declares List<? extends UsageInfo> and List<? extends PsiElement> where 2024.2 declares List<UsageInfo> and List<PsiElement>. Overriding with either generic type doesn't compile against the other platform ("name clash: … have the same erasure, yet neither overrides the other"), but both erase to List, and a method declared with the erased types overrides both. The two overrides now take raw types, with a comment saying why, and that the generic types can come back once the oldest supported platform is 2025.3. prepareOperation only reads its elements.
  • LSPInlineCompletionProviderContextTest creates an InlineCompletionEvent.LookupChange, whose constructor is (LookupEvent) up to 2025.2 and (Editor, LookupEvent) since 2025.3. The test now calls the one that the platform has.
  • FileOperationRefactoringTest runs its moves under a progress indicator, as the IDE does: since 2025.3, the platform's move of files (MoveFilesOrDirectoriesUtil.moveElements) takes the indicator of the thread, and a test that ran the processor directly failed with a NullPointerException there.

Tested with -PplatformVersion=2024.2 and -PplatformVersion=2025.3: the main code and all tests compile, and FileOperationRefactoringTest, FileRenameUriTest, FileOperationEditSaveTest and the inline completion tests pass on both (16 tests, 3 skipped).

Not changed here: Gradle warns that IntelliJ IDEA Community (platformType=IC) isn't published after 2025.3, so building against a later platform needs a change of the platform type too, and the "Latest IJ" workflow, which builds against the latest platform each night, is disabled.

2025.3 changed two methods that LSP4IJ overrides,
MoveFileHandler.retargetUsages and RefactoringHelper.prepareOperation,
from List<UsageInfo> and List<PsiElement> to List<? extends UsageInfo>
and List<? extends PsiElement>. Both erase to the same List, so the
plugin built against 2024.2 still runs on 2025.3, as the plugin
verification shows, but javac refuses either generic signature against
the other platform. The two overrides now take raw types, which override
both, with a comment saying why and when they can go.

LSPInlineCompletionProviderContextTest creates an
InlineCompletionEvent.LookupChange, whose constructor takes the editor
too since 2025.3; it now calls the one that the platform has.
FileOperationRefactoringTest runs its moves under a progress indicator,
as the IDE does, since the platform's move of files takes the indicator
of the thread since 2025.3.

The main code and the tests compile against 2024.2 and 2025.3, and the
affected tests pass on both.

Fixes redhat-developer#1903.
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Updated automated checks for file moves and inline completion to work across differing platform API versions. Existing assertions for rename requests and refactoring behavior remain unchanged.
  • Refactor
    • Adjusted file-rename handling to accommodate platform API signature differences without changing the existing rename-preparation flow.

The refactoring methods now use raw List parameters. The move-refactoring tests run with an EmptyProgressIndicator, and the inline completion test selects a supported LookupChange constructor through reflection.

Changes: Platform API Compatibility

Layer / File(s) Summary
Refactoring method signatures
src/main/java/com/redhat/devtools/lsp4ij/features/files/WillRenameFilesMoveHandler.java, src/main/java/com/redhat/devtools/lsp4ij/features/files/WillRenameFilesRefactoringHelper.java
Both refactoring methods now accept raw List parameters. prepareOperation assigns the list to a typed local variable before processing it.
Platform-compatible test setup
src/test/java/com/redhat/devtools/lsp4ij/FileOperationRefactoringTest.java, src/test/kotlin/com/redhat/devtools/lsp4ij/features/inlineCompletion/LSPInlineCompletionProviderContextTest.kt
The move tests run the processor with an EmptyProgressIndicator. The inline completion test uses reflection to select a LookupChange constructor accepting either a LookupEvent or an Editor and a LookupEvent.

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

Change: Other · Severity of issue fixed: Medium

Merge Risk: Minimal · up to fd499

The changes address platform compatibility without an established behavioral regression. No merge-blocking issue remains in the supplied evidence.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title "fix: compile against IntelliJ 2025.3" matches the main change. The changeset makes LSP4IJ compile against IntelliJ 2025.3. It adds raw-type overrides in WillRenameFilesMoveHandler and WillR…
Description check Passed The description states the purpose (fixing #1903, compile failure against IntelliJ 2025.3). It explains each changed area: the raw-type overrides, the inline completion constructor choice, and the pro…
Linked Issues check Passed Directly linked issue #1903 requires that ./gradlew test -PplatformVersion=2025.3 compile. The PR addresses the three failures listed in the issue.

1. WillRenameFilesMoveHandler.retargetUsages (#…
Out of Scope Changes check Passed All changed areas connect to #1903 or to its goal of compiling and testing against 2025.3:

- WillRenameFilesMoveHandler.java and WillRenameFilesRefactoringHelper.java: These changes match the two…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title "fix: compile against IntelliJ 2025.3" matches the main change. The changeset makes LSP4IJ compile against IntelliJ 2025.3. It adds raw-type overrides in WillRenameFilesMoveHandler and WillRenameFilesRefactoringHelper, switches LSPInlineCompletionProviderContextTest to the platform's LookupChange constructor, and runs FileOperationRefactoringTest moves under a progress indicator. The title is concise, specific, and follows a conventional-commit style.

Full details: Description check

Explanation

The description states the purpose (fixing #1903, compile failure against IntelliJ 2025.3). It explains each changed area: the raw-type overrides, the inline completion constructor choice, and the progress indicator in the file move test. It also lists the verification steps and the items left unchanged. It relates directly to the changeset.

Full details: Linked Issues check

Explanation

Directly linked issue #1903 requires that ./gradlew test -PplatformVersion=2025.3 compile. The PR addresses the three failures listed in the issue.

  1. WillRenameFilesMoveHandler.retargetUsages (#1903): The diff replaces List&lt;UsageInfo&gt; and Map&lt;PsiElement, PsiElement&gt; with raw List and Map. Under JLS 8.4.2, a method whose signature equals the erasure of another signature is a subsignature of it. The raw override therefore overrides both the 2024.2 and 2025.3 declarations. The @SuppressWarnings("rawtypes") annotation and the comment explain the choice.

  2. WillRenameFilesRefactoringHelper.prepareOperation (#1903): The parameter changes to raw List elements. The body copies it into a local List&lt;PsiElement&gt; and keeps the original behavior: it sends and awaits preparation only when the list is nonempty. The same erasure argument applies.

  3. LSPInlineCompletionProviderContextTest.kt (#1903): The direct InlineCompletionEvent.LookupChange(LookupEvent(...)) call is replaced by a helper. The helper selects whichever constructor exists, (LookupEvent) or (Editor, LookupEvent), through reflection. This compiles on both platforms and matches the issue's suggested direction.

The PR also reports that the main code and tests compile and that selected tests pass on 2024.2 and 2025.3. I did not run the build, so this result rests on the author's report and the code evidence above. The IC platform-type change is not part of the issue's failing list. The PR states that IC is still published for 2025.3, so it is not a blocker for this target.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to #1903 or to its goal of compiling and testing against 2025.3:

  • WillRenameFilesMoveHandler.java and WillRenameFilesRefactoringHelper.java: These changes match the two overrides named in #1903. The diff changes only the parameter types and adds explanatory comments and warning suppressions. The method behavior is unchanged.
  • LSPInlineCompletionProviderContextTest.kt: This change matches the constructor mismatch named in #1903. The new Editor import is used by the helper.
  • FileOperationRefactoringTest.java: The PR description and the raw summary state that the test moves now run under an EmptyProgressIndicator. The PR attributes this change to a NullPointerException in the 2025.3 MoveFilesOrDirectoriesUtil.moveElements path. This is test-only support for running the 2025.3 test suite. It is not a change to production behavior. I did not inspect this file's diff directly, so this verdict relies on the PR description and raw summary for that file.

No production behavior changed outside the two overridden methods. No unrelated files appear in the summary.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files.

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: 4caa09e2-be56-44dc-8bec-00e998229fba
Commits

Reviewing files that changed from the base of the PR and between b2eeaf7 and fd49963.

Files selected for processing: 4

  • src/main/java/com/redhat/devtools/lsp4ij/features/files/WillRenameFilesMoveHandler.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/files/WillRenameFilesRefactoringHelper.java
  • src/test/java/com/redhat/devtools/lsp4ij/FileOperationRefactoringTest.java
  • src/test/kotlin/com/redhat/devtools/lsp4ij/features/inlineCompletion/LSPInlineCompletionProviderContextTest.kt

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

The move helper of FileOperationRefactoringTest now takes the
destination first and the moved elements as varargs, and no longer sits
between the Javadoc of answerWillRenameSlowlyWithAnEditTo and that
method.
@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 47.97%. Comparing base (b2eeaf7) to head (fd49963).

Files with missing lines Patch % Lines
...atures/files/WillRenameFilesRefactoringHelper.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1906   +/-   ##
=======================================
  Coverage   47.97%   47.97%           
=======================================
  Files         808      808           
  Lines       32269    32270    +1     
  Branches     4961     4962    +1     
=======================================
+ Hits        15480    15483    +3     
+ Misses      14299    14294    -5     
- Partials     2490     2493    +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.

@angelozerr

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@angelozerr

Copy link
Copy Markdown
Contributor

LGTM, thanks @lagergren !

@angelozerr
angelozerr merged commit 056c83e into redhat-developer:main Nov 9, 2026
9 checks passed
@lagergren lagergren added this to the 0.30.0 milestone Nov 17, 2026
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.

LSP4IJ doesn't compile against IntelliJ 2025.3

2 participants