Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,87 +11,88 @@ import org.jetbrains.kotlin.arguments.serialization.json.KotlinReleaseVersionAsN
/**
* Defines all Kotlin release versions.
*
* @param releaseName human-readable release name. Usually in the "<major>.<minor>.<patch>" format.
* @param major major number in the given release version
* @param minor minor number in the given release version
* @param patch patch number in the given release version
* [releaseName] human-readable release name in the "<major>.<minor>.<patch>" format.
*
* @see [WithKotlinReleaseVersionsMetadata]
*/
@Suppress("EnumEntryName")
@Serializable(with = KotlinReleaseVersionAsNameSerializer::class)
enum class KotlinReleaseVersion(
val releaseName: String,
val major: Int,
val minor: Int,
val patch: Int,
) : Comparable<KotlinReleaseVersion> {
v1_0_0("1.0.0", 1, 0, 0),
v1_0_1("1.0.1", 1, 0, 1),
v1_0_2("1.0.2", 1, 0, 2),
v1_0_3("1.0.3", 1, 0, 3),
v1_0_4("1.0.4", 1, 0, 4),
v1_0_5("1.0.5", 1, 0, 5),
v1_0_7("1.0.7", 1, 0, 7),
v1_1_0("1.1.0", 1, 1, 0),
v1_1_2("1.1.2", 1, 1, 2),
v1_1_3("1.1.3", 1, 1, 3),
v1_1_4("1.1.4", 1, 1, 4),
v1_1_50("1.1.50", 1, 1, 50),
v1_1_60("1.1.60", 1, 1, 60),
v1_1_61("1.1.61", 1, 1, 61),
v1_2_0("1.2.0", 1, 2, 0),
v1_2_20("1.2.20", 1, 2, 20),
v1_2_40("1.2.40", 1, 2, 40),
v1_2_41("1.2.41", 1, 2, 41),
v1_2_50("1.2.50", 1, 2, 50),
v1_2_60("1.2.60", 1, 2, 60),
v1_2_70("1.2.70", 1, 2, 70),
v1_2_71("1.2.71", 1, 2, 71),
v1_3_0("1.3.0", 1, 3, 0),
v1_3_10("1.3.10", 1, 3, 10),
v1_3_20("1.3.20", 1, 3, 20),
v1_3_30("1.3.30", 1, 3, 30),
v1_3_40("1.3.40", 1, 3, 40),
v1_3_50("1.3.50", 1, 3, 50),
v1_3_70("1.3.70", 1, 3, 70),
v1_3_71("1.3.71", 1, 3, 71),
v1_3_72("1.3.72", 1, 3, 72),
v1_4_0("1.4.0", 1, 4, 0),
v1_4_10("1.4.10", 1, 4, 10),
v1_4_20("1.4.20", 1, 4, 20),
v1_4_30("1.4.30", 1, 4, 30),
v1_4_32("1.4.32", 1, 4, 32),
v1_5_0("1.5.0", 1, 5, 0),
v1_5_20("1.5.20", 1, 5, 20),
v1_5_30("1.5.30", 1, 5, 30),
v1_5_32("1.5.32", 1, 5, 32),
v1_6_0("1.6.0", 1, 6, 0),
v1_6_20("1.6.20", 1, 6, 20),
v1_6_21("1.6.21", 1, 6, 21),
v1_7_0("1.7.0", 1, 7, 0),
v1_7_20("1.7.20", 1, 7, 20),
v1_7_21("1.7.21", 1, 7, 21),
v1_8_0("1.8.0", 1, 8, 0),
v1_8_20("1.8.20", 1, 8, 20),
v1_8_22("1.8.22", 1, 8, 22),
v1_9_0("1.9.0", 1, 9, 0),
v1_9_20("1.9.20", 1, 9, 20),
v1_9_24("1.9.24", 1, 9, 24),
v1_9_25("1.9.25", 1, 9, 25),
v2_0_0("2.0.0", 2, 0, 0),
v2_0_20("2.0.20", 2, 0, 20),
v2_0_21("2.0.21", 2, 0, 21),
v2_1_0("2.1.0", 2, 1, 0),
v2_1_20("2.1.20", 2, 1, 20),
v2_1_21("2.1.21", 2, 1, 21),
v2_2_0("2.2.0", 2, 2, 0),
v2_2_20("2.2.20", 2, 2, 20),
v2_3_0("2.3.0", 2, 3, 0),
v2_3_20("2.3.20", 2, 3, 20),
v2_4_0("2.4.0", 2, 4, 0),
v2_4_20("2.4.20", 2, 4, 20),
v2_5_0("2.5.0", 2, 5, 0),
v2_6_0("2.6.0", 2, 6, 0);
v1_0_0(1, 0, 0),
v1_0_1(1, 0, 1),
v1_0_2(1, 0, 2),
v1_0_3(1, 0, 3),
v1_0_4(1, 0, 4),
v1_0_5(1, 0, 5),
v1_0_7(1, 0, 7),
v1_1_0(1, 1, 0),
v1_1_2(1, 1, 2),
v1_1_3(1, 1, 3),
v1_1_4(1, 1, 4),
v1_1_50(1, 1, 50),
v1_1_60(1, 1, 60),
v1_1_61(1, 1, 61),
v1_2_0(1, 2, 0),
v1_2_20(1, 2, 20),
v1_2_40(1, 2, 40),
v1_2_41(1, 2, 41),
v1_2_50(1, 2, 50),
v1_2_60(1, 2, 60),
v1_2_70(1, 2, 70),
v1_2_71(1, 2, 71),
v1_3_0(1, 3, 0),
v1_3_10(1, 3, 10),
v1_3_20(1, 3, 20),
v1_3_30(1, 3, 30),
v1_3_40(1, 3, 40),
v1_3_50(1, 3, 50),
v1_3_70(1, 3, 70),
v1_3_71(1, 3, 71),
v1_3_72(1, 3, 72),
v1_4_0(1, 4, 0),
v1_4_10(1, 4, 10),
v1_4_20(1, 4, 20),
v1_4_30(1, 4, 30),
v1_4_32(1, 4, 32),
v1_5_0(1, 5, 0),
v1_5_20(1, 5, 20),
v1_5_30(1, 5, 30),
v1_5_32(1, 5, 32),
v1_6_0(1, 6, 0),
v1_6_20(1, 6, 20),
v1_6_21(1, 6, 21),
v1_7_0(1, 7, 0),
v1_7_20(1, 7, 20),
v1_7_21(1, 7, 21),
v1_8_0(1, 8, 0),
v1_8_20(1, 8, 20),
v1_8_22(1, 8, 22),
v1_9_0(1, 9, 0),
v1_9_20(1, 9, 20),
v1_9_24(1, 9, 24),
v1_9_25(1, 9, 25),
v2_0_0(2, 0, 0),
v2_0_20(2, 0, 20),
v2_0_21(2, 0, 21),
v2_1_0(2, 1, 0),
v2_1_20(2, 1, 20),
v2_1_21(2, 1, 21),
v2_2_0(2, 2, 0),
v2_2_20(2, 2, 20),
v2_3_0(2, 3, 0),
v2_3_20(2, 3, 20),
v2_4_0(2, 4, 0),
v2_4_20(2, 4, 20),
v2_5_0(2, 5, 0),
v2_6_0(2, 6, 0);

val releaseName: String = "$major.$minor.$patch"
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,23 @@

package org.jetbrains.kotlin.util

import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.config.metadataVersion
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.metadata.deserialization.MetadataVersion
import java.util.*

private val LANGUAGE_TO_METADATA_VERSION = EnumMap<LanguageVersion, MetadataVersion>(LanguageVersion::class.java).apply {
val oldMetadataVersion = MetadataVersion(1, 1, 18)
this[LanguageVersion.KOTLIN_1_0] = oldMetadataVersion
this[LanguageVersion.KOTLIN_1_1] = oldMetadataVersion
this[LanguageVersion.KOTLIN_1_2] = oldMetadataVersion
this[LanguageVersion.KOTLIN_1_3] = oldMetadataVersion
this[LanguageVersion.KOTLIN_1_4] = MetadataVersion(1, 4, 3)
this[LanguageVersion.KOTLIN_1_5] = MetadataVersion(1, 5, 1)
this[LanguageVersion.KOTLIN_1_6] = MetadataVersion(1, 6, 0)
this[LanguageVersion.KOTLIN_1_7] = MetadataVersion(1, 7, 0)
this[LanguageVersion.KOTLIN_1_8] = MetadataVersion(1, 8, 0)
this[LanguageVersion.KOTLIN_1_9] = MetadataVersion(1, 9, 0)
this[LanguageVersion.KOTLIN_2_0] = MetadataVersion(2, 0, 0)
this[LanguageVersion.KOTLIN_2_1] = MetadataVersion(2, 1, 0)
this[LanguageVersion.KOTLIN_2_2] = MetadataVersion(2, 2, 0)
this[LanguageVersion.KOTLIN_2_3] = MetadataVersion(2, 3, 0)
this[LanguageVersion.KOTLIN_2_4] = MetadataVersion.INSTANCE
this[LanguageVersion.KOTLIN_2_5] = MetadataVersion(2, 5, 0)
this[LanguageVersion.KOTLIN_2_6] = MetadataVersion(2, 6, 0)

check(size == LanguageVersion.entries.size) {
"Please add mappings from the missing LanguageVersion instances to the corresponding MetadataVersion " +
"in `LANGUAGE_TO_METADATA_VERSION`"
for (version in LanguageVersion.entries) {
this[version] = when {
version <= LanguageVersion.KOTLIN_1_3 -> oldMetadataVersion
version == LanguageVersion.KOTLIN_1_4 -> MetadataVersion(1, 4, 3)
version == LanguageVersion.KOTLIN_1_5 -> MetadataVersion(1, 5, 1)
version == LanguageVersion.LATEST_STABLE -> MetadataVersion.INSTANCE
else -> MetadataVersion(version.major, version.minor, 0)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ data class KotlinAbiVersion(val major: Int, val minor: Int, val patch: Int) {
*
* Since the release of 2.2.0, the ABI version is aligned with the Kotlin version.
*/
val CURRENT = KotlinAbiVersion(2, 4, 0)
val CURRENT = KotlinAbiVersion(KotlinVersion.CURRENT.major, KotlinVersion.CURRENT.minor, 0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDEA opens a file from a jar when I try opening a definition of KotlinVersion.CURRENT that's initialized with 2.2.21 instead of the actual local 2.4.255. But it looks like a resolving bug because I have KotlinAbiVersion.CURRENT = 2.4.0 in runtime.


/**
* Versions before 1.4.1 were the active development phase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,9 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware, L
val FIRST_NON_DEPRECATED = KOTLIN_2_2

@JvmField
val LATEST_STABLE = KOTLIN_2_4
val LATEST_STABLE = LanguageVersion.entries.single {
it.major == KotlinVersion.CURRENT.major && it.minor == KotlinVersion.CURRENT.minor
}
}
}

Expand Down