简体   繁体   English

IntelliJ IDEa 2018.2使用JDK 11将var lambda参数突出显示为错误

[英]IntelliJ IDEa 2018.2 highlights var lambda parameter as error using JDK 11

Tested on Oracle JDK 11 and latest (as of now) available version of IntelliJ IDEa (IntelliJ IDEA 2018.2.4). 已在Oracle JDK 11和IntelliJ IDEa(IntelliJ IDEA 2018.2.4)的最新版本(到目前为止)上进行了测试。 Project language level is Java 11. 项目语言级别为Java 11。

Code

public static void main(String[] args) {
    System.out.println(List.of("AAA", "BBB", "CCC")
            .stream()
            .map((@NonNull var s) -> s.toLowerCase())
            .collect(Collectors.toList()));
}

Output 产量

[aaa, bbb, ccc]

Everything compiles and runs fine, but editor shows compile-time error: 一切都可以编译并正常运行,但是编辑器显示编译时错误:

在此处输入图片说明

Is JEP-323 (Local-Variable Syntax for Lambda Parameters) not yet supported or it's a bug? JEP-323 (Lambda参数的本地变量语法)是否尚未受支持,或者是一个错误?

If you have this error, you most likely have the Lombok plugin installed. 如果出现此错误,则很可能已安装了Lombok插件。 It is a Lombok plugin inspection bug. 这是Lombok插件检查错误。

Disabling the following inspection will fix the problem: 禁用以下检查将解决此问题:

File | 档案| Settings | 设置| Editor | 编辑器 Probable bugs | 可能的错误| Lombok annotations inspection 龙目岛注释检查

Also inspection can be implicitly suppressed. 另外,检查可以被隐式抑制。 在此处输入图片说明


The issue in Lombok-intellij-plugin project has been created: Lombok-intellij-plugin项目中的问题已创建:

https://github.com/mplushnikov/lombok-intellij-plugin/issues/531 https://github.com/mplushnikov/lombok-intellij-plugin/issues/531

You should turn off the Lombok annotations inspection until they fix the issue. 您应该关闭Lombok批注检查,直到它们解决了问题。

在此处输入图片说明 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM