Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使 checkstyle 需要菱形运算符的 java 7 格式?我想确保我的代码库始终使用新的 Java 7 样式,即:
List<String> items = new LinkedList<>();
而不是旧的:
List<String> items = new LinkedList<String>();
看看这个。
其中一位用户抱怨菱形运算符语法中的错误:
List list = new ArrayList<>(); throws an error:unexpected token: >
由于添加了对 Java 7的支持的补丁,此错误报告已关闭。
根据该页面,添加的功能之一是:
4) Diamond Generics: In presence of a diamond, the AST looks like: +--TYPE_ARGUMENTS | +--GENERIC_START +--GENERIC_END
补丁下载链接。