我刚刚开始研究
Java项目,并且已经使用IntelliJ从
GitHub下载了源代码 – 我之前从未使用过IntelliJ,但是我被告知它比Eclipse更好用(我正在使用它)当我上次做任何Java开发时 – 大约四年前).
当我尝试在我的计算机上本地构建源代码时,从GitHub中提取了最新的工作版本,我在几个不同的代码行上得到了编译错误 – 错误说:
Error:(27, 34) java: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)
以及出现这些编译错误的行是:
return new ArrayList<>(0);
如果我选择该行,并在错误上执行Alt Enter,则会显示一条消息,指出我可以
“Set language level to 7- Diamonds, ARM, Multi-cache, etc”
但是,如果我选择此选项,则没有任何反应……
在pom.xml文件中,有以下xml:
maven-compiler-plugin
3.5.1
1.8
1.8
UTF-8
org.apache.maven.plugins
maven-source-plugin
${maven-source-plugin.version}
attach-sources
jar
但当我看到这个错误时,我在Diamond type are not supported at this language level处遇到了答案,这表明我应该使用maven1.7或更高版本,而且看起来该项目已经在使用1.8版,所以我不明白为什么我得到这个编译错误……
有人有什么建议吗?