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 ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.