Mark class files as pre-release if language version > LATEST_STABLE

#KT-20547 Fixed
This commit is contained in:
Alexander Udalov
2017-10-12 13:04:46 +02:00
parent 3665255a2b
commit 0510c553c3
3 changed files with 8 additions and 4 deletions
@@ -37,7 +37,9 @@ fun writeKotlinMetadata(
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
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
}
if (flags != 0) {
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfigu
class CompilerDeserializationConfiguration(languageVersionSettings: LanguageVersionSettings) : DeserializationConfiguration {
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)
@@ -21,8 +21,9 @@ public class KotlinCompilerVersion {
// DON'T MODIFY IT
public static final String VERSION = "@snapshot@";
// True if this compiler is of a non-stable (EAP or Beta) version.
// Binaries produced by this compiler can not be loaded by release versions of the compiler.
// True if the latest stable language version supported by this compiler has not yet been released.
// 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
private static final boolean IS_PRE_RELEASE = false;
@@ -38,6 +39,7 @@ public class KotlinCompilerVersion {
}
static {
//noinspection ConstantConditions
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
throw new IllegalStateException(
"IS_PRE_RELEASE cannot be true for a compiler without '-' in its version.\n" +