Skip to content
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

Fix sonar issue S2293 The diamond operator ('<>') should be used #804

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

jlerbsc
Copy link

@jlerbsc jlerbsc commented Mar 13, 2024

https://rules.sonarsource.com/java/RSPEC-2293/

"Prior to Java 7, the type argument had to be provided explicitly for every occurrence where generics were used. This often caused redundancy, as the type argument would have to be provided both when a field is declared and initialized.

Java 7 introduced the diamond operator (<>) to reduce the code’s verbosity in some situations. The type argument between the angular brackets should be omitted if the compiler can infer it."

This code fix was made automatically by our Indepth solution. You can use it free of charge to correct other sonar issues.

https://www.indepth.fr

@jlerbsc
Copy link
Author

jlerbsc commented Mar 21, 2024

We have also noticed that Indepth can also quickly correct the 105 violations of the rule "Collection.isEmpty() should be used to test for emptiness" as well as a large number of violations of the rule "'throws' declarations should not be superfluous". Now it's your turn.

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.

1 participant