Skip to content

chore: fix the trivial javac lint warnings - #1919

Merged
angelozerr merged 5 commits into
redhat-developer:mainfrom
lagergren:chore/fix-trivial-javac-warnings
Nov 10, 2026
Merged

angelozerr merged 5 commits into
redhat-developer:mainfrom
lagergren:chore/fix-trivial-javac-warnings

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

javac reports 508 warnings for the plugin and its tests with -Xlint:all. A normal build shows two of the categories only, as the notes "Some input files use or override a deprecated API" and "Some input files use unchecked or unsafe operations". This fixes the 114 warnings that have trivial fixes and leaves the ones that need real work alone. One commit per kind:

  • Give raw generic types their type arguments (55 rawtypes, 2 unchecked): the raw array creations of Class, CompletableFuture, ColumnInfo and XBreakpointHandler, the raw Class[] of LSPDocumentSymbolStructureViewModel.getSuitableClasses(), and the List<Key> of LSPFileSupport, which also made its getUserData calls unchecked.
  • Remove redundant casts and call a static method through its type (2 cast, 1 static).
  • Give PathPatternMatcher a hashCode consistent with its equals (1 overrides). It overrode equals only.
  • Move off deprecated APIs whose replacements exist in 2024.2 (9 deprecation):
    • ReadAction.nonBlocking(Runnable) (6) to nonBlocking(Callable), which the deprecated method delegates to with a Callable that returns null;
    • the 3-argument InlayHintsSink.addInlineElement to the overload with placeAtTheEndOfLine, which it passes false;
    • TableUtil.setupCheckboxColumn(TableColumn) to setupCheckboxColumn(JTable, int), which adds the table's column margin to the checkbox column's width;
    • in a test, ToolWindowManager.unregisterToolWindow(String) to ToolWindow.remove(), which calls it.
  • Remove the whitespace that javac strips from text blocks (44 text-blocks, tests only): blank lines indented with spaces, spaces after content or after the opening delimiter, and closing delimiters indented deeper than the content.

Verification

  • With -Xlint:all, the warnings go from 508 to 394: rawtypes 91 → 37, text-blocks 44 → 0, deprecation 22 → 13, unchecked 9 → 7, and cast, static and overrides 4 → 0.
  • Compared with main's classes, 1639 class files are byte-identical. These include every class of the nine tests whose text blocks changed, so no text block's value changed; of each file that only gained <?> in an array creation; and of the two files that lost a redundant cast. Classes differ only for the changes above.
  • The full test suite passes locally: 1573 tests, 0 failures.

Left alone

  • Deprecated APIs that 2024.2 still requires, or that have no drop-in replacement: Notification.setListener (4, whose replacement is actions instead of links), InlayProviderSettingsModel.getMainCheckBoxLabel() (abstract in 2024.2), InlayHintsProviderFactory.getProvidersInfo(Project), EnterBetweenBracesHandler, InspectionOptionsPanel(), and in tests XCompositeNode.tooManyChildren(int) (abstract in 2024.2), Disposer.isDisposed (3) and the 7-argument FileEditorManagerEvent constructor.
  • Unchecked casts that the APIs require (5); the raw LSPHierarchyNodeDescriptor and NodeDescriptor types of the hierarchy views, which take a refactor of their own; and the raw types of DummyCodeVisionProvider, the reflectively obtained Topic and JBPanel<JBPanel>.
  • serial (185), this-escape (135) and try (8), and 9 warnings about Guava classes in IntelliJ's own lib-client.jar.

