Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Update -> get Error by lambda

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:

enter image description here

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);
like image 459
Markus G. Avatar asked Oct 21 '16 06:10

Markus G.


1 Answers

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 (⌘ CMD+; on MacOS or Ctrl+Alt+Shift+S on Windows OS) and check Language level of your module there:

enter image description here

You may also need to change the Java compiler version as well. Go to Settings dialog (⌘ CMD+, 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:

enter image description here

like image 50
DimaSan Avatar answered Oct 28 '22 08:10

DimaSan