There is a SonarQube rule named The diamond operator ("<>") should be used
. The codebase I'm working on is pretty old so there are numerous instances like this:
List<String> list = new ArrayList<String>();
SonarQube suggests removal of 'String' on the right-side. So far so good.
The problem is, SonarQube also reports cases where we have something like this:
foobar.setItems(new ArrayList<String>());
How do I tell SonarQube to ignore all such cases (where for example, the new
keyword is preceded by a parenthesis (
?
Or is there a better way to disregard such reports, other than marking everyone of them as false positive
?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…