使用Java 7语法编译为Java 5 [英] use java 7 syntax to compile to java 5

查看:90
本文介绍了使用Java 7语法编译为Java 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使用Java 7语法并生成适用于1.5的字节码?据我所知,选项-目标-源不能相同。检查是否不使用新的API也可以,但不是很关键。

is there any way to use java 7 syntax and produce bytecode that works on 1.5? as far as i know, options -target and -source can't be different. checking if no new API was used also would be nice but is not crucial

推荐答案

不,不是。据我所知,不同的 -source -target 可以工作,但前提是该来源低于或等于目标(以提供向后兼容性)。可能会有源转换器将Java 7代码转换为旧版本。

No, it is not. As far as I know, different -source and -target work, but only if the source is lower or equal the target (in order to provide backwards compatibility). There may be source converters that convert your java 7 code into older versions.

这篇关于使用Java 7语法编译为Java 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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