Issue
I have a maven project configured to use Java 8 and all works fine, eclipse compiles code like:
Map<String,String> map = new HashMap<>();
It even complains about old-style code ("redundant specification of type arguments") when I set this on the Error/Warnings tab. The problem is, I can't work out how to make it use this syntax by default on autocompletion - I'm pretty sure I saw it working earlier but now whenever I ctrl-space to insert a constructor, it insists on adding the parameters, which I don't like.
Can anybody hint what setting to check to make content assist insert <> instead of < String,String >? Or perhaps it's related to the fact I'm using Java 8 not Java 7, or that I'm on maven?
Solution
I had this issue just a few minutes ago and solved it half way through typing out an SO question.
Eclipse's auto-complete apparently prioritized the old-style generic syntax after I had fiddled with the advanced content assist settings a while ago. Try resetting Java > Editor > Content Assist > Advanced
to defaults; this was what fixed it for me and returned auto-complete to inserting the diamond syntax by default.
Answered By - Marco van Hilst