Mark class files as pre-release if language version > LATEST_STABLE
#KT-20547 Fixed
This commit is contained in:
@@ -37,7 +37,9 @@ fun writeKotlinMetadata(
|
|||||||
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||||
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
||||||
var flags = extraFlags
|
var flags = extraFlags
|
||||||
if (KotlinCompilerVersion.isPreRelease() && state.languageVersionSettings.languageVersion == LanguageVersion.LATEST_STABLE) {
|
val languageVersion = state.languageVersionSettings.languageVersion
|
||||||
|
if (KotlinCompilerVersion.isPreRelease() && languageVersion == LanguageVersion.LATEST_STABLE ||
|
||||||
|
!languageVersion.isStable) {
|
||||||
flags = flags or JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG
|
flags = flags or JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG
|
||||||
}
|
}
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfigu
|
|||||||
class CompilerDeserializationConfiguration(languageVersionSettings: LanguageVersionSettings) : DeserializationConfiguration {
|
class CompilerDeserializationConfiguration(languageVersionSettings: LanguageVersionSettings) : DeserializationConfiguration {
|
||||||
override val skipMetadataVersionCheck = languageVersionSettings.getFlag(AnalysisFlag.skipMetadataVersionCheck)
|
override val skipMetadataVersionCheck = languageVersionSettings.getFlag(AnalysisFlag.skipMetadataVersionCheck)
|
||||||
|
|
||||||
override val skipPreReleaseCheck = skipMetadataVersionCheck
|
override val skipPreReleaseCheck = skipMetadataVersionCheck || !languageVersionSettings.languageVersion.isStable
|
||||||
|
|
||||||
override val typeAliasesAllowed = languageVersionSettings.supportsFeature(LanguageFeature.TypeAliases)
|
override val typeAliasesAllowed = languageVersionSettings.supportsFeature(LanguageFeature.TypeAliases)
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ public class KotlinCompilerVersion {
|
|||||||
// DON'T MODIFY IT
|
// DON'T MODIFY IT
|
||||||
public static final String VERSION = "@snapshot@";
|
public static final String VERSION = "@snapshot@";
|
||||||
|
|
||||||
// True if this compiler is of a non-stable (EAP or Beta) version.
|
// True if the latest stable language version supported by this compiler has not yet been released.
|
||||||
// Binaries produced by this compiler can not be loaded by release versions of the compiler.
|
// Binaries produced by this compiler with that language version (or any future language version) are going to be marked
|
||||||
|
// as "pre-release" and will not be loaded by release versions of the compiler.
|
||||||
// Change this value before and after every major release
|
// Change this value before and after every major release
|
||||||
private static final boolean IS_PRE_RELEASE = false;
|
private static final boolean IS_PRE_RELEASE = false;
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ public class KotlinCompilerVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
//noinspection ConstantConditions
|
||||||
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
|
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"IS_PRE_RELEASE cannot be true for a compiler without '-' in its version.\n" +
|
"IS_PRE_RELEASE cannot be true for a compiler without '-' in its version.\n" +
|
||||||
|
|||||||
Reference in New Issue
Block a user