尽管在所有项目设置中(包括在File -> Project Structure -> Project :: Project SDK)中指定了JDK 1.7,但IntelliJ 13 会产生以下错误code> 尝试编译一些使用菱形运算符的简单 Java 7 代码时:
Despite specifying JDK 1.7 in all project settings (including in File -> Project Structure -> Project :: Project SDK), the following error is produced by IntelliJ 13 when trying to compile some simple Java 7 code which does use the diamond operator:
java: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)配置中是否还有其他地方应该启用预期的 -source 7 选项?
Is there any other place in the configuration where the expected -source 7 option should be enabled?
推荐答案如果这些都没有帮助(我的情况),您可以在 pom.xml 中进行设置,如下所示:
If nothing of this helps (my case), you can set it in your pom.xml, like this:
<properties> <mavenpiler.source>1.7</mavenpiler.source> <mavenpiler.target>1.7</mavenpiler.target> </properties>正如这里提到的这个很酷的人:stackoverflow/a/25888116/1643465
As this cool guy mentioned here: stackoverflow/a/25888116/1643465
更多推荐
尽管设置为 1.7,但 IntelliJ IDEA 13 仍使用 Java 1.5
发布评论