Repository navigation
JAVA-7382 Fix S1128 FPs when --release option shadows non-public members of JDK #6558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
leonardo-pilastri-sonarsource
merged 5 commits into
master
from
lp/fix-S1128-fp-with-release-option
Nov 25, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ee7618c
Fix S1128 FPs when --release option shadows non-public members of JDK
leonardo-pilastri-sonarsource bf8d176
Remove redundant cast
leonardo-pilastri-sonarsource 993a08e
Update ruling expectations
leonardo-pilastri-sonarsource 26f1c1a
Address gitar bot comment: report imports redundant through member scope
leonardo-pilastri-sonarsource c74b54f
Restore guava ruling expectation for ImmutableMultiset and remove red…
leonardo-pilastri-sonarsource File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
...hecks-test-sources/default/src/main/java/checks/UselessImportCheck/HiddenMemberTypes.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package checks.UselessImportCheck; | ||
|
|
||
| import java.util.Comparator; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.List; // Noncompliant {{Remove this unused import 'java.util.List'.}} | ||
| import java.util.Map.Entry; | ||
| import java.util.Properties; | ||
| import java.util.Set; // Noncompliant {{Remove this unused import 'java.util.Set'.}} | ||
| import java.util.TreeMap; | ||
| import java.util.WeakHashMap; | ||
|
|
||
| class HiddenMemberTypes { | ||
|
|
||
| static class Linked<K, V> extends LinkedHashMap<K, V> { | ||
| @Override | ||
| protected boolean removeEldestEntry(Entry<K, V> eldest) { | ||
| return size() > 10; | ||
| } | ||
| } | ||
|
|
||
| static class Sorted extends Properties { | ||
| private static final Comparator<Entry<Object, Object>> BY_KEY = Entry.comparingByKey((a, b) -> a.toString().compareTo(b.toString())); | ||
|
|
||
| Entry<Object, Object> first() { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| static class Tree<K, V> extends TreeMap<K, V> { | ||
| Entry<K, V> any() { | ||
| return firstEntry(); | ||
| } | ||
| } | ||
|
|
||
| static class Weak<K, V> extends WeakHashMap<K, V> { | ||
| Entry<K, V> none() { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| java.util.Set<String> referencedWithItsQualifiedName; | ||
| } |
22 changes: 22 additions & 0 deletions
22
...test-sources/default/src/main/java/checks/UselessImportCheck/RedundantViaMemberScope.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package checks.UselessImportCheck; | ||
|
|
||
| import checks.UselessImportCheck.RedundantViaMemberScope.Nested; // Noncompliant {{Remove this unused import 'checks.UselessImportCheck.RedundantViaMemberScope.Nested'.}} | ||
| import java.util.Map; | ||
| import java.util.Map.Entry; // Noncompliant {{Remove this unused import 'java.util.Map.Entry'.}} | ||
| import java.util.Set; | ||
|
|
||
| abstract class RedundantViaMemberScope<K, V> implements Map<K, V> { | ||
|
|
||
| Entry<K, V> inherited() { | ||
| return null; | ||
| } | ||
|
|
||
| Set<Entry<K, V>> entries() { | ||
| return null; | ||
| } | ||
|
|
||
| Nested nested; | ||
|
|
||
| static class Nested { | ||
| } | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.