class file (JVMS
4.1). The class file version appears exactly once in each
class, and is set to an unspecified default value if not explicitly provided.
The major versions of class file format begins at 45 for Java Platform version 1.0.2, and is continuous
up to ClassFile#latestMajorVersion(). In general, each major version
defines a new supported class file format, modeled by ClassFileFormatVersion, and supports all previous formats.
For major versions up to 55 for Java SE
Platform 11, the minor version of any value is supported. For major versions
56 for Java SE Platform version 12 and above,
the minor version must be 0 or 65535.
The minor version 0 is always supported, and represents the format
modeled by ClassFileFormatVersion. The minor version 65535
indicates the class file uses preview features of the Java SE
Platform release represented by the major version. A Java Virtual Machine
can only load such a class file if it has the same Java SE Platform
version and the JVM has preview features enabled.
ClassFile Structure
ClassModel#majorVersion(), ClassModel#minorVersion(), ClassFileFormatVersion
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | |
| public static ClassFileVersion | Returns: aClassFileVersion elementthe major version majorVersion, int the minor version minorVersion)Returns a |
| majorVersion | back to summary |
|---|---|
| public int majorVersion() Returns the major version. It is a API Note Constants in
| |
| minorVersion | back to summary |
|---|---|
| public int minorVersion() Returns the minor version. It is a
| |
| of | back to summary |
|---|---|
| public static ClassFileVersion of(int majorVersion, int minorVersion) Returns a
| |