What does Eclipse mean when it asks to Replace the type specification in this constructor call with the diamond operator ('<>')
, since the said operator is already there?
Then I put the cursor on what is underlined in blue, and press F2 to learn more, and I get this message (Replace the type specification in this constructor call with the diamond operator ('<>')
):
And if I delete Object
from within <>
, Eclipse still is not happy:
We made sure that
java.util.List
was imported Project -> Clean...
command was appliedThe blue warning still won't go away.
This seems to be a bug in the SonarLint's diamond operator checker, not of Eclipse JDT: see the source code of SonarLint that contains the message.
See also: SonarJava Rule 2293: The diamond operator ("<>") should be used
Solution:
Disable the SonarJava rule 2293 and use the Eclipse warning Generic types > Redundant type argument (1.7 or higher) instead.