为什么Java类文件版本从45开始? [英] Why do Java class file versions start from 45?

查看:144
本文介绍了为什么Java类文件版本从45开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据JVM规范:

JDK 1.0.2版中的Oracle Java虚拟机实现支持类文件格式版本45.0至45.3(含). JDK发行了1.1.*支持的类文件格式版本,范围从45.0到45.65535(含).对于k≥2,JDK版本1.k支持45.0到44 + k.0之间的类文件格式版本.

Oracle's Java Virtual Machine implementation in JDK release 1.0.2 supports class file format versions 45.0 through 45.3 inclusive. JDK releases 1.1.* support class file format versions in the range 45.0 through 45.65535 inclusive. For k ≥ 2, JDK release 1.k supports class file format versions in the range 45.0 through 44+k.0 inclusive.

https://docs.oracle.com /javase/specs/jvms/se7/html/jvms-4.html

我想知道,为什么他们从 45 开始而不是从 1 还是 0 ?

I'm wondering, why did they start versioning from 45 and not, say, from 1 or 0?

推荐答案

为什么Java类文件版本从45开始?

Why do Java class file versions start from 45?

在第一个公开发布的版本(Java 1.0.2)之前有Java的版本.

There were versions of Java before the first publicly released version (Java 1.0.2).

Java最初以1991年的 Oak 编程语言开始诞生. 1994年更名为Java,并于1996年首次公开发布.

Java originally started life as the Oak programming language in 1991. It was renamed as Java in 1994 and the first public release was in 1996.

可以安全地假设Java文件的早期版本(预发行版)使用的类文件版本小于45,并且可能用于Oak.在早期,开发人员很可能对字节码指令集和类文件格式的其他方面进行了许多更改.那将需要定期突出"类文件的版本号.

It is safe to assume that classfile versions less than 45 were used for earlier (pre-release) versions of Java and probably Oak. In the early days, it is likely that the developers made numerous changes to the bytecode instruction set and other aspects of the classfile format. That would have required "bumping" the classfile version number on a regular basis.

以上是推测.关于Oak和1.0之前的Java的公开信息很少.但是,从1993年开始的橡木规范表示它们是已经将Oak源代码编译为存储在".class"文件中的字节码,每个类一个.

This above is conjecture. There is very little publicly available information on Oak and pre-1.0 Java. However, the text of the Oak specification from 1993 indicates that they were already compiling Oak source code to bytecodes that were stored in ".class" files, one per class.

这篇关于为什么Java类文件版本从45开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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