You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Dan Lydick <dl...@earthlink.net> on 2005/06/05 08:44:41 UTC

JVM Spec version 2 and .class file versioning

While reviewing the class file structure of
java.lang.Object in Sun's 1.4.2_06 JDK, I
noticed that its major_version field is 48.
The JVM Spec version 2 says, "Implementations
of version 1.2 of the Java 2 platform can
support class file formats of versions in the
range 45.0 through 46.0 inclusive."  (That is,
major.minor version fields in the class file.)

The 1.5.0 JDK docs includes the same JVM spec
version as does the 1.4.2, namely at
http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html
for both of them.

Yet the root object file java.lang.Object has
minor/major version fields set to 0/48, respectively,
thus version 48.0, which is outside of the acceptable
range for both JDK 1.4.2 and 1.5.0.

Upon further inspection of this .class file (see also JVM
spec section 4.1 et al), I noticed that following the
access_flags field, there appears to be 8 unknown bytes,
followed by an expected three words of zeroes for the
this_class, super_class, and interfaces_count fields.
What follows those, though, is not intelligible to me
via the spec.

What gives?  Where can I find correct descriptions of
the latest .class file definitions for JDK 5?



Dan Lydick




Re: JVM Spec version 2 and .class file versioning

Posted by Tom Tromey <tr...@redhat.com>.
>>>>> "Dan" == Dan Lydick <dl...@earthlink.net> writes:

Dan> What gives?  Where can I find correct descriptions of
Dan> the latest .class file definitions for JDK 5?

Here's one source I found via google.  Not sure if it is the most up
to date.

http://java.sun.com/docs/books/vmspec/2nd-edition/UpdatedClassFileFormat.pdf

AIUI, the major version in 1.4 was 48 and the major version in 1.5 is 49.

There are differences between 1.3, 1.4, and 1.5.
As I remember, 1.4 introduce a little difference in verification.
1.5 adds a bunch of new things, including an extension to the
semantics of 'ldc'.

Tom