热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

IntelliJ不会在List/Map的末尾接受Java8和钻石-IntelliJwon'tacceptJava8anddiamondsattheendofList/Map

ImusingthelatestJDKandeverywherefromprojectcreationtonoweverythingissettoJava8orS

I'm using the latest JDK and everywhere from project creation to now everything is set to Java8 or SDK 8.

我正在使用最新的JDK,从项目创建到现在,一切都设置为Java8或SDK 8。

Still, intelliJ gives me this issue:

仍然,intelliJ给了我这个问题:

enter image description here

The red lamp tells me to change to Java7.

红灯告诉我改为Java7。

This is my project settings: enter image description here

这是我的项目设置:

and this is the Modules section: enter image description here

这是模块部分:

As you can see; I specifically changed it from the SDK default to java 8 when I got the error, but no result.

如你看到的;当我收到错误时,我专门将它从SDK默认更改为java 8,但没有结果。

The compiler settings look like this: enter image description here

编译器设置如下所示:

I'm on a macbook and the intelliJ is the community version. Does anyone know why this is happening and how I fix it?

我在macbook上,而intelliJ是社区版。有谁知道为什么会这样,以及我如何解决它?

2 个解决方案

#1


Try to run the project, if this is your error message: enter image description here

尝试运行该项目,如果这是您的错误消息:

Then I suggest you have a little look into your pom-file.

然后我建议你稍微查看你的pom文件。

This project was built using the intelliJ maven project setting, and it was missing this lovely line of code:

这个项目是使用intelliJ maven项目设置构建的,它缺少这段可爱的代码:


    
        
            org.apache.maven.plugins
            maven-compiler-plugin
            
                1.8
                1.8
            
        
    

IntelliJ doesn't (at least in my case) generate the version in the pom (despite that I picked all the settings for it).

IntelliJ没有(至少在我的情况下)在pom中生成版本(尽管我选择了它的所有设置)。

#2


I tried specifying the compiler version in the plugin too, to no avail. Have you tried invalidating the cache? It's File -> Invalidate Caches/Restart.... I would probably restart as well for good measure.

我也尝试在插件中指定编译器版本,但无济于事。您是否尝试过无效缓存?这是文件 - >无效缓存/重新启动....我可能会重新启动以获得良好的衡量标准。


推荐阅读
author-avatar
IKUN
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有