Move testable IS_PRE_RELEASE flag to KotlinCompilerVersion

It'll be used in the JS back-end as well soon, so
DeserializedDescriptorResolver is not the best place for it
This commit is contained in:
Alexander Udalov
2017-02-06 20:50:42 +03:00
parent 3efda0e45a
commit 4c9afb9d20
6 changed files with 23 additions and 25 deletions
@@ -75,7 +75,7 @@ class DeserializedDescriptorResolver {
private val KotlinJvmBinaryClass.isPreReleaseInvisible: Boolean
get() = !JvmMetadataVersion.skipCheck &&
!IS_PRE_RELEASE &&
!KotlinCompilerVersion.isPreRelease() &&
(classHeader.isPreRelease || classHeader.metadataVersion == KOTLIN_1_1_EAP_METADATA_VERSION)
internal fun readData(kotlinClass: KotlinJvmBinaryClass, expectedKinds: Set<KotlinClassHeader.Kind>): Array<String>? {
@@ -108,14 +108,5 @@ class DeserializedDescriptorResolver {
setOf(KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART)
private val KOTLIN_1_1_EAP_METADATA_VERSION = JvmMetadataVersion(1, 1, 2)
var IS_PRE_RELEASE = KotlinCompilerVersion.IS_PRE_RELEASE
get() {
val testOverrideValue = System.getProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY)
return testOverrideValue?.toBoolean() ?: field
}
@Deprecated("Should only be used in tests") set
const val TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release"
}
}