eclipse not inserting “diamond” operator in a java 8 project

后端 未结 6 650
轮回少年
轮回少年 2021-01-03 21:26

I have a maven project configured to use Java 8 and all works fine, eclipse compiles code like:

Map map = new HashMap<>();
         


        
6条回答
  •  半阙折子戏
    2021-01-03 22:06

    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.

提交回复
热议问题