Rename SinceKotlinInfo -> VersionRequirement
This commit is contained in:
@@ -47,9 +47,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) return false
|
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||||
if (old.hasSinceKotlinInfoTable()) {
|
if (old.hasVersionRequirementTable()) {
|
||||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) return false
|
if (!checkEquals(old.versionRequirementTable, new.versionRequirementTable)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.packageModuleName) != new.hasExtension(JvmProtoBuf.packageModuleName)) return false
|
if (old.hasExtension(JvmProtoBuf.packageModuleName) != new.hasExtension(JvmProtoBuf.packageModuleName)) return false
|
||||||
@@ -78,7 +78,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
PROPERTY_LIST,
|
PROPERTY_LIST,
|
||||||
TYPE_ALIAS_LIST,
|
TYPE_ALIAS_LIST,
|
||||||
TYPE_TABLE,
|
TYPE_TABLE,
|
||||||
SINCE_KOTLIN_INFO_TABLE,
|
VERSION_REQUIREMENT_TABLE,
|
||||||
JVM_EXT_PACKAGE_MODULE_NAME,
|
JVM_EXT_PACKAGE_MODULE_NAME,
|
||||||
JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST,
|
JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST,
|
||||||
JS_EXT_PACKAGE_FQ_NAME
|
JS_EXT_PACKAGE_FQ_NAME
|
||||||
@@ -98,9 +98,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufPackageKind.TYPE_TABLE)
|
if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufPackageKind.TYPE_TABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) result.add(ProtoBufPackageKind.SINCE_KOTLIN_INFO_TABLE)
|
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufPackageKind.VERSION_REQUIREMENT_TABLE)
|
||||||
if (old.hasSinceKotlinInfoTable()) {
|
if (old.hasVersionRequirementTable()) {
|
||||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) result.add(ProtoBufPackageKind.SINCE_KOTLIN_INFO_TABLE)
|
if (!checkEquals(old.versionRequirementTable, new.versionRequirementTable)) result.add(ProtoBufPackageKind.VERSION_REQUIREMENT_TABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.packageModuleName) != new.hasExtension(JvmProtoBuf.packageModuleName)) result.add(ProtoBufPackageKind.JVM_EXT_PACKAGE_MODULE_NAME)
|
if (old.hasExtension(JvmProtoBuf.packageModuleName) != new.hasExtension(JvmProtoBuf.packageModuleName)) result.add(ProtoBufPackageKind.JVM_EXT_PACKAGE_MODULE_NAME)
|
||||||
@@ -163,14 +163,14 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||||
if (old.hasSinceKotlinInfo()) {
|
if (old.hasVersionRequirement()) {
|
||||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
if (old.versionRequirement != new.versionRequirement) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) return false
|
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||||
if (old.hasSinceKotlinInfoTable()) {
|
if (old.hasVersionRequirementTable()) {
|
||||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) return false
|
if (!checkEquals(old.versionRequirementTable, new.versionRequirementTable)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.classModuleName) != new.hasExtension(JvmProtoBuf.classModuleName)) return false
|
if (old.hasExtension(JvmProtoBuf.classModuleName) != new.hasExtension(JvmProtoBuf.classModuleName)) return false
|
||||||
@@ -218,8 +218,8 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
ENUM_ENTRY_LIST,
|
ENUM_ENTRY_LIST,
|
||||||
SEALED_SUBCLASS_FQ_NAME_LIST,
|
SEALED_SUBCLASS_FQ_NAME_LIST,
|
||||||
TYPE_TABLE,
|
TYPE_TABLE,
|
||||||
SINCE_KOTLIN_INFO,
|
VERSION_REQUIREMENT,
|
||||||
SINCE_KOTLIN_INFO_TABLE,
|
VERSION_REQUIREMENT_TABLE,
|
||||||
JVM_EXT_CLASS_MODULE_NAME,
|
JVM_EXT_CLASS_MODULE_NAME,
|
||||||
JVM_EXT_CLASS_LOCAL_VARIABLE_LIST,
|
JVM_EXT_CLASS_LOCAL_VARIABLE_LIST,
|
||||||
JS_EXT_CLASS_ANNOTATION_LIST,
|
JS_EXT_CLASS_ANNOTATION_LIST,
|
||||||
@@ -266,14 +266,14 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufClassKind.TYPE_TABLE)
|
if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufClassKind.TYPE_TABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO)
|
if (old.hasVersionRequirement() != new.hasVersionRequirement()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
|
||||||
if (old.hasSinceKotlinInfo()) {
|
if (old.hasVersionRequirement()) {
|
||||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO)
|
if (old.versionRequirement != new.versionRequirement) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO_TABLE)
|
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||||
if (old.hasSinceKotlinInfoTable()) {
|
if (old.hasVersionRequirementTable()) {
|
||||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO_TABLE)
|
if (!checkEquals(old.versionRequirementTable, new.versionRequirementTable)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.classModuleName) != new.hasExtension(JvmProtoBuf.classModuleName)) result.add(ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME)
|
if (old.hasExtension(JvmProtoBuf.classModuleName) != new.hasExtension(JvmProtoBuf.classModuleName)) result.add(ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME)
|
||||||
@@ -349,9 +349,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||||
if (old.hasSinceKotlinInfo()) {
|
if (old.hasVersionRequirement()) {
|
||||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
if (old.versionRequirement != new.versionRequirement) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.methodSignature) != new.hasExtension(JvmProtoBuf.methodSignature)) return false
|
if (old.hasExtension(JvmProtoBuf.methodSignature) != new.hasExtension(JvmProtoBuf.methodSignature)) return false
|
||||||
@@ -426,9 +426,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
if (old.setterFlags != new.setterFlags) return false
|
if (old.setterFlags != new.setterFlags) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||||
if (old.hasSinceKotlinInfo()) {
|
if (old.hasVersionRequirement()) {
|
||||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
if (old.versionRequirement != new.versionRequirement) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.propertySignature) != new.hasExtension(JvmProtoBuf.propertySignature)) return false
|
if (old.hasExtension(JvmProtoBuf.propertySignature) != new.hasExtension(JvmProtoBuf.propertySignature)) return false
|
||||||
@@ -490,9 +490,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
|
|
||||||
if (!checkEqualsTypeAliasAnnotation(old, new)) return false
|
if (!checkEqualsTypeAliasAnnotation(old, new)) return false
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||||
if (old.hasSinceKotlinInfo()) {
|
if (old.hasVersionRequirement()) {
|
||||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
if (old.versionRequirement != new.versionRequirement) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -509,8 +509,8 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.SinceKotlinInfoTable, new: ProtoBuf.SinceKotlinInfoTable): Boolean {
|
open fun checkEquals(old: ProtoBuf.VersionRequirementTable, new: ProtoBuf.VersionRequirementTable): Boolean {
|
||||||
if (!checkEqualsSinceKotlinInfoTableInfo(old, new)) return false
|
if (!checkEqualsVersionRequirementTableRequirement(old, new)) return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -657,9 +657,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
|
|
||||||
if (!checkEqualsConstructorValueParameter(old, new)) return false
|
if (!checkEqualsConstructorValueParameter(old, new)) return false
|
||||||
|
|
||||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||||
if (old.hasSinceKotlinInfo()) {
|
if (old.hasVersionRequirement()) {
|
||||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
if (old.versionRequirement != new.versionRequirement) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.constructorSignature) != new.hasExtension(JvmProtoBuf.constructorSignature)) return false
|
if (old.hasExtension(JvmProtoBuf.constructorSignature) != new.hasExtension(JvmProtoBuf.constructorSignature)) return false
|
||||||
@@ -829,7 +829,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.SinceKotlinInfo, new: ProtoBuf.SinceKotlinInfo): Boolean {
|
open fun checkEquals(old: ProtoBuf.VersionRequirement, new: ProtoBuf.VersionRequirement): Boolean {
|
||||||
if (old.hasVersion() != new.hasVersion()) return false
|
if (old.hasVersion() != new.hasVersion()) return false
|
||||||
if (old.hasVersion()) {
|
if (old.hasVersion()) {
|
||||||
if (old.version != new.version) return false
|
if (old.version != new.version) return false
|
||||||
@@ -1089,11 +1089,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEqualsSinceKotlinInfoTableInfo(old: ProtoBuf.SinceKotlinInfoTable, new: ProtoBuf.SinceKotlinInfoTable): Boolean {
|
open fun checkEqualsVersionRequirementTableRequirement(old: ProtoBuf.VersionRequirementTable, new: ProtoBuf.VersionRequirementTable): Boolean {
|
||||||
if (old.infoCount != new.infoCount) return false
|
if (old.requirementCount != new.requirementCount) return false
|
||||||
|
|
||||||
for(i in 0..old.infoCount - 1) {
|
for(i in 0..old.requirementCount - 1) {
|
||||||
if (!checkEquals(old.getInfo(i), new.getInfo(i))) return false
|
if (!checkEquals(old.getRequirement(i), new.getRequirement(i))) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -1209,8 +1209,8 @@ fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
|||||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfoTable()) {
|
if (hasVersionRequirementTable()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfoTable.hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.packageModuleName)) {
|
if (hasExtension(JvmProtoBuf.packageModuleName)) {
|
||||||
@@ -1285,12 +1285,12 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
|
|||||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfo()) {
|
if (hasVersionRequirement()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
hashCode = 31 * hashCode + versionRequirement
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfoTable()) {
|
if (hasVersionRequirementTable()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfoTable.hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.classModuleName)) {
|
if (hasExtension(JvmProtoBuf.classModuleName)) {
|
||||||
@@ -1353,8 +1353,8 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
|||||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfo()) {
|
if (hasVersionRequirement()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
hashCode = 31 * hashCode + versionRequirement
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.methodSignature)) {
|
if (hasExtension(JvmProtoBuf.methodSignature)) {
|
||||||
@@ -1417,8 +1417,8 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
|||||||
hashCode = 31 * hashCode + setterFlags
|
hashCode = 31 * hashCode + setterFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfo()) {
|
if (hasVersionRequirement()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
hashCode = 31 * hashCode + versionRequirement
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.propertySignature)) {
|
if (hasExtension(JvmProtoBuf.propertySignature)) {
|
||||||
@@ -1473,8 +1473,8 @@ fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
|
|||||||
hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfo()) {
|
if (hasVersionRequirement()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
hashCode = 31 * hashCode + versionRequirement
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashCode
|
return hashCode
|
||||||
@@ -1494,11 +1494,11 @@ fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
|
|||||||
return hashCode
|
return hashCode
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ProtoBuf.SinceKotlinInfoTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
fun ProtoBuf.VersionRequirementTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||||
var hashCode = 1
|
var hashCode = 1
|
||||||
|
|
||||||
for(i in 0..infoCount - 1) {
|
for(i in 0..requirementCount - 1) {
|
||||||
hashCode = 31 * hashCode + getInfo(i).hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + getRequirement(i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashCode
|
return hashCode
|
||||||
@@ -1623,8 +1623,8 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
|
|||||||
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSinceKotlinInfo()) {
|
if (hasVersionRequirement()) {
|
||||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
hashCode = 31 * hashCode + versionRequirement
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.constructorSignature)) {
|
if (hasExtension(JvmProtoBuf.constructorSignature)) {
|
||||||
@@ -1774,7 +1774,7 @@ fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqN
|
|||||||
return hashCode
|
return hashCode
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ProtoBuf.SinceKotlinInfo.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
fun ProtoBuf.VersionRequirement.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||||
var hashCode = 1
|
var hashCode = 1
|
||||||
|
|
||||||
if (hasVersion()) {
|
if (hasVersion()) {
|
||||||
|
|||||||
@@ -224,8 +224,8 @@ class DifferenceCalculatorForClass(
|
|||||||
ProtoBufClassKind.TYPE_TABLE -> {
|
ProtoBufClassKind.TYPE_TABLE -> {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
ProtoCompareGenerated.ProtoBufClassKind.SINCE_KOTLIN_INFO,
|
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT,
|
||||||
ProtoCompareGenerated.ProtoBufClassKind.SINCE_KOTLIN_INFO_TABLE -> {
|
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT_TABLE -> {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
ProtoBufClassKind.FLAGS,
|
ProtoBufClassKind.FLAGS,
|
||||||
@@ -281,7 +281,7 @@ class DifferenceCalculatorForPackageFacade(
|
|||||||
ProtoBufPackageKind.TYPE_ALIAS_LIST ->
|
ProtoBufPackageKind.TYPE_ALIAS_LIST ->
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getTypeAliasList))
|
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getTypeAliasList))
|
||||||
ProtoBufPackageKind.TYPE_TABLE,
|
ProtoBufPackageKind.TYPE_TABLE,
|
||||||
ProtoBufPackageKind.SINCE_KOTLIN_INFO_TABLE,
|
ProtoBufPackageKind.VERSION_REQUIREMENT_TABLE,
|
||||||
ProtoBufPackageKind.JVM_EXT_PACKAGE_MODULE_NAME,
|
ProtoBufPackageKind.JVM_EXT_PACKAGE_MODULE_NAME,
|
||||||
ProtoBufPackageKind.JS_EXT_PACKAGE_FQ_NAME-> {
|
ProtoBufPackageKind.JS_EXT_PACKAGE_FQ_NAME-> {
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -180,7 +180,7 @@ object JvmRuntimeVersionsConsistencyChecker {
|
|||||||
// The "Core" jar files should not be newer than the compiler. This behavior is reserved for the future if we realise that we're
|
// The "Core" jar files should not be newer than the compiler. This behavior is reserved for the future if we realise that we're
|
||||||
// going to break language/library compatibility in such a way that it's easier to make the old compiler just report an error
|
// going to break language/library compatibility in such a way that it's easier to make the old compiler just report an error
|
||||||
// in the case the new runtime library is specified in the classpath, rather than employing any other compatibility breakage tools
|
// in the case the new runtime library is specified in the classpath, rather than employing any other compatibility breakage tools
|
||||||
// we have at our disposal (Deprecated, SinceKotlin, SinceKotlinInfo in metadata, etc.)
|
// we have at our disposal (Deprecated, SinceKotlin, VersionRequirement in metadata, etc.)
|
||||||
if (runtimeJarsInfo.coreJars.map {
|
if (runtimeJarsInfo.coreJars.map {
|
||||||
checkNotNewerThanCompiler(messageCollector, it)
|
checkNotNewerThanCompiler(messageCollector, it)
|
||||||
}.any { it }) return ClasspathConsistency.InconsistentWithCompilerVersion
|
}.any { it }) return ClasspathConsistency.InconsistentWithCompilerVersion
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
|||||||
import org.jetbrains.kotlin.resolve.calls.tower.WrongResolutionToClassifier;
|
import org.jetbrains.kotlin.resolve.calls.tower.WrongResolutionToClassifier;
|
||||||
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker.Compatibility.Incompatible;
|
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker.Compatibility.Incompatible;
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData;
|
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData;
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfo;
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -101,8 +101,10 @@ public interface Errors {
|
|||||||
DiagnosticFactory2<PsiElement, DeclarationDescriptor, String> DEPRECATION_ERROR = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<PsiElement, DeclarationDescriptor, String> DEPRECATION_ERROR = DiagnosticFactory2.create(ERROR);
|
||||||
DiagnosticFactory3<PsiElement, TypeAliasDescriptor, DeclarationDescriptor, String> TYPEALIAS_EXPANSION_DEPRECATION = DiagnosticFactory3.create(WARNING);
|
DiagnosticFactory3<PsiElement, TypeAliasDescriptor, DeclarationDescriptor, String> TYPEALIAS_EXPANSION_DEPRECATION = DiagnosticFactory3.create(WARNING);
|
||||||
DiagnosticFactory3<PsiElement, TypeAliasDescriptor, DeclarationDescriptor, String> TYPEALIAS_EXPANSION_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
|
DiagnosticFactory3<PsiElement, TypeAliasDescriptor, DeclarationDescriptor, String> TYPEALIAS_EXPANSION_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
|
||||||
DiagnosticFactory3<PsiElement, DeclarationDescriptor, SinceKotlinInfo.Version, Pair<LanguageVersion, String>> SINCE_KOTLIN_INFO_DEPRECATION = DiagnosticFactory3.create(WARNING);
|
DiagnosticFactory3<PsiElement, DeclarationDescriptor, VersionRequirement.Version, Pair<LanguageVersion, String>>
|
||||||
DiagnosticFactory3<PsiElement, DeclarationDescriptor, SinceKotlinInfo.Version, Pair<LanguageVersion, String>> SINCE_KOTLIN_INFO_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
|
VERSION_REQUIREMENT_DEPRECATION = DiagnosticFactory3.create(WARNING);
|
||||||
|
DiagnosticFactory3<PsiElement, DeclarationDescriptor, VersionRequirement.Version, Pair<LanguageVersion, String>>
|
||||||
|
VERSION_REQUIREMENT_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory2<PsiElement, String, String> API_NOT_AVAILABLE = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<PsiElement, String, String> API_NOT_AVAILABLE = DiagnosticFactory2.create(ERROR);
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
|||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
|
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||||
import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData;
|
import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData;
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfo;
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement;
|
||||||
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
||||||
import org.jetbrains.kotlin.util.MappedExtensionProvider;
|
import org.jetbrains.kotlin.util.MappedExtensionProvider;
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||||
@@ -344,16 +344,16 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(TYPEALIAS_EXPANSION_DEPRECATION, "''{0}'' uses ''{1}'', which is deprecated. {2}", DEPRECATION_RENDERER, DEPRECATION_RENDERER, STRING);
|
MAP.put(TYPEALIAS_EXPANSION_DEPRECATION, "''{0}'' uses ''{1}'', which is deprecated. {2}", DEPRECATION_RENDERER, DEPRECATION_RENDERER, STRING);
|
||||||
MAP.put(TYPEALIAS_EXPANSION_DEPRECATION_ERROR, "''{0}'' uses ''{1}'', which is an error. {2}", DEPRECATION_RENDERER, DEPRECATION_RENDERER, STRING);
|
MAP.put(TYPEALIAS_EXPANSION_DEPRECATION_ERROR, "''{0}'' uses ''{1}'', which is an error. {2}", DEPRECATION_RENDERER, DEPRECATION_RENDERER, STRING);
|
||||||
|
|
||||||
DiagnosticParameterRenderer<Pair<LanguageVersion, String>> sinceKotlinInfoMessage = (pair, renderingContext) -> {
|
DiagnosticParameterRenderer<Pair<LanguageVersion, String>> versionRequirementMessage = (pair, renderingContext) -> {
|
||||||
String message = pair.getSecond();
|
String message = pair.getSecond();
|
||||||
return pair.getFirst().getVersionString() + (message != null ? ". " + message : "");
|
return pair.getFirst().getVersionString() + (message != null ? ". " + message : "");
|
||||||
};
|
};
|
||||||
MAP.put(SINCE_KOTLIN_INFO_DEPRECATION, "''{0}''{1} should not be used in Kotlin {2}", DEPRECATION_RENDERER,
|
MAP.put(VERSION_REQUIREMENT_DEPRECATION, "''{0}''{1} should not be used in Kotlin {2}", DEPRECATION_RENDERER,
|
||||||
(obj, renderingContext) -> obj.equals(SinceKotlinInfo.Version.INFINITY) ? "" : " is only supported since Kotlin " + obj.asString() + " and",
|
(obj, renderingContext) -> obj.equals(VersionRequirement.Version.INFINITY) ? "" : " is only supported since Kotlin " + obj.asString() + " and",
|
||||||
sinceKotlinInfoMessage);
|
versionRequirementMessage);
|
||||||
MAP.put(SINCE_KOTLIN_INFO_DEPRECATION_ERROR, "''{0}''{1} cannot be used in Kotlin {2}", DEPRECATION_RENDERER,
|
MAP.put(VERSION_REQUIREMENT_DEPRECATION_ERROR, "''{0}''{1} cannot be used in Kotlin {2}", DEPRECATION_RENDERER,
|
||||||
(obj, renderingContext) -> obj.equals(SinceKotlinInfo.Version.INFINITY) ? "" : " is only available since Kotlin " + obj.asString() + " and",
|
(obj, renderingContext) -> obj.equals(VersionRequirement.Version.INFINITY) ? "" : " is only available since Kotlin " + obj.asString() + " and",
|
||||||
sinceKotlinInfoMessage);
|
versionRequirementMessage);
|
||||||
|
|
||||||
MAP.put(API_NOT_AVAILABLE, "This declaration is only available since Kotlin {0} and cannot be used with the specified API version {1}", STRING, STRING);
|
MAP.put(API_NOT_AVAILABLE, "This declaration is only available since Kotlin {0} and cannot be used with the specified API version {1}", STRING, STRING);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.resolve.calls.checkers.shouldWarnAboutDeprecatedModF
|
|||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfo
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
@@ -99,12 +99,12 @@ private data class DeprecatedByOverridden(private val deprecations: Collection<D
|
|||||||
internal fun additionalMessage() = "Overrides deprecated member in '${DescriptorUtils.getContainingClass(target)!!.fqNameSafe.asString()}'"
|
internal fun additionalMessage() = "Overrides deprecated member in '${DescriptorUtils.getContainingClass(target)!!.fqNameSafe.asString()}'"
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class DeprecatedBySinceKotlinInfo(
|
private data class DeprecatedByVersionRequirement(
|
||||||
private val sinceKotlinInfo: SinceKotlinInfo,
|
val versionRequirement: VersionRequirement,
|
||||||
override val target: DeclarationDescriptor
|
override val target: DeclarationDescriptor
|
||||||
) : Deprecation {
|
) : Deprecation {
|
||||||
override val deprecationLevel: DeprecationLevelValue
|
override val deprecationLevel: DeprecationLevelValue
|
||||||
get() = when (sinceKotlinInfo.level) {
|
get() = when (versionRequirement.level) {
|
||||||
DeprecationLevel.WARNING -> WARNING
|
DeprecationLevel.WARNING -> WARNING
|
||||||
DeprecationLevel.ERROR -> ERROR
|
DeprecationLevel.ERROR -> ERROR
|
||||||
DeprecationLevel.HIDDEN -> HIDDEN
|
DeprecationLevel.HIDDEN -> HIDDEN
|
||||||
@@ -112,8 +112,8 @@ private data class DeprecatedBySinceKotlinInfo(
|
|||||||
|
|
||||||
override val message: String?
|
override val message: String?
|
||||||
get() {
|
get() {
|
||||||
val message = sinceKotlinInfo.message
|
val message = versionRequirement.message
|
||||||
val errorCode = sinceKotlinInfo.errorCode
|
val errorCode = versionRequirement.errorCode
|
||||||
if (message == null && errorCode == null) return null
|
if (message == null && errorCode == null) return null
|
||||||
|
|
||||||
return buildString {
|
return buildString {
|
||||||
@@ -128,9 +128,6 @@ private data class DeprecatedBySinceKotlinInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val sinceKotlinVersion: SinceKotlinInfo.Version
|
|
||||||
get() = sinceKotlinInfo.version
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class DeprecatedTypealiasByAnnotation(
|
private data class DeprecatedTypealiasByAnnotation(
|
||||||
@@ -152,12 +149,12 @@ internal fun createDeprecationDiagnostic(
|
|||||||
): Diagnostic {
|
): Diagnostic {
|
||||||
val targetOriginal = deprecation.target.original
|
val targetOriginal = deprecation.target.original
|
||||||
return when (deprecation) {
|
return when (deprecation) {
|
||||||
is DeprecatedBySinceKotlinInfo -> {
|
is DeprecatedByVersionRequirement -> {
|
||||||
val factory = when (deprecation.deprecationLevel) {
|
val factory = when (deprecation.deprecationLevel) {
|
||||||
WARNING -> Errors.SINCE_KOTLIN_INFO_DEPRECATION
|
WARNING -> Errors.VERSION_REQUIREMENT_DEPRECATION
|
||||||
ERROR, HIDDEN -> Errors.SINCE_KOTLIN_INFO_DEPRECATION_ERROR
|
ERROR, HIDDEN -> Errors.VERSION_REQUIREMENT_DEPRECATION_ERROR
|
||||||
}
|
}
|
||||||
factory.on(element, targetOriginal, deprecation.sinceKotlinVersion,
|
factory.on(element, targetOriginal, deprecation.versionRequirement.version,
|
||||||
languageVersionSettings.languageVersion to deprecation.message)
|
languageVersionSettings.languageVersion to deprecation.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,15 +286,15 @@ class DeprecationResolver(
|
|||||||
result.add(deprecation)
|
result.add(deprecation)
|
||||||
}
|
}
|
||||||
|
|
||||||
val sinceKotlinInfo =
|
val versionRequirement =
|
||||||
(target as? DeserializedMemberDescriptor)?.sinceKotlinInfo
|
(target as? DeserializedMemberDescriptor)?.versionRequirement
|
||||||
?: (target as? DeserializedClassDescriptor)?.sinceKotlinInfo
|
?: (target as? DeserializedClassDescriptor)?.versionRequirement
|
||||||
if (sinceKotlinInfo != null) {
|
if (versionRequirement != null) {
|
||||||
// We're using ApiVersion because it's convenient to compare versions, "-api-version" is not involved in any way
|
// We're using ApiVersion because it's convenient to compare versions, "-api-version" is not involved in any way
|
||||||
// TODO: usage of ApiVersion is confusing here, refactor
|
// TODO: usage of ApiVersion is confusing here, refactor
|
||||||
if (ApiVersion.createBySinceKotlinInfo(sinceKotlinInfo) >
|
if (ApiVersion.createByVersionRequirement(versionRequirement) >
|
||||||
ApiVersion.createByLanguageVersion(languageVersionSettings.languageVersion)) {
|
ApiVersion.createByLanguageVersion(languageVersionSettings.languageVersion)) {
|
||||||
result.add(DeprecatedBySinceKotlinInfo(sinceKotlinInfo, target))
|
result.add(DeprecatedByVersionRequirement(versionRequirement, target))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-19
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry
|
import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry
|
||||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||||
import org.jetbrains.kotlin.resolve.constants.NullValue
|
import org.jetbrains.kotlin.resolve.constants.NullValue
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfo
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||||
import org.jetbrains.kotlin.utils.Interner
|
import org.jetbrains.kotlin.utils.Interner
|
||||||
@@ -41,7 +41,7 @@ class DescriptorSerializer private constructor(
|
|||||||
private val typeParameters: Interner<TypeParameterDescriptor>,
|
private val typeParameters: Interner<TypeParameterDescriptor>,
|
||||||
private val extension: SerializerExtension,
|
private val extension: SerializerExtension,
|
||||||
private val typeTable: MutableTypeTable,
|
private val typeTable: MutableTypeTable,
|
||||||
private val sinceKotlinInfoTable: MutableSinceKotlinInfoTable,
|
private val versionRequirementTable: MutableVersionRequirementTable,
|
||||||
private val serializeTypeTableToFunction: Boolean
|
private val serializeTypeTableToFunction: Boolean
|
||||||
) {
|
) {
|
||||||
fun serialize(message: MessageLite): ByteArray {
|
fun serialize(message: MessageLite): ByteArray {
|
||||||
@@ -52,7 +52,7 @@ class DescriptorSerializer private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createChildSerializer(descriptor: DeclarationDescriptor): DescriptorSerializer =
|
private fun createChildSerializer(descriptor: DeclarationDescriptor): DescriptorSerializer =
|
||||||
DescriptorSerializer(descriptor, Interner(typeParameters), extension, typeTable, sinceKotlinInfoTable,
|
DescriptorSerializer(descriptor, Interner(typeParameters), extension, typeTable, versionRequirementTable,
|
||||||
serializeTypeTableToFunction = false)
|
serializeTypeTableToFunction = false)
|
||||||
|
|
||||||
val stringTable: StringTable
|
val stringTable: StringTable
|
||||||
@@ -134,9 +134,9 @@ class DescriptorSerializer private constructor(
|
|||||||
builder.typeTable = typeTableProto
|
builder.typeTable = typeTableProto
|
||||||
}
|
}
|
||||||
|
|
||||||
val sinceKotlinInfoProto = sinceKotlinInfoTable.serialize()
|
val versionRequirementTableProto = versionRequirementTable.serialize()
|
||||||
if (sinceKotlinInfoProto != null) {
|
if (versionRequirementTableProto != null) {
|
||||||
builder.sinceKotlinInfoTable = sinceKotlinInfoProto
|
builder.versionRequirementTable = versionRequirementTableProto
|
||||||
}
|
}
|
||||||
|
|
||||||
extension.serializeClass(classDescriptor, builder)
|
extension.serializeClass(classDescriptor, builder)
|
||||||
@@ -217,7 +217,7 @@ class DescriptorSerializer private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
||||||
builder.sinceKotlinInfo = writeSinceKotlinInfo(LanguageFeature.Coroutines)
|
builder.versionRequirement = writeVersionRequirement(LanguageFeature.Coroutines)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension.serializeProperty(descriptor, builder)
|
extension.serializeProperty(descriptor, builder)
|
||||||
@@ -274,7 +274,7 @@ class DescriptorSerializer private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
||||||
builder.sinceKotlinInfo = writeSinceKotlinInfo(LanguageFeature.Coroutines)
|
builder.versionRequirement = writeVersionRequirement(LanguageFeature.Coroutines)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension.serializeFunction(descriptor, builder)
|
extension.serializeFunction(descriptor, builder)
|
||||||
@@ -297,7 +297,7 @@ class DescriptorSerializer private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
||||||
builder.sinceKotlinInfo = writeSinceKotlinInfo(LanguageFeature.Coroutines)
|
builder.versionRequirement = writeVersionRequirement(LanguageFeature.Coroutines)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension.serializeConstructor(descriptor, builder)
|
extension.serializeConstructor(descriptor, builder)
|
||||||
@@ -557,9 +557,9 @@ class DescriptorSerializer private constructor(
|
|||||||
builder.typeTable = typeTableProto
|
builder.typeTable = typeTableProto
|
||||||
}
|
}
|
||||||
|
|
||||||
val sinceKotlinInfoProto = sinceKotlinInfoTable.serialize()
|
val versionRequirementTableProto = versionRequirementTable.serialize()
|
||||||
if (sinceKotlinInfoProto != null) {
|
if (versionRequirementTableProto != null) {
|
||||||
builder.sinceKotlinInfoTable = sinceKotlinInfoProto
|
builder.versionRequirementTable = versionRequirementTableProto
|
||||||
}
|
}
|
||||||
|
|
||||||
extension.serializePackage(packageFqName, builder)
|
extension.serializePackage(packageFqName, builder)
|
||||||
@@ -567,15 +567,15 @@ class DescriptorSerializer private constructor(
|
|||||||
return builder
|
return builder
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun writeSinceKotlinInfo(languageFeature: LanguageFeature): Int {
|
private fun writeVersionRequirement(languageFeature: LanguageFeature): Int {
|
||||||
val languageVersion = languageFeature.sinceVersion!!
|
val languageVersion = languageFeature.sinceVersion!!
|
||||||
val sinceKotlinInfo = ProtoBuf.SinceKotlinInfo.newBuilder().apply {
|
val requirement = ProtoBuf.VersionRequirement.newBuilder().apply {
|
||||||
SinceKotlinInfo.Version(languageVersion.major, languageVersion.minor).encode(
|
VersionRequirement.Version(languageVersion.major, languageVersion.minor).encode(
|
||||||
writeVersion = { version = it },
|
writeVersion = { version = it },
|
||||||
writeVersionFull = { versionFull = it }
|
writeVersionFull = { versionFull = it }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return sinceKotlinInfoTable[sinceKotlinInfo]
|
return versionRequirementTable[requirement]
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getClassifierId(descriptor: ClassifierDescriptorWithTypeParameters): Int =
|
private fun getClassifierId(descriptor: ClassifierDescriptorWithTypeParameters): Int =
|
||||||
@@ -590,13 +590,13 @@ class DescriptorSerializer private constructor(
|
|||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun createTopLevel(extension: SerializerExtension): DescriptorSerializer {
|
fun createTopLevel(extension: SerializerExtension): DescriptorSerializer {
|
||||||
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableSinceKotlinInfoTable(),
|
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableVersionRequirementTable(),
|
||||||
serializeTypeTableToFunction = false)
|
serializeTypeTableToFunction = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun createForLambda(extension: SerializerExtension): DescriptorSerializer {
|
fun createForLambda(extension: SerializerExtension): DescriptorSerializer {
|
||||||
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableSinceKotlinInfoTable(),
|
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableVersionRequirementTable(),
|
||||||
serializeTypeTableToFunction = true)
|
serializeTypeTableToFunction = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,7 +616,7 @@ class DescriptorSerializer private constructor(
|
|||||||
Interner(parentSerializer.typeParameters),
|
Interner(parentSerializer.typeParameters),
|
||||||
parentSerializer.extension,
|
parentSerializer.extension,
|
||||||
MutableTypeTable(),
|
MutableTypeTable(),
|
||||||
MutableSinceKotlinInfoTable(),
|
MutableVersionRequirementTable(),
|
||||||
serializeTypeTableToFunction = false
|
serializeTypeTableToFunction = false
|
||||||
)
|
)
|
||||||
for (typeParameter in descriptor.declaredTypeParameters) {
|
for (typeParameter in descriptor.declaredTypeParameters) {
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ class MutableTypeTable : MutableTable<ProtoBuf.Type.Builder, ProtoBuf.TypeTable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MutableSinceKotlinInfoTable : MutableTable<ProtoBuf.SinceKotlinInfo.Builder, ProtoBuf.SinceKotlinInfoTable, ProtoBuf.SinceKotlinInfoTable.Builder>() {
|
class MutableVersionRequirementTable : MutableTable<ProtoBuf.VersionRequirement.Builder, ProtoBuf.VersionRequirementTable, ProtoBuf.VersionRequirementTable.Builder>() {
|
||||||
override fun createTableBuilder(): ProtoBuf.SinceKotlinInfoTable.Builder = ProtoBuf.SinceKotlinInfoTable.newBuilder()
|
override fun createTableBuilder(): ProtoBuf.VersionRequirementTable.Builder = ProtoBuf.VersionRequirementTable.newBuilder()
|
||||||
|
|
||||||
override fun addElement(builder: ProtoBuf.SinceKotlinInfoTable.Builder, element: ProtoBuf.SinceKotlinInfo.Builder) {
|
override fun addElement(builder: ProtoBuf.VersionRequirementTable.Builder, element: ProtoBuf.VersionRequirement.Builder) {
|
||||||
builder.addInfo(element)
|
builder.addRequirement(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-12
@@ -22,24 +22,22 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
|
||||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil
|
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||||
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
|
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfo
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
|
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
|
||||||
import org.jetbrains.kotlin.test.TestJdkKind
|
import org.jetbrains.kotlin.test.TestJdkKind
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class SinceKotlinInfoTest : TestCaseWithTmpdir() {
|
class VersionRequirementTest : TestCaseWithTmpdir() {
|
||||||
fun doTest(
|
fun doTest(
|
||||||
fileName: String,
|
fileName: String,
|
||||||
expectedSinceKotlinInfoVersion: SinceKotlinInfo.Version,
|
expectedVersionRequirement: VersionRequirement.Version,
|
||||||
expectedLevel: DeprecationLevel,
|
expectedLevel: DeprecationLevel,
|
||||||
expectedMessage: String?,
|
expectedMessage: String?,
|
||||||
expectedErrorCode: Int?,
|
expectedErrorCode: Int?,
|
||||||
@@ -63,12 +61,12 @@ class SinceKotlinInfoTest : TestCaseWithTmpdir() {
|
|||||||
throw AssertionError("Not a deserialized descriptor: $descriptor")
|
throw AssertionError("Not a deserialized descriptor: $descriptor")
|
||||||
}
|
}
|
||||||
|
|
||||||
val sinceKotlinInfo = descriptor.sinceKotlinInfo ?: throw AssertionError("No SinceKotlinInfo for $descriptor")
|
val requirement = descriptor.versionRequirement ?: throw AssertionError("No VersionRequirement for $descriptor")
|
||||||
|
|
||||||
assertEquals(expectedSinceKotlinInfoVersion, sinceKotlinInfo.version)
|
assertEquals(expectedVersionRequirement, requirement.version)
|
||||||
assertEquals(expectedLevel, sinceKotlinInfo.level)
|
assertEquals(expectedLevel, requirement.level)
|
||||||
assertEquals(expectedMessage, sinceKotlinInfo.message)
|
assertEquals(expectedMessage, requirement.message)
|
||||||
assertEquals(expectedErrorCode, sinceKotlinInfo.errorCode)
|
assertEquals(expectedErrorCode, requirement.errorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (fqName in fqNames) {
|
for (fqName in fqNames) {
|
||||||
@@ -98,8 +96,8 @@ class SinceKotlinInfoTest : TestCaseWithTmpdir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testSuspendFun() {
|
fun testSuspendFun() {
|
||||||
doTest("compiler/testData/sinceKotlinInfo/suspendFun.kt",
|
doTest("compiler/testData/versionRequirement/suspendFun.kt",
|
||||||
SinceKotlinInfo.Version(1, 1), DeprecationLevel.ERROR, null, null,
|
VersionRequirement.Version(1, 1), DeprecationLevel.ERROR, null, null,
|
||||||
"test.topLevel",
|
"test.topLevel",
|
||||||
"test.Foo.member",
|
"test.Foo.member",
|
||||||
"test.Foo.<init>",
|
"test.Foo.<init>",
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.config
|
package org.jetbrains.kotlin.config
|
||||||
|
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfo
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement
|
||||||
import org.jetbrains.kotlin.utils.DescriptionAware
|
import org.jetbrains.kotlin.utils.DescriptionAware
|
||||||
|
|
||||||
class ApiVersion private constructor(
|
class ApiVersion private constructor(
|
||||||
@@ -60,8 +60,8 @@ class ApiVersion private constructor(
|
|||||||
fun createByLanguageVersion(version: LanguageVersion): ApiVersion = parse(version.versionString)!!
|
fun createByLanguageVersion(version: LanguageVersion): ApiVersion = parse(version.versionString)!!
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun createBySinceKotlinInfo(sinceKotlinInfo: SinceKotlinInfo): ApiVersion =
|
fun createByVersionRequirement(versionRequirement: VersionRequirement): ApiVersion =
|
||||||
sinceKotlinInfo.version.let { version -> parse(version.asString()) ?: error("Could not parse version: $version") }
|
versionRequirement.version.let { version -> parse(version.asString()) ?: error("Could not parse version: $version") }
|
||||||
|
|
||||||
fun parse(versionString: String): ApiVersion? = try {
|
fun parse(versionString: String): ApiVersion? = try {
|
||||||
ApiVersion(MavenComparableVersion(versionString), versionString)
|
ApiVersion(MavenComparableVersion(versionString), versionString)
|
||||||
|
|||||||
@@ -211,10 +211,10 @@ message Class {
|
|||||||
|
|
||||||
optional TypeTable type_table = 30;
|
optional TypeTable type_table = 30;
|
||||||
|
|
||||||
// Index into the SinceKotlinInfoTable
|
// Index into the VersionRequirementTable
|
||||||
optional int32 sinceKotlinInfo = 31;
|
optional int32 version_requirement = 31;
|
||||||
|
|
||||||
optional SinceKotlinInfoTable since_kotlin_info_table = 32;
|
optional VersionRequirementTable version_requirement_table = 32;
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ message Package {
|
|||||||
|
|
||||||
optional TypeTable type_table = 30;
|
optional TypeTable type_table = 30;
|
||||||
|
|
||||||
optional SinceKotlinInfoTable since_kotlin_info_table = 32;
|
optional VersionRequirementTable version_requirement_table = 32;
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
@@ -249,8 +249,8 @@ message Constructor {
|
|||||||
|
|
||||||
repeated ValueParameter value_parameter = 2;
|
repeated ValueParameter value_parameter = 2;
|
||||||
|
|
||||||
// Index into the SinceKotlinInfoTable
|
// Index into the VersionRequirementTable
|
||||||
optional int32 sinceKotlinInfo = 31;
|
optional int32 version_requirement = 31;
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
@@ -286,8 +286,8 @@ message Function {
|
|||||||
|
|
||||||
optional TypeTable type_table = 30;
|
optional TypeTable type_table = 30;
|
||||||
|
|
||||||
// Index into the SinceKotlinInfoTable
|
// Index into the VersionRequirementTable
|
||||||
optional int32 sinceKotlinInfo = 31;
|
optional int32 version_requirement = 31;
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
@@ -334,8 +334,8 @@ message Property {
|
|||||||
optional int32 getter_flags = 7 /* absent => same as property */;
|
optional int32 getter_flags = 7 /* absent => same as property */;
|
||||||
optional int32 setter_flags = 8 /* absent => same as property */;
|
optional int32 setter_flags = 8 /* absent => same as property */;
|
||||||
|
|
||||||
// Index into the SinceKotlinInfoTable
|
// Index into the VersionRequirementTable
|
||||||
optional int32 sinceKotlinInfo = 31;
|
optional int32 version_requirement = 31;
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
@@ -379,8 +379,8 @@ message TypeAlias {
|
|||||||
|
|
||||||
repeated Annotation annotation = 8;
|
repeated Annotation annotation = 8;
|
||||||
|
|
||||||
// Index into the SinceKotlinInfoTable
|
// Index into the VersionRequirementTable
|
||||||
optional int32 sinceKotlinInfo = 31;
|
optional int32 version_requirement = 31;
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ enum MemberKind {
|
|||||||
SYNTHESIZED = 3;
|
SYNTHESIZED = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SinceKotlinInfo {
|
message VersionRequirement {
|
||||||
enum Level {
|
enum Level {
|
||||||
WARNING = 0;
|
WARNING = 0;
|
||||||
ERROR = 1;
|
ERROR = 1;
|
||||||
@@ -443,8 +443,8 @@ message SinceKotlinInfo {
|
|||||||
optional int32 message = 5 [(string_id_in_table) = true];
|
optional int32 message = 5 [(string_id_in_table) = true];
|
||||||
}
|
}
|
||||||
|
|
||||||
message SinceKotlinInfoTable {
|
message VersionRequirementTable {
|
||||||
repeated SinceKotlinInfo info = 1;
|
repeated VersionRequirement requirement = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A part of the package, which is used to serialize .kjsm/.meta.js, .kotlin_builtins and .kotlin_metadata files.
|
// A part of the package, which is used to serialize .kjsm/.meta.js, .kotlin_builtins and .kotlin_metadata files.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.serialization.ClassDataWithSource
|
import org.jetbrains.kotlin.serialization.ClassDataWithSource
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfoTable
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
||||||
|
|
||||||
class ClassDeserializer(private val components: DeserializationComponents) {
|
class ClassDeserializer(private val components: DeserializationComponents) {
|
||||||
private val classes: (ClassKey) -> ClassDescriptor? =
|
private val classes: (ClassKey) -> ClassDescriptor? =
|
||||||
@@ -61,7 +61,7 @@ class ClassDeserializer(private val components: DeserializationComponents) {
|
|||||||
components.createContext(
|
components.createContext(
|
||||||
fragment, nameResolver,
|
fragment, nameResolver,
|
||||||
TypeTable(classProto.typeTable),
|
TypeTable(classProto.typeTable),
|
||||||
SinceKotlinInfoTable.create(classProto.sinceKotlinInfoTable),
|
VersionRequirementTable.create(classProto.versionRequirementTable),
|
||||||
containerSource = null
|
containerSource = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -51,7 +51,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
proto,
|
proto,
|
||||||
c.nameResolver,
|
c.nameResolver,
|
||||||
c.typeTable,
|
c.typeTable,
|
||||||
c.sinceKotlinInfoTable,
|
c.versionRequirementTable,
|
||||||
c.containerSource
|
c.containerSource
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
else Annotations.EMPTY
|
else Annotations.EMPTY
|
||||||
val function = DeserializedSimpleFunctionDescriptor(
|
val function = DeserializedSimpleFunctionDescriptor(
|
||||||
c.containingDeclaration, /* original = */ null, annotations, c.nameResolver.getName(proto.name),
|
c.containingDeclaration, /* original = */ null, annotations, c.nameResolver.getName(proto.name),
|
||||||
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.sinceKotlinInfoTable,
|
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.versionRequirementTable,
|
||||||
c.containerSource
|
c.containerSource
|
||||||
)
|
)
|
||||||
val local = c.childContext(function, proto.typeParameterList)
|
val local = c.childContext(function, proto.typeParameterList)
|
||||||
@@ -187,7 +187,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
val visibility = Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
|
val visibility = Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
|
||||||
val typeAlias = DeserializedTypeAliasDescriptor(
|
val typeAlias = DeserializedTypeAliasDescriptor(
|
||||||
c.storageManager, c.containingDeclaration, annotations, c.nameResolver.getName(proto.name),
|
c.storageManager, c.containingDeclaration, annotations, c.nameResolver.getName(proto.name),
|
||||||
visibility, proto, c.nameResolver, c.typeTable, c.sinceKotlinInfoTable, c.containerSource
|
visibility, proto, c.nameResolver, c.typeTable, c.versionRequirementTable, c.containerSource
|
||||||
)
|
)
|
||||||
|
|
||||||
val local = c.childContext(typeAlias, proto.typeParameterList)
|
val local = c.childContext(typeAlias, proto.typeParameterList)
|
||||||
@@ -208,7 +208,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
val classDescriptor = c.containingDeclaration as ClassDescriptor
|
val classDescriptor = c.containingDeclaration as ClassDescriptor
|
||||||
val descriptor = DeserializedClassConstructorDescriptor(
|
val descriptor = DeserializedClassConstructorDescriptor(
|
||||||
classDescriptor, null, getAnnotations(proto, proto.flags, AnnotatedCallableKind.FUNCTION),
|
classDescriptor, null, getAnnotations(proto, proto.flags, AnnotatedCallableKind.FUNCTION),
|
||||||
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.sinceKotlinInfoTable,
|
isPrimary, CallableMemberDescriptor.Kind.DECLARATION, proto, c.nameResolver, c.typeTable, c.versionRequirementTable,
|
||||||
c.containerSource
|
c.containerSource
|
||||||
)
|
)
|
||||||
val local = c.childContext(descriptor, listOf())
|
val local = c.childContext(descriptor, listOf())
|
||||||
|
|||||||
+5
-5
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.name.ClassId
|
|||||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfoTable
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
|
|
||||||
class DeserializationComponents(
|
class DeserializationComponents(
|
||||||
@@ -54,10 +54,10 @@ class DeserializationComponents(
|
|||||||
descriptor: PackageFragmentDescriptor,
|
descriptor: PackageFragmentDescriptor,
|
||||||
nameResolver: NameResolver,
|
nameResolver: NameResolver,
|
||||||
typeTable: TypeTable,
|
typeTable: TypeTable,
|
||||||
sinceKotlinInfoTable: SinceKotlinInfoTable,
|
versionRequirementTable: VersionRequirementTable,
|
||||||
containerSource: DeserializedContainerSource?
|
containerSource: DeserializedContainerSource?
|
||||||
): DeserializationContext =
|
): DeserializationContext =
|
||||||
DeserializationContext(this, nameResolver, descriptor, typeTable, sinceKotlinInfoTable, containerSource,
|
DeserializationContext(this, nameResolver, descriptor, typeTable, versionRequirementTable, containerSource,
|
||||||
parentTypeDeserializer = null, typeParameters = listOf())
|
parentTypeDeserializer = null, typeParameters = listOf())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ class DeserializationContext(
|
|||||||
val nameResolver: NameResolver,
|
val nameResolver: NameResolver,
|
||||||
val containingDeclaration: DeclarationDescriptor,
|
val containingDeclaration: DeclarationDescriptor,
|
||||||
val typeTable: TypeTable,
|
val typeTable: TypeTable,
|
||||||
val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
val versionRequirementTable: VersionRequirementTable,
|
||||||
val containerSource: DeserializedContainerSource?,
|
val containerSource: DeserializedContainerSource?,
|
||||||
parentTypeDeserializer: TypeDeserializer?,
|
parentTypeDeserializer: TypeDeserializer?,
|
||||||
typeParameters: List<ProtoBuf.TypeParameter>
|
typeParameters: List<ProtoBuf.TypeParameter>
|
||||||
@@ -85,7 +85,7 @@ class DeserializationContext(
|
|||||||
nameResolver: NameResolver = this.nameResolver,
|
nameResolver: NameResolver = this.nameResolver,
|
||||||
typeTable: TypeTable = this.typeTable
|
typeTable: TypeTable = this.typeTable
|
||||||
) = DeserializationContext(
|
) = DeserializationContext(
|
||||||
components, nameResolver, descriptor, typeTable, sinceKotlinInfoTable, this.containerSource,
|
components, nameResolver, descriptor, typeTable, versionRequirementTable, this.containerSource,
|
||||||
parentTypeDeserializer = this.typeDeserializer, typeParameters = typeParameterProtos
|
parentTypeDeserializer = this.typeDeserializer, typeParameters = typeParameterProtos
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -73,8 +73,8 @@ class DeserializedClassDescriptor(
|
|||||||
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
|
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
|
||||||
)
|
)
|
||||||
|
|
||||||
val sinceKotlinInfo: SinceKotlinInfo?
|
val versionRequirement: VersionRequirement?
|
||||||
get() = SinceKotlinInfo.create(classProto, c.nameResolver, c.sinceKotlinInfoTable)
|
get() = VersionRequirement.create(classProto, c.nameResolver, c.versionRequirementTable)
|
||||||
|
|
||||||
override val annotations =
|
override val annotations =
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
||||||
|
|||||||
+11
-11
@@ -36,10 +36,10 @@ interface DeserializedMemberDescriptor : MemberDescriptor {
|
|||||||
|
|
||||||
val typeTable: TypeTable
|
val typeTable: TypeTable
|
||||||
|
|
||||||
val sinceKotlinInfoTable: SinceKotlinInfoTable
|
val versionRequirementTable: VersionRequirementTable
|
||||||
|
|
||||||
val sinceKotlinInfo: SinceKotlinInfo?
|
val versionRequirement: VersionRequirement?
|
||||||
get() = SinceKotlinInfo.create(proto, nameResolver, sinceKotlinInfoTable)
|
get() = VersionRequirement.create(proto, nameResolver, versionRequirementTable)
|
||||||
|
|
||||||
// Information about the origin of this callable's container (class or package part on JVM) or null if there's no such information.
|
// Information about the origin of this callable's container (class or package part on JVM) or null if there's no such information.
|
||||||
// TODO: merge with sourceElement of containingDeclaration
|
// TODO: merge with sourceElement of containingDeclaration
|
||||||
@@ -68,7 +68,7 @@ class DeserializedSimpleFunctionDescriptor(
|
|||||||
override val proto: ProtoBuf.Function,
|
override val proto: ProtoBuf.Function,
|
||||||
override val nameResolver: NameResolver,
|
override val nameResolver: NameResolver,
|
||||||
override val typeTable: TypeTable,
|
override val typeTable: TypeTable,
|
||||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
override val versionRequirementTable: VersionRequirementTable,
|
||||||
override val containerSource: DeserializedContainerSource?,
|
override val containerSource: DeserializedContainerSource?,
|
||||||
source: SourceElement? = null
|
source: SourceElement? = null
|
||||||
) : DeserializedCallableMemberDescriptor,
|
) : DeserializedCallableMemberDescriptor,
|
||||||
@@ -86,7 +86,7 @@ class DeserializedSimpleFunctionDescriptor(
|
|||||||
): FunctionDescriptorImpl {
|
): FunctionDescriptorImpl {
|
||||||
return DeserializedSimpleFunctionDescriptor(
|
return DeserializedSimpleFunctionDescriptor(
|
||||||
newOwner, original as SimpleFunctionDescriptor?, annotations, newName ?: name, kind,
|
newOwner, original as SimpleFunctionDescriptor?, annotations, newName ?: name, kind,
|
||||||
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource, source
|
proto, nameResolver, typeTable, versionRequirementTable, containerSource, source
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
override val proto: ProtoBuf.Property,
|
override val proto: ProtoBuf.Property,
|
||||||
override val nameResolver: NameResolver,
|
override val nameResolver: NameResolver,
|
||||||
override val typeTable: TypeTable,
|
override val typeTable: TypeTable,
|
||||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
override val versionRequirementTable: VersionRequirementTable,
|
||||||
override val containerSource: DeserializedContainerSource?
|
override val containerSource: DeserializedContainerSource?
|
||||||
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
||||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
||||||
@@ -124,7 +124,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
): PropertyDescriptorImpl {
|
): PropertyDescriptorImpl {
|
||||||
return DeserializedPropertyDescriptor(
|
return DeserializedPropertyDescriptor(
|
||||||
newOwner, original, annotations, newModality, newVisibility, isVar, newName, kind, isLateInit, isConst, isExternal,
|
newOwner, original, annotations, newModality, newVisibility, isVar, newName, kind, isLateInit, isConst, isExternal,
|
||||||
@Suppress("DEPRECATION") isDelegated, isExpect, proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
@Suppress("DEPRECATION") isDelegated, isExpect, proto, nameResolver, typeTable, versionRequirementTable, containerSource
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ class DeserializedClassConstructorDescriptor(
|
|||||||
override val proto: ProtoBuf.Constructor,
|
override val proto: ProtoBuf.Constructor,
|
||||||
override val nameResolver: NameResolver,
|
override val nameResolver: NameResolver,
|
||||||
override val typeTable: TypeTable,
|
override val typeTable: TypeTable,
|
||||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
override val versionRequirementTable: VersionRequirementTable,
|
||||||
override val containerSource: DeserializedContainerSource?,
|
override val containerSource: DeserializedContainerSource?,
|
||||||
source: SourceElement? = null
|
source: SourceElement? = null
|
||||||
) : DeserializedCallableMemberDescriptor,
|
) : DeserializedCallableMemberDescriptor,
|
||||||
@@ -156,7 +156,7 @@ class DeserializedClassConstructorDescriptor(
|
|||||||
): DeserializedClassConstructorDescriptor {
|
): DeserializedClassConstructorDescriptor {
|
||||||
return DeserializedClassConstructorDescriptor(
|
return DeserializedClassConstructorDescriptor(
|
||||||
newOwner as ClassDescriptor, original as ConstructorDescriptor?, annotations, isPrimary, kind,
|
newOwner as ClassDescriptor, original as ConstructorDescriptor?, annotations, isPrimary, kind,
|
||||||
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource, source
|
proto, nameResolver, typeTable, versionRequirementTable, containerSource, source
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ class DeserializedTypeAliasDescriptor(
|
|||||||
override val proto: ProtoBuf.TypeAlias,
|
override val proto: ProtoBuf.TypeAlias,
|
||||||
override val nameResolver: NameResolver,
|
override val nameResolver: NameResolver,
|
||||||
override val typeTable: TypeTable,
|
override val typeTable: TypeTable,
|
||||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
override val versionRequirementTable: VersionRequirementTable,
|
||||||
override val containerSource: DeserializedContainerSource?
|
override val containerSource: DeserializedContainerSource?
|
||||||
) : AbstractTypeAliasDescriptor(containingDeclaration, annotations, name, SourceElement.NO_SOURCE, visibility),
|
) : AbstractTypeAliasDescriptor(containingDeclaration, annotations, name, SourceElement.NO_SOURCE, visibility),
|
||||||
DeserializedMemberDescriptor {
|
DeserializedMemberDescriptor {
|
||||||
@@ -219,7 +219,7 @@ class DeserializedTypeAliasDescriptor(
|
|||||||
proto,
|
proto,
|
||||||
nameResolver,
|
nameResolver,
|
||||||
typeTable,
|
typeTable,
|
||||||
sinceKotlinInfoTable,
|
versionRequirementTable,
|
||||||
containerSource
|
containerSource
|
||||||
)
|
)
|
||||||
substituted.initialize(declaredTypeParameters,
|
substituted.initialize(declaredTypeParameters,
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ open class DeserializedPackageMemberScope(
|
|||||||
classNames: () -> Collection<Name>
|
classNames: () -> Collection<Name>
|
||||||
) : DeserializedMemberScope(
|
) : DeserializedMemberScope(
|
||||||
components.createContext(packageDescriptor, nameResolver, TypeTable(proto.typeTable),
|
components.createContext(packageDescriptor, nameResolver, TypeTable(proto.typeTable),
|
||||||
SinceKotlinInfoTable.create(proto.sinceKotlinInfoTable), containerSource),
|
VersionRequirementTable.create(proto.versionRequirementTable), containerSource),
|
||||||
proto.functionList, proto.propertyList, proto.typeAliasList, classNames
|
proto.functionList, proto.propertyList, proto.typeAliasList, classNames
|
||||||
) {
|
) {
|
||||||
private val packageFqName = packageDescriptor.fqName
|
private val packageFqName = packageDescriptor.fqName
|
||||||
|
|||||||
+16
-16
@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.protobuf.MessageLite
|
|||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||||
|
|
||||||
class SinceKotlinInfoTable private constructor(private val infos: List<ProtoBuf.SinceKotlinInfo>) {
|
class VersionRequirementTable private constructor(private val infos: List<ProtoBuf.VersionRequirement>) {
|
||||||
operator fun get(id: Int): ProtoBuf.SinceKotlinInfo? = infos.getOrNull(id)
|
operator fun get(id: Int): ProtoBuf.VersionRequirement? = infos.getOrNull(id)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val EMPTY = SinceKotlinInfoTable(emptyList())
|
val EMPTY = VersionRequirementTable(emptyList())
|
||||||
|
|
||||||
fun create(table: ProtoBuf.SinceKotlinInfoTable): SinceKotlinInfoTable =
|
fun create(table: ProtoBuf.VersionRequirementTable): VersionRequirementTable =
|
||||||
if (table.infoCount == 0) EMPTY else SinceKotlinInfoTable(table.infoList)
|
if (table.requirementCount == 0) EMPTY else VersionRequirementTable(table.requirementList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SinceKotlinInfo(
|
class VersionRequirement(
|
||||||
val version: Version,
|
val version: Version,
|
||||||
val level: DeprecationLevel,
|
val level: DeprecationLevel,
|
||||||
val errorCode: Int?,
|
val errorCode: Int?,
|
||||||
@@ -90,13 +90,13 @@ class SinceKotlinInfo(
|
|||||||
"since $version $level" + (if (errorCode != null) " error $errorCode" else "") + (if (message != null) ": $message" else "")
|
"since $version $level" + (if (errorCode != null) " error $errorCode" else "") + (if (message != null) ": $message" else "")
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun create(proto: MessageLite, nameResolver: NameResolver, table: SinceKotlinInfoTable): SinceKotlinInfo? {
|
fun create(proto: MessageLite, nameResolver: NameResolver, table: VersionRequirementTable): VersionRequirement? {
|
||||||
val id = when (proto) {
|
val id = when (proto) {
|
||||||
is ProtoBuf.Class -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
is ProtoBuf.Class -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||||
is ProtoBuf.Constructor -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
is ProtoBuf.Constructor -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||||
is ProtoBuf.Function -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
is ProtoBuf.Function -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||||
is ProtoBuf.Property -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
is ProtoBuf.Property -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||||
is ProtoBuf.TypeAlias -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
is ProtoBuf.TypeAlias -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||||
else -> throw IllegalStateException("Unexpected declaration: ${proto::class.java}")
|
else -> throw IllegalStateException("Unexpected declaration: ${proto::class.java}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,16 +108,16 @@ class SinceKotlinInfo(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val level = when (info.level!!) {
|
val level = when (info.level!!) {
|
||||||
ProtoBuf.SinceKotlinInfo.Level.WARNING -> DeprecationLevel.WARNING
|
ProtoBuf.VersionRequirement.Level.WARNING -> DeprecationLevel.WARNING
|
||||||
ProtoBuf.SinceKotlinInfo.Level.ERROR -> DeprecationLevel.ERROR
|
ProtoBuf.VersionRequirement.Level.ERROR -> DeprecationLevel.ERROR
|
||||||
ProtoBuf.SinceKotlinInfo.Level.HIDDEN -> DeprecationLevel.HIDDEN
|
ProtoBuf.VersionRequirement.Level.HIDDEN -> DeprecationLevel.HIDDEN
|
||||||
}
|
}
|
||||||
|
|
||||||
val errorCode = if (info.hasErrorCode()) info.errorCode else null
|
val errorCode = if (info.hasErrorCode()) info.errorCode else null
|
||||||
|
|
||||||
val message = if (info.hasMessage()) nameResolver.getString(info.message) else null
|
val message = if (info.hasMessage()) nameResolver.getString(info.message) else null
|
||||||
|
|
||||||
return SinceKotlinInfo(version, level, errorCode, message)
|
return VersionRequirement(version, level, errorCode, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.MemberDeserializer
|
import org.jetbrains.kotlin.serialization.deserialization.MemberDeserializer
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
|
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.SinceKotlinInfoTable
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirementTable
|
||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||||
import kotlin.jvm.internal.FunctionReference
|
import kotlin.jvm.internal.FunctionReference
|
||||||
@@ -173,7 +173,7 @@ internal fun <M : MessageLite, D : CallableDescriptor> deserializeToDescriptor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val context = DeserializationContext(
|
val context = DeserializationContext(
|
||||||
moduleData.deserialization, nameResolver, moduleData.module, typeTable, SinceKotlinInfoTable.EMPTY,
|
moduleData.deserialization, nameResolver, moduleData.module, typeTable, VersionRequirementTable.EMPTY,
|
||||||
containerSource = null, parentTypeDeserializer = null, typeParameters = typeParameters
|
containerSource = null, parentTypeDeserializer = null, typeParameters = typeParameters
|
||||||
)
|
)
|
||||||
return MemberDeserializer(context).createDescriptor(proto)
|
return MemberDeserializer(context).createDescriptor(proto)
|
||||||
|
|||||||
Reference in New Issue
Block a user