-
Notifications
You must be signed in to change notification settings - Fork 719
SONARJAVA-5936 : S1452 Remove FPs for wildcards in nested types #5391
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
base: master
Are you sure you want to change the base?
SONARJAVA-5936 : S1452 Remove FPs for wildcards in nested types #5391
Conversation
BartLucien
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have a small comment concerning the tests.
While it may create some false negatives, as having wildcard in nested types won't be detected. I think it is better than having a issue raised that breaks the compilation if it is fixed. What do you think?
I do not approve as I think there should be a more authoritative answer to your concern.
...hecks-test-sources/default/src/main/java/checks/WildCardReturnParameterNestedTypeSample.java
Show resolved
Hide resolved
08adf1a to
c96bddd
Compare
|
...checks-test-sources/default/src/main/java/checks/WildCardReturnParameterNestedTypeCheck.java
Outdated
Show resolved
Hide resolved
...checks-test-sources/default/src/main/java/checks/WildCardReturnParameterNestedTypeCheck.java
Outdated
Show resolved
Hide resolved
72695bf to
a896a4b
Compare
25d2bc4 to
0434398
Compare
|





This PR aims to remove False Positives (FPs) in code examples involving nested generics, such as:
The Proposed Solution:
The fix stops checking wildcards after depth 1 nested types (i.e., removing the recursive check).
Reviewer Note:
Please pay attention to this change in behavior; while it resolves the FPs, it means the rule will no longer flag potential issues in deeper nested structures. I would like your feedback on whether this trade-off makes sense or if we should consider a more surgical approach to the recursion.