javac -Xlint:rawtypes reported raw array creations of Class,
CompletableFuture, ColumnInfo and XBreakpointHandler, the raw Class[]
of LSPDocumentSymbolStructureViewModel.getSuitableClasses() and the
List<Key> of LSPFileSupport, which also made its getUserData calls
unchecked. They now take <?> type arguments.
javac -Xlint reported the casts of CancellationSupport.awaitWithCheckCanceled
and LSPCodeInsightTestFixtureImpl.selectItem as redundant, and the call of the
static MockLanguageServer.defaultServerCapabilities() through INSTANCE.
PathPatternMatcher overrode equals but not hashCode, so two equal
matchers could have different hash codes. Matchers that are equal have
equal patterns, so the hash code of the pattern is consistent with it.
- ReadAction.nonBlocking(Runnable) to nonBlocking(Callable), which the
  deprecated method delegates to with a Callable that returns null.
- InlayHintsSink.addInlineElement(int, boolean, InlayPresentation) to
  the overload with placeAtTheEndOfLine, which it passes false.
- TableUtil.setupCheckboxColumn(TableColumn) to
  setupCheckboxColumn(JTable, int), which adds the table's column
  margin to the checkbox column's width.
- In a test, ToolWindowManager.unregisterToolWindow(String) to
  ToolWindow.remove(), which unregisters the tool window by its id.
javac -Xlint:text-blocks warned "trailing white space will be removed"
for 44 text blocks: blank lines indented with spaces, spaces after
content or after the opening delimiter, and closing delimiters indented
deeper than the content. Each closing delimiter now has the content's
indentation, which keeps the block's incidental indentation. The test
classes compile to the same bytes as before.
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved consistency when matching file-path patterns.
  • Refactor

    • Strengthened type safety across language-server, debugging, and editor features.
  • Tests

    • Updated test fixtures and cleanup checks; test scenarios and expected results remain unchanged.

The changes update read-action return values and Java generic types, add PathPatternMatcher.hashCode(), and adjust an inline-element call. Tests update proxy types, teardown behavior, and whitespace in fixtures.

Changes: Java API and test maintenance

