不同的JDK更新会产生不同的Java字节码吗? [英] Do different JDK Updates produce different Java byte code?

查看:275
本文介绍了不同的JDK更新会产生不同的Java字节码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设情况:

我有一个项目的合规级别指定为1.5。
现在我使用两个不同的JDK编译这个项目:首先使用JDK 6 Update 7,然后使用JDK 6 Update 20.

I've got a project whose source compliance level is specified to 1.5. Now I compile this project with two different JDKs: At first with JDK 6 Update 7 and then with JDK 6 Update 20.

这两个不同的JDK生成不同的Java字节代码,尽管它们只在Update版本中有所不同?

Do these two different JDKs produce different Java byte code, although they only differ in their Update version?

推荐答案

生成的代码通常只在编译器错误修复。

The generated code usually only differs in case of compiler bug fixes.

但是,JLS 指定从源代码到生成的字节代码的1:1映射,因此您不应该依赖要生成的完全相同的字节代码。

However the JLS does not specify a 1:1 mapping from source code to the generated byte code, so you should not rely on the exact same byte code to be generated.

这篇关于不同的JDK更新会产生不同的Java字节码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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