Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Intellij IDEA allow lambda in java 5 6 7 language level with IDE support

Because of retrolambda, we can use java 8 lambda feature in java 5 6 7. so, How to make Intellij Idea allow lambda in java 5 6 7 language level, also with ide features for lambda ?

like image 962
wener Avatar asked Jun 14 '14 07:06

wener


1 Answers

In IntelliJ IDEA you will need to set the language level for the module to be Java 8, or else IDEA will give red squiggly lines about lambda expressions.

In Settings | Inspections | Java language level migration aids | Usages of API documented as @since 1.5 (1.6|1.7) you can choose it to warn about usages of API that is documented as @since 1.8.

Additionally you should run all the tests for your project using the Java 7 runtime, or whatever is your target. For Maven this can be configured using Surefire's jvm property. During development, inside IDEA, it's more practical to run the tests just with Java 8.

like image 126
Esko Luontola Avatar answered Sep 30 '22 17:09

Esko Luontola