Repository navigation
chore: fix the trivial javac lint warnings - #1919
Merged
angelozerr merged 5 commits intoNov 10, 2026
Merged
angelozerr merged 5 commits into
angelozerr merged 5 commits into
Conversation
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.
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Contributor
|
Thanks @lagergren ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:Class,CompletableFuture,ColumnInfoandXBreakpointHandler, the rawClass[]ofLSPDocumentSymbolStructureViewModel.getSuitableClasses(), and theList<Key>ofLSPFileSupport, which also made itsgetUserDatacalls unchecked.PathPatternMatcherahashCodeconsistent with itsequals(1 overrides). It overrodeequalsonly.ReadAction.nonBlocking(Runnable)(6) tononBlocking(Callable), which the deprecated method delegates to with aCallablethat returns null;InlayHintsSink.addInlineElementto the overload withplaceAtTheEndOfLine, which it passesfalse;TableUtil.setupCheckboxColumn(TableColumn)tosetupCheckboxColumn(JTable, int), which adds the table's column margin to the checkbox column's width;ToolWindowManager.unregisterToolWindow(String)toToolWindow.remove(), which calls it.Verification
-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.<?>in an array creation; and of the two files that lost a redundant cast. Classes differ only for the changes above.Left alone
Notification.setListener(4, whose replacement is actions instead of links),InlayProviderSettingsModel.getMainCheckBoxLabel()(abstract in 2024.2),InlayHintsProviderFactory.getProvidersInfo(Project),EnterBetweenBracesHandler,InspectionOptionsPanel(), and in testsXCompositeNode.tooManyChildren(int)(abstract in 2024.2),Disposer.isDisposed(3) and the 7-argumentFileEditorManagerEventconstructor.LSPHierarchyNodeDescriptorandNodeDescriptortypes of the hierarchy views, which take a refactor of their own; and the raw types ofDummyCodeVisionProvider, the reflectively obtainedTopicandJBPanel<JBPanel>.lib-client.jar.