Layer / File(s) Summary
Read-action result handling
src/main/java/com/redhat/devtools/lsp4ij/ConnectDocumentToLanguageServerSetupParticipant.java, LanguageServerWrapper.java, LanguageServiceAccessor.java, internal/ApplicationUtils.java, internal/CancellationSupport.java
Read-action computations and a Runnable wrapper now return null on completion and early-exit paths. CancellationSupport removes an unchecked cast.
Language server types and API calls
src/main/java/com/redhat/devtools/lsp4ij/LSPFileSupport.java, features/*
Feature code uses parameterized future and class arrays. PathPatternMatcher adds hashCode(), and the color provider passes an additional argument to addInlineElement.
DAP and table types
src/main/java/com/redhat/devtools/lsp4ij/dap/*, settings/ui/AbstractServerMappingTablePanel.java, src/test/java/com/redhat/devtools/lsp4ij/dap/*, src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerProcessNodesTest.java
DAP and table code uses parameterized arrays. DAP tests use parameterized proxy interface arrays. Teardown removes the tool window only when it exists.
Test fixture updates
src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_GoTest.java, features/completion/GoCompletionTest.java, features/documentation/*, features/formatting/*, features/rename/*, fixtures/*
Tests remove whitespace from text fixtures. Fixture setup calls MockLanguageServer.defaultServerCapabilities() directly, and completion selection no longer casts the lookup result.

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

Change: Other

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 77181

No actionable issue remains that would prevent merging after normal checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: fixing straightforward javac lint warnings.
Description check Passed The description explains the warning categories addressed, the changes made, verification results, and warnings left unchanged.
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: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. 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 10 functions across 50 files. (8 skipped: 8 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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: 9347dafd-cf1f-413d-88b8-92b1ec967f84
Commits

Reviewing files that changed from the base of the PR and between 42b4e25 and 77181b0.

Files selected for processing: 58

  • src/main/java/com/redhat/devtools/lsp4ij/ConnectDocumentToLanguageServerSetupParticipant.java
  • src/main/java/com/redhat/devtools/lsp4ij/LSPFileSupport.java
  • src/main/java/com/redhat/devtools/lsp4ij/LanguageServerWrapper.java
  • src/main/java/com/redhat/devtools/lsp4ij/LanguageServiceAccessor.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/DAPDebugProcess.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/breakpoints/BreakpointHandlerBase.java
  • src/main/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPExceptionBreakpointsPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/codeLens/LSPCodeLensProvider.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/color/LSPColorProvider.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/documentSymbol/LSPDocumentSymbolStructureViewModel.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/documentation/LSPHoverSupport.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/files/PathPatternMatcher.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/formatting/LSPOnTypeFormattingSupport.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/highlight/LSPHighlightSupport.java
  • src/main/java/com/redhat/devtools/lsp4ij/features/inlayhint/LSPInlayHintsSupport.java
  • src/main/java/com/redhat/devtools/lsp4ij/internal/ApplicationUtils.java
  • src/main/java/com/redhat/devtools/lsp4ij/internal/CancellationSupport.java
  • src/main/java/com/redhat/devtools/lsp4ij/internal/CompletableFutures.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/AbstractServerMappingTablePanel.java
  • src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_GoTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerProcessNodesTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPBreakpointHandlerBaseTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPBreakpointHitConditionTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPBreakpointTooltipRefreshTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPDataBreakpointHandlerTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPDataBreakpointPropertiesTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPExceptionFilterConditionsTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPFunctionBreakpointHandlerTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPLogpointTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPMovedFileBreakpointTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPShadowedBreakpointTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/DAPUnsupportedBreakpointMessageTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/breakpoints/RunToCursorBreakpointTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientBreakpointReachedTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientBreakpointStopTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientConsoleLineTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientDataBreakpointTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientExceptionHintTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientExceptionStopTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientFunctionBreakpointTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientInvalidatedTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientLoadedSourcesTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientPauseTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientSingleThreadStepTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPDropFrameHandlerTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/variables/DAPLazyValueEvaluatorTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/variables/DAPVariableChildrenTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/variables/providers/InlineValueRefreshTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/completion/GoCompletionTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/documentation/MarkdownConverterTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/documentation/MarkdownConverterWithPsiFileTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/documentation/TypeScriptHoverTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/formatting/ClojureFormattingTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/formatting/TypeScriptFormattingTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/rename/GoRenameTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/rename/RustRenameTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/fixtures/LSPSemanticTokensFixtureTestCase.java
  • src/test/java/com/redhat/devtools/lsp4ij/fixtures/impl/LSPCodeInsightTestFixtureImpl.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 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.12%. Comparing base (cdcfe6e) to head (77181b0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...nnectDocumentToLanguageServerSetupParticipant.java 66.66% 2 Missing ⚠️
.../lsp4ij/features/codeLens/LSPCodeLensProvider.java 0.00% 1 Missing ⚠️
...vtools/lsp4ij/features/color/LSPColorProvider.java 0.00% 1 Missing ⚠️
...entSymbol/LSPDocumentSymbolStructureViewModel.java 0.00% 1 Missing ⚠️
...ools/lsp4ij/features/files/PathPatternMatcher.java 0.00% 1 Missing ⚠️
...lsp4ij/features/highlight/LSPHighlightSupport.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1919      +/-   ##
==========================================
+ Coverage   48.09%   48.12%   +0.02%     
==========================================
  Files         808      808              
  Lines       32356    32354       -2     
  Branches     6577     4976    -1601     
==========================================
+ Hits        15561    15569       +8     
+ Misses      14304    14298       -6     
+ Partials     2491     2487       -4     

☔ 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 angelozerr added this to the 0.30.0 milestone Nov 10, 2026
@angelozerr angelozerr added debt and removed build labels Nov 10, 2026
@angelozerr angelozerr moved this to In Progress in Java Tooling Nov 10, 2026
@angelozerr
angelozerr merged commit 3225b06 into redhat-developer:main Nov 10, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Java Tooling Nov 10, 2026
@angelozerr

Copy link
Copy Markdown
Contributor

Thanks @lagergren !

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

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants