简体   繁体   English

使用IDE支持,使Intellij IDEA允许在Java 5 6 7语言级别使用lambda

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

因为retrolambda ,我们可以在java 5 6 7中使用java 8 lambda特性。那么,如何让Intellij Idea在java 5 6 7语言级别允许lambda,还有lambda的ide特性?

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. 在IntelliJ IDEA中,您需要将模块的语言级别设置为Java 8,否则IDEA将给出关于lambda表达式的红色波浪线。

In Settings | Inspections | Java language level migration aids | Usages of API documented as @since 1.5 (1.6|1.7) Settings | Inspections | Java language level migration aids | Usages of API documented as @since 1.5 (1.6|1.7) Settings | Inspections | Java language level migration aids | Usages of API documented as @since 1.5 (1.6|1.7) 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 . Settings | Inspections | Java language level migration aids | Usages of API documented as @since 1.5 (1.6|1.7)您可以选择它来警告有关API的用法,记录为@since 1.8

Additionally you should run all the tests for your project using the Java 7 runtime, or whatever is your target. 此外,您应该使用Java 7运行时或任何目标运行项目的所有测试。 For Maven this can be configured using Surefire's jvm property . 对于Maven,可以使用Surefire的jvm属性进行配置。 During development, inside IDEA, it's more practical to run the tests just with Java 8. 在开发期间,在IDEA内部,使用Java 8运行测试更为实际。

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

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