Why do Java class file versions start from 45?

不想你离开。 提交于 2020-01-24 04:14:05

问题


According to the JVM specification:

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

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


回答1:


Why do Java class file versions start from 45?

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

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.

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.

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.



来源:https://stackoverflow.com/questions/58467204/why-do-java-class-file-versions-start-from-45

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!