Treat binaries with version 1.1.2 as pre-release
Metadata version is 1.1.2 since the start of Kotlin 1.1 EAP. Because the pre-release flag was not written to class files compiled with 1.1 EAP, there's no other way to figure out that they're pre-release except than to look at the metadata version. This assumes that the version will be advanced to 1.1.3 once Kotlin 1.1 is released
This commit is contained in:
+8
-11
@@ -50,12 +50,8 @@ class DeserializedDescriptorResolver {
|
|||||||
val classData = parseProto(kotlinClass) {
|
val classData = parseProto(kotlinClass) {
|
||||||
JvmProtoBufUtil.readClassDataFrom(data, strings)
|
JvmProtoBufUtil.readClassDataFrom(data, strings)
|
||||||
} ?: return null
|
} ?: return null
|
||||||
val sourceElement = KotlinJvmBinarySourceElement(
|
val source = KotlinJvmBinarySourceElement(kotlinClass, kotlinClass.incompatibility, kotlinClass.isPreReleaseInvisible)
|
||||||
kotlinClass,
|
return ClassDataWithSource(classData, source)
|
||||||
kotlinClass.incompatibility,
|
|
||||||
!IS_PRE_RELEASE && kotlinClass.classHeader.isPreRelease
|
|
||||||
)
|
|
||||||
return ClassDataWithSource(classData, sourceElement)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createKotlinPackagePartScope(descriptor: PackageFragmentDescriptor, kotlinClass: KotlinJvmBinaryClass): MemberScope? {
|
fun createKotlinPackagePartScope(descriptor: PackageFragmentDescriptor, kotlinClass: KotlinJvmBinaryClass): MemberScope? {
|
||||||
@@ -64,11 +60,7 @@ class DeserializedDescriptorResolver {
|
|||||||
val (nameResolver, packageProto) = parseProto(kotlinClass) {
|
val (nameResolver, packageProto) = parseProto(kotlinClass) {
|
||||||
JvmProtoBufUtil.readPackageDataFrom(data, strings)
|
JvmProtoBufUtil.readPackageDataFrom(data, strings)
|
||||||
} ?: return null
|
} ?: return null
|
||||||
val source = JvmPackagePartSource(
|
val source = JvmPackagePartSource(kotlinClass, kotlinClass.incompatibility, kotlinClass.isPreReleaseInvisible)
|
||||||
kotlinClass,
|
|
||||||
kotlinClass.incompatibility,
|
|
||||||
isPreReleaseInvisible = !IS_PRE_RELEASE && kotlinClass.classHeader.isPreRelease
|
|
||||||
)
|
|
||||||
return DeserializedPackageMemberScope(descriptor, packageProto, nameResolver, source, components) {
|
return DeserializedPackageMemberScope(descriptor, packageProto, nameResolver, source, components) {
|
||||||
// All classes are included into Java scope
|
// All classes are included into Java scope
|
||||||
emptyList()
|
emptyList()
|
||||||
@@ -81,6 +73,9 @@ class DeserializedDescriptorResolver {
|
|||||||
return IncompatibleVersionErrorData(classHeader.metadataVersion, JvmMetadataVersion.INSTANCE, location, classId)
|
return IncompatibleVersionErrorData(classHeader.metadataVersion, JvmMetadataVersion.INSTANCE, location, classId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val KotlinJvmBinaryClass.isPreReleaseInvisible: Boolean
|
||||||
|
get() = !IS_PRE_RELEASE && (classHeader.isPreRelease || classHeader.metadataVersion == KOTLIN_1_1_EAP_METADATA_VERSION)
|
||||||
|
|
||||||
internal fun readData(kotlinClass: KotlinJvmBinaryClass, expectedKinds: Set<KotlinClassHeader.Kind>): Array<String>? {
|
internal fun readData(kotlinClass: KotlinJvmBinaryClass, expectedKinds: Set<KotlinClassHeader.Kind>): Array<String>? {
|
||||||
val header = kotlinClass.classHeader
|
val header = kotlinClass.classHeader
|
||||||
return (header.data ?: header.incompatibleData)?.check { header.kind in expectedKinds }
|
return (header.data ?: header.incompatibleData)?.check { header.kind in expectedKinds }
|
||||||
@@ -110,6 +105,8 @@ class DeserializedDescriptorResolver {
|
|||||||
private val KOTLIN_FILE_FACADE_OR_MULTIFILE_CLASS_PART =
|
private val KOTLIN_FILE_FACADE_OR_MULTIFILE_CLASS_PART =
|
||||||
setOf(KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART)
|
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
|
var IS_PRE_RELEASE = KotlinCompilerVersion.IS_PRE_RELEASE
|
||||||
@Deprecated("Should only be used in tests") set
|
@Deprecated("Should only be used in tests") set
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user