IntelliJ IDEA中的项目语言级别是什么? [英] What is Project Language level in IntelliJ IDEA?

查看:4195
本文介绍了IntelliJ IDEA中的项目语言级别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java 7 SDK和IntelliJ IDEA IDE。

I am using Java 7 SDK and IntelliJ IDEA IDE.

java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

我仍然无法使用Java 7功能。经过一些谷歌搜索后,我可以在将项目语言级别设置为 7(Diamond,ARM,multicatch等)之后使用所有功能。究竟是什么?如果这与基于JDK的语法有某种关系,那么什么是等级8(Lambda,注释等)? Java 8尚未发布。据Wiki称,Java 8预计将于2014年3月发布。有人请解释这个语言水平的概念。

I am still not able to use Java 7 features. After a bit of googling I could use all the features after setting project language level to 7(Diamond, ARM, multicatch etc). What exactly is this? If this has some relationship to syntax based on JDK in use what is level 8(Lambda, annotations etc)? Java 8 isn't released yet. Java 8 is expected in March 2014 according to Wiki. Someone please explain this language level concept.

推荐答案

语言水平设置设置编辑器中的代码辅助功能应该支持哪些功能。例如,如果您正在使用JDK 1.7但希望您的代码与JDK 1.6兼容,则可以将语言级别设置为低于实际JDK支持(在JDK 1.6的情况下为6.0),并且仅获得重构/语法建议支持1.6及更低版本。根据您的编译器,它还可以为编译器选项提供删除对较新语法元素的支持。

The Language level setting sets which features the code assistance in the editor should support. For example, if you're using JDK 1.7 but want your code to be compatible with JDK 1.6, you can set the language level lower than your actual JDK supports (6.0 in the case of JDK 1.6) and only get refactorings/syntax suggested that are supported on 1.6 and lower. Depending on your compiler, it may also give the compiler options to remove support for newer syntax elements.

8.0(正如您猜测的那样对应于Java 8)适用于想要试用 Java 8快照可用。由于Java 8未发布,语言级别8.0可能会在发布之前进行很好的更改。

The 8.0 (which, as you're guessing corresponds to Java 8) is available for people that want to experiment with one of the Java 8 snapshots that are available. Since Java 8 isn't released, language level 8.0 may very well change before release.

这篇关于IntelliJ IDEA中的项目语言级别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