IntelliJ更新 - >由lambda获取错误 [英] IntelliJ Update -> get Error by lambda
问题描述
我今天早上更新了我的IntelliJ IDEA,之后我打开了我的项目,突然间我的lambda表达式出错。
首先我得到了这个:
此语言级别不支持Lambda表达式
然后我尝试更改Project Langugage级别,然后将其设置回默认值。现在我得到这个:
错误:(39,46)-source 1.7 $ b不支持java:lambda表达式$ b(使用-source 8或更高版本来启用lambda表达式)
IntelliJ ProjectStructure选项:
这是我的lambda:
我说在我更新IntellJ之前它再次起作用:
response.getData()。stream()。filter(a - > a .getStart_time()> WTStandards.getUnixTime())。forEach(eventList :: add);
您已配置 项目语言级,您还需要配置 模块语言级。有关
您可能还需要更改 Java编译器版本。转到设置对话框( MacOS 上的⌘ + ,或 Ctrl + Windows操作系统上的> Alt + S ,浏览构建,执行,部署→编译器→Java编译器(或只输入在顶部的搜索框中 javac
并更改Java Compiler版本如下:
I updated my IntelliJ IDEA this morning and after that I openend my project and suddenly i get an error in my lambda expressions.
First i got this one:
Lambda expressions not supported at this language level
and then I tried to change the Project Langugage level and afterwards set it back to default. Now i get this one:
Error:(39, 46) java: lambda expressions are not supported in -source 1.7
(use -source 8 or higher to enable lambda expressions)
IntelliJ ProjectStructure Options:
This is my lambda: And I say it again before I updated IntellJ it worked:
response.getData().stream().filter(a -> a.getStart_time() > WTStandards.getUnixTime()).forEach(eventList::add);
You have configued your Project language level, you need also to configure Module language level. Read more on Configuring Global, Project and Module SDKs.
Go to Project Structure → Module tab (⌘+; on MacOS or Ctrl+Alt+Shift+S on Windows OS) and check Language level of your module there:
You may also need to change the Java compiler version as well. Go to Settings dialog (⌘+, on MacOS or Ctrl+Alt+S on Windows OS), navigate through Build, Execution, Deployment → Compiler → Java Compiler (or just type javac
in the search box on top) and change Java Compiler version as below:
这篇关于IntelliJ更新 - >由lambda获取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!