Write "pre-release" flag to class files, do not allow usages in release
This commit is contained in:
+5
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
@@ -49,7 +50,7 @@ class DeserializedDescriptorResolver(private val errorReporter: ErrorReporter) {
|
||||
val classData = parseProto(kotlinClass) {
|
||||
JvmProtoBufUtil.readClassDataFrom(data, strings)
|
||||
}
|
||||
val sourceElement = KotlinJvmBinarySourceElement(kotlinClass)
|
||||
val sourceElement = KotlinJvmBinarySourceElement(kotlinClass, !IS_PRE_RELEASE && kotlinClass.classHeader.isPreRelease)
|
||||
return ClassDataWithSource(classData, sourceElement)
|
||||
}
|
||||
|
||||
@@ -92,5 +93,8 @@ class DeserializedDescriptorResolver(private val errorReporter: ErrorReporter) {
|
||||
|
||||
private val KOTLIN_FILE_FACADE_OR_MULTIFILE_CLASS_PART =
|
||||
setOf(KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART)
|
||||
|
||||
var IS_PRE_RELEASE = KotlinCompilerVersion.IS_PRE_RELEASE
|
||||
@Deprecated("Should only be used in tests") set
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -30,6 +30,9 @@ class JvmPackagePartSource(val className: JvmClassName, val facadeClassName: Jvm
|
||||
}
|
||||
)
|
||||
|
||||
// TODO
|
||||
override val isPreReleaseInvisible: Boolean get() = false
|
||||
|
||||
val simpleName: Name get() = Name.identifier(className.internalName.substringAfterLast('/'))
|
||||
|
||||
val classId: ClassId get() = ClassId(className.packageFqName, simpleName)
|
||||
|
||||
+7
-2
@@ -18,8 +18,13 @@ package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.SourceFile
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
|
||||
class KotlinJvmBinarySourceElement(val binaryClass: KotlinJvmBinaryClass) : SourceElement {
|
||||
override fun toString() = "${javaClass.simpleName}: $binaryClass"
|
||||
class KotlinJvmBinarySourceElement(
|
||||
val binaryClass: KotlinJvmBinaryClass,
|
||||
override val isPreReleaseInvisible: Boolean = false
|
||||
) : DeserializedContainerSource {
|
||||
override fun getContainingFile(): SourceFile = SourceFile.NO_SOURCE_FILE
|
||||
|
||||
override fun toString() = "${javaClass.simpleName}: $binaryClass"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user