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

查看:81
本文介绍了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 的语法有某种关系,什么是 level 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.

推荐答案

Language level 设置设置编辑器中的代码辅助应支持哪些功能.例如,如果您使用的是 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天全站免登陆