JvmMetadataVersion

class JvmMetadataVersion(val major: Int, val minor: Int, val patch: Int) : Comparable<JvmMetadataVersion>

Version of the metadata inside JVM classfile.

Starting from Kotlin 1.4, the metadata version is equal to the language version. It consists of major and minor versions. Patch version usually does not affect the metadata format, but it is present for completeness because compiler writes its full version to the @Metadata annotation; therefore, the patch version is accounted for in comparisons and equality. All components (major, minor, and patch) should be non-negative.

While the metadata version is currently equal to the language version, this may be changed in the future, including adding or removing components. Therefore, it is recommended to rely on the compareTo and equals method instead of accessing components directly.

Note that the metadata version is 1.1 for Kotlin compilers from 1.0 until 1.4, and is 1.0 or less for pre-1.0 compilers. Metadata with versions less than 1.1 is considered incompatible and cannot be read or written.

The library can read in strict mode only compatible versions of metadata. For definition of a compatible version, see documentation for LATEST_STABLE_SUPPORTED property.

Constructors

Link copied to clipboard
constructor(major: Int, minor: Int)

Creates a new JvmMetadataVersion instance with specified major and minor versions and a patch version equal to 0.

constructor(major: Int, minor: Int, patch: Int)

Types

Link copied to clipboard
object Companion

Companion object to hold pre-defined JvmMetadataVersion instances.

Properties

Link copied to clipboard
val major: Int

Major component of version

Link copied to clipboard
val minor: Int

Minor component of version

Link copied to clipboard
val patch: Int

Patch component of version

Functions

Link copied to clipboard
open operator override fun compareTo(other: JvmMetadataVersion): Int

Compares this JvmMetadataVersion object with another JvmMetadataVersion object.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Checks if this JvmMetadataVersion object is equal to other JvmMetadataVersion object.

Link copied to clipboard
open override fun hashCode(): Int

Calculates the hash code value for the object based on major, minor, and patch components.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of the version number. The string representation is in the format "major.minor.patch".