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 (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) return false
|
||||
if (old.hasSinceKotlinInfoTable()) {
|
||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) return false
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||
if (old.hasVersionRequirementTable()) {
|
||||
if (!checkEquals(old.versionRequirementTable, new.versionRequirementTable)) 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,
|
||||
TYPE_ALIAS_LIST,
|
||||
TYPE_TABLE,
|
||||
SINCE_KOTLIN_INFO_TABLE,
|
||||
VERSION_REQUIREMENT_TABLE,
|
||||
JVM_EXT_PACKAGE_MODULE_NAME,
|
||||
JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST,
|
||||
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 (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) result.add(ProtoBufPackageKind.SINCE_KOTLIN_INFO_TABLE)
|
||||
if (old.hasSinceKotlinInfoTable()) {
|
||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) result.add(ProtoBufPackageKind.SINCE_KOTLIN_INFO_TABLE)
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufPackageKind.VERSION_REQUIREMENT_TABLE)
|
||||
if (old.hasVersionRequirementTable()) {
|
||||
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)
|
||||
@@ -163,14 +163,14 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||
}
|
||||
|
||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
||||
if (old.hasSinceKotlinInfo()) {
|
||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) return false
|
||||
}
|
||||
|
||||
if (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) return false
|
||||
if (old.hasSinceKotlinInfoTable()) {
|
||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) return false
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||
if (old.hasVersionRequirementTable()) {
|
||||
if (!checkEquals(old.versionRequirementTable, new.versionRequirementTable)) 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,
|
||||
SEALED_SUBCLASS_FQ_NAME_LIST,
|
||||
TYPE_TABLE,
|
||||
SINCE_KOTLIN_INFO,
|
||||
SINCE_KOTLIN_INFO_TABLE,
|
||||
VERSION_REQUIREMENT,
|
||||
VERSION_REQUIREMENT_TABLE,
|
||||
JVM_EXT_CLASS_MODULE_NAME,
|
||||
JVM_EXT_CLASS_LOCAL_VARIABLE_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 (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO)
|
||||
if (old.hasSinceKotlinInfo()) {
|
||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO)
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
|
||||
}
|
||||
|
||||
if (old.hasSinceKotlinInfoTable() != new.hasSinceKotlinInfoTable()) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO_TABLE)
|
||||
if (old.hasSinceKotlinInfoTable()) {
|
||||
if (!checkEquals(old.sinceKotlinInfoTable, new.sinceKotlinInfoTable)) result.add(ProtoBufClassKind.SINCE_KOTLIN_INFO_TABLE)
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||
if (old.hasVersionRequirementTable()) {
|
||||
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)
|
||||
@@ -349,9 +349,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||
}
|
||||
|
||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
||||
if (old.hasSinceKotlinInfo()) {
|
||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) 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.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
||||
if (old.hasSinceKotlinInfo()) {
|
||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) 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 (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
||||
if (old.hasSinceKotlinInfo()) {
|
||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) return false
|
||||
}
|
||||
|
||||
return true
|
||||
@@ -509,8 +509,8 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
return true
|
||||
}
|
||||
|
||||
open fun checkEquals(old: ProtoBuf.SinceKotlinInfoTable, new: ProtoBuf.SinceKotlinInfoTable): Boolean {
|
||||
if (!checkEqualsSinceKotlinInfoTableInfo(old, new)) return false
|
||||
open fun checkEquals(old: ProtoBuf.VersionRequirementTable, new: ProtoBuf.VersionRequirementTable): Boolean {
|
||||
if (!checkEqualsVersionRequirementTableRequirement(old, new)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -657,9 +657,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
|
||||
if (!checkEqualsConstructorValueParameter(old, new)) return false
|
||||
|
||||
if (old.hasSinceKotlinInfo() != new.hasSinceKotlinInfo()) return false
|
||||
if (old.hasSinceKotlinInfo()) {
|
||||
if (old.sinceKotlinInfo != new.sinceKotlinInfo) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) 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
|
||||
}
|
||||
|
||||
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()) {
|
||||
if (old.version != new.version) return false
|
||||
@@ -1089,11 +1089,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
return true
|
||||
}
|
||||
|
||||
open fun checkEqualsSinceKotlinInfoTableInfo(old: ProtoBuf.SinceKotlinInfoTable, new: ProtoBuf.SinceKotlinInfoTable): Boolean {
|
||||
if (old.infoCount != new.infoCount) return false
|
||||
open fun checkEqualsVersionRequirementTableRequirement(old: ProtoBuf.VersionRequirementTable, new: ProtoBuf.VersionRequirementTable): Boolean {
|
||||
if (old.requirementCount != new.requirementCount) return false
|
||||
|
||||
for(i in 0..old.infoCount - 1) {
|
||||
if (!checkEquals(old.getInfo(i), new.getInfo(i))) return false
|
||||
for(i in 0..old.requirementCount - 1) {
|
||||
if (!checkEquals(old.getRequirement(i), new.getRequirement(i))) return false
|
||||
}
|
||||
|
||||
return true
|
||||
@@ -1209,8 +1209,8 @@ fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfoTable()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfoTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
if (hasVersionRequirementTable()) {
|
||||
hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.packageModuleName)) {
|
||||
@@ -1285,12 +1285,12 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
|
||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfo()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfoTable()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfoTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
if (hasVersionRequirementTable()) {
|
||||
hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.classModuleName)) {
|
||||
@@ -1353,8 +1353,8 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfo()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.methodSignature)) {
|
||||
@@ -1417,8 +1417,8 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
||||
hashCode = 31 * hashCode + setterFlags
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfo()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfo()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
return hashCode
|
||||
@@ -1494,11 +1494,11 @@ fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
|
||||
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
|
||||
|
||||
for(i in 0..infoCount - 1) {
|
||||
hashCode = 31 * hashCode + getInfo(i).hashCode(stringIndexes, fqNameIndexes)
|
||||
for(i in 0..requirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getRequirement(i).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
return hashCode
|
||||
@@ -1623,8 +1623,8 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
|
||||
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasSinceKotlinInfo()) {
|
||||
hashCode = 31 * hashCode + sinceKotlinInfo
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.constructorSignature)) {
|
||||
@@ -1774,7 +1774,7 @@ fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqN
|
||||
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
|
||||
|
||||
if (hasVersion()) {
|
||||
|
||||
@@ -224,8 +224,8 @@ class DifferenceCalculatorForClass(
|
||||
ProtoBufClassKind.TYPE_TABLE -> {
|
||||
// TODO
|
||||
}
|
||||
ProtoCompareGenerated.ProtoBufClassKind.SINCE_KOTLIN_INFO,
|
||||
ProtoCompareGenerated.ProtoBufClassKind.SINCE_KOTLIN_INFO_TABLE -> {
|
||||
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT,
|
||||
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT_TABLE -> {
|
||||
// TODO
|
||||
}
|
||||
ProtoBufClassKind.FLAGS,
|
||||
@@ -281,7 +281,7 @@ class DifferenceCalculatorForPackageFacade(
|
||||
ProtoBufPackageKind.TYPE_ALIAS_LIST ->
|
||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getTypeAliasList))
|
||||
ProtoBufPackageKind.TYPE_TABLE,
|
||||
ProtoBufPackageKind.SINCE_KOTLIN_INFO_TABLE,
|
||||
ProtoBufPackageKind.VERSION_REQUIREMENT_TABLE,
|
||||
ProtoBufPackageKind.JVM_EXT_PACKAGE_MODULE_NAME,
|
||||
ProtoBufPackageKind.JS_EXT_PACKAGE_FQ_NAME-> {
|
||||
// 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
|
||||
// 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
|
||||
// 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 {
|
||||
checkNotNewerThanCompiler(messageCollector, it)
|
||||
}.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.checkers.ExpectedActualDeclarationChecker.Compatibility.Incompatible;
|
||||
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 java.lang.reflect.Field;
|
||||
@@ -101,8 +101,10 @@ public interface Errors {
|
||||
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_ERROR = DiagnosticFactory3.create(ERROR);
|
||||
DiagnosticFactory3<PsiElement, DeclarationDescriptor, SinceKotlinInfo.Version, Pair<LanguageVersion, String>> SINCE_KOTLIN_INFO_DEPRECATION = DiagnosticFactory3.create(WARNING);
|
||||
DiagnosticFactory3<PsiElement, DeclarationDescriptor, SinceKotlinInfo.Version, Pair<LanguageVersion, String>> SINCE_KOTLIN_INFO_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
|
||||
DiagnosticFactory3<PsiElement, DeclarationDescriptor, VersionRequirement.Version, Pair<LanguageVersion, String>>
|
||||
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);
|
||||
|
||||
|
||||
+8
-8
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
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.util.MappedExtensionProvider;
|
||||
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_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();
|
||||
return pair.getFirst().getVersionString() + (message != null ? ". " + message : "");
|
||||
};
|
||||
MAP.put(SINCE_KOTLIN_INFO_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",
|
||||
sinceKotlinInfoMessage);
|
||||
MAP.put(SINCE_KOTLIN_INFO_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",
|
||||
sinceKotlinInfoMessage);
|
||||
MAP.put(VERSION_REQUIREMENT_DEPRECATION, "''{0}''{1} should not be used in Kotlin {2}", DEPRECATION_RENDERER,
|
||||
(obj, renderingContext) -> obj.equals(VersionRequirement.Version.INFINITY) ? "" : " is only supported since Kotlin " + obj.asString() + " and",
|
||||
versionRequirementMessage);
|
||||
MAP.put(VERSION_REQUIREMENT_DEPRECATION_ERROR, "''{0}''{1} cannot be used in Kotlin {2}", DEPRECATION_RENDERER,
|
||||
(obj, renderingContext) -> obj.equals(VersionRequirement.Version.INFINITY) ? "" : " is only available since Kotlin " + obj.asString() + " and",
|
||||
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);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.resolve.calls.checkers.shouldWarnAboutDeprecatedModF
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
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.types.KotlinType
|
||||
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()}'"
|
||||
}
|
||||
|
||||
private data class DeprecatedBySinceKotlinInfo(
|
||||
private val sinceKotlinInfo: SinceKotlinInfo,
|
||||
private data class DeprecatedByVersionRequirement(
|
||||
val versionRequirement: VersionRequirement,
|
||||
override val target: DeclarationDescriptor
|
||||
) : Deprecation {
|
||||
override val deprecationLevel: DeprecationLevelValue
|
||||
get() = when (sinceKotlinInfo.level) {
|
||||
get() = when (versionRequirement.level) {
|
||||
DeprecationLevel.WARNING -> WARNING
|
||||
DeprecationLevel.ERROR -> ERROR
|
||||
DeprecationLevel.HIDDEN -> HIDDEN
|
||||
@@ -112,8 +112,8 @@ private data class DeprecatedBySinceKotlinInfo(
|
||||
|
||||
override val message: String?
|
||||
get() {
|
||||
val message = sinceKotlinInfo.message
|
||||
val errorCode = sinceKotlinInfo.errorCode
|
||||
val message = versionRequirement.message
|
||||
val errorCode = versionRequirement.errorCode
|
||||
if (message == null && errorCode == null) return null
|
||||
|
||||
return buildString {
|
||||
@@ -128,9 +128,6 @@ private data class DeprecatedBySinceKotlinInfo(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val sinceKotlinVersion: SinceKotlinInfo.Version
|
||||
get() = sinceKotlinInfo.version
|
||||
}
|
||||
|
||||
private data class DeprecatedTypealiasByAnnotation(
|
||||
@@ -152,12 +149,12 @@ internal fun createDeprecationDiagnostic(
|
||||
): Diagnostic {
|
||||
val targetOriginal = deprecation.target.original
|
||||
return when (deprecation) {
|
||||
is DeprecatedBySinceKotlinInfo -> {
|
||||
is DeprecatedByVersionRequirement -> {
|
||||
val factory = when (deprecation.deprecationLevel) {
|
||||
WARNING -> Errors.SINCE_KOTLIN_INFO_DEPRECATION
|
||||
ERROR, HIDDEN -> Errors.SINCE_KOTLIN_INFO_DEPRECATION_ERROR
|
||||
WARNING -> Errors.VERSION_REQUIREMENT_DEPRECATION
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -289,15 +286,15 @@ class DeprecationResolver(
|
||||
result.add(deprecation)
|
||||
}
|
||||
|
||||
val sinceKotlinInfo =
|
||||
(target as? DeserializedMemberDescriptor)?.sinceKotlinInfo
|
||||
?: (target as? DeserializedClassDescriptor)?.sinceKotlinInfo
|
||||
if (sinceKotlinInfo != null) {
|
||||
val versionRequirement =
|
||||
(target as? DeserializedMemberDescriptor)?.versionRequirement
|
||||
?: (target as? DeserializedClassDescriptor)?.versionRequirement
|
||||
if (versionRequirement != null) {
|
||||
// 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
|
||||
if (ApiVersion.createBySinceKotlinInfo(sinceKotlinInfo) >
|
||||
if (ApiVersion.createByVersionRequirement(versionRequirement) >
|
||||
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.MemberComparator
|
||||
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.typeUtil.contains
|
||||
import org.jetbrains.kotlin.utils.Interner
|
||||
@@ -41,7 +41,7 @@ class DescriptorSerializer private constructor(
|
||||
private val typeParameters: Interner<TypeParameterDescriptor>,
|
||||
private val extension: SerializerExtension,
|
||||
private val typeTable: MutableTypeTable,
|
||||
private val sinceKotlinInfoTable: MutableSinceKotlinInfoTable,
|
||||
private val versionRequirementTable: MutableVersionRequirementTable,
|
||||
private val serializeTypeTableToFunction: Boolean
|
||||
) {
|
||||
fun serialize(message: MessageLite): ByteArray {
|
||||
@@ -52,7 +52,7 @@ class DescriptorSerializer private constructor(
|
||||
}
|
||||
|
||||
private fun createChildSerializer(descriptor: DeclarationDescriptor): DescriptorSerializer =
|
||||
DescriptorSerializer(descriptor, Interner(typeParameters), extension, typeTable, sinceKotlinInfoTable,
|
||||
DescriptorSerializer(descriptor, Interner(typeParameters), extension, typeTable, versionRequirementTable,
|
||||
serializeTypeTableToFunction = false)
|
||||
|
||||
val stringTable: StringTable
|
||||
@@ -134,9 +134,9 @@ class DescriptorSerializer private constructor(
|
||||
builder.typeTable = typeTableProto
|
||||
}
|
||||
|
||||
val sinceKotlinInfoProto = sinceKotlinInfoTable.serialize()
|
||||
if (sinceKotlinInfoProto != null) {
|
||||
builder.sinceKotlinInfoTable = sinceKotlinInfoProto
|
||||
val versionRequirementTableProto = versionRequirementTable.serialize()
|
||||
if (versionRequirementTableProto != null) {
|
||||
builder.versionRequirementTable = versionRequirementTableProto
|
||||
}
|
||||
|
||||
extension.serializeClass(classDescriptor, builder)
|
||||
@@ -217,7 +217,7 @@ class DescriptorSerializer private constructor(
|
||||
}
|
||||
|
||||
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
||||
builder.sinceKotlinInfo = writeSinceKotlinInfo(LanguageFeature.Coroutines)
|
||||
builder.versionRequirement = writeVersionRequirement(LanguageFeature.Coroutines)
|
||||
}
|
||||
|
||||
extension.serializeProperty(descriptor, builder)
|
||||
@@ -274,7 +274,7 @@ class DescriptorSerializer private constructor(
|
||||
}
|
||||
|
||||
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
||||
builder.sinceKotlinInfo = writeSinceKotlinInfo(LanguageFeature.Coroutines)
|
||||
builder.versionRequirement = writeVersionRequirement(LanguageFeature.Coroutines)
|
||||
}
|
||||
|
||||
extension.serializeFunction(descriptor, builder)
|
||||
@@ -297,7 +297,7 @@ class DescriptorSerializer private constructor(
|
||||
}
|
||||
|
||||
if (descriptor.isSuspendOrHasSuspendTypesInSignature()) {
|
||||
builder.sinceKotlinInfo = writeSinceKotlinInfo(LanguageFeature.Coroutines)
|
||||
builder.versionRequirement = writeVersionRequirement(LanguageFeature.Coroutines)
|
||||
}
|
||||
|
||||
extension.serializeConstructor(descriptor, builder)
|
||||
@@ -557,9 +557,9 @@ class DescriptorSerializer private constructor(
|
||||
builder.typeTable = typeTableProto
|
||||
}
|
||||
|
||||
val sinceKotlinInfoProto = sinceKotlinInfoTable.serialize()
|
||||
if (sinceKotlinInfoProto != null) {
|
||||
builder.sinceKotlinInfoTable = sinceKotlinInfoProto
|
||||
val versionRequirementTableProto = versionRequirementTable.serialize()
|
||||
if (versionRequirementTableProto != null) {
|
||||
builder.versionRequirementTable = versionRequirementTableProto
|
||||
}
|
||||
|
||||
extension.serializePackage(packageFqName, builder)
|
||||
@@ -567,15 +567,15 @@ class DescriptorSerializer private constructor(
|
||||
return builder
|
||||
}
|
||||
|
||||
private fun writeSinceKotlinInfo(languageFeature: LanguageFeature): Int {
|
||||
private fun writeVersionRequirement(languageFeature: LanguageFeature): Int {
|
||||
val languageVersion = languageFeature.sinceVersion!!
|
||||
val sinceKotlinInfo = ProtoBuf.SinceKotlinInfo.newBuilder().apply {
|
||||
SinceKotlinInfo.Version(languageVersion.major, languageVersion.minor).encode(
|
||||
val requirement = ProtoBuf.VersionRequirement.newBuilder().apply {
|
||||
VersionRequirement.Version(languageVersion.major, languageVersion.minor).encode(
|
||||
writeVersion = { version = it },
|
||||
writeVersionFull = { versionFull = it }
|
||||
)
|
||||
}
|
||||
return sinceKotlinInfoTable[sinceKotlinInfo]
|
||||
return versionRequirementTable[requirement]
|
||||
}
|
||||
|
||||
private fun getClassifierId(descriptor: ClassifierDescriptorWithTypeParameters): Int =
|
||||
@@ -590,13 +590,13 @@ class DescriptorSerializer private constructor(
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun createTopLevel(extension: SerializerExtension): DescriptorSerializer {
|
||||
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableSinceKotlinInfoTable(),
|
||||
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableVersionRequirementTable(),
|
||||
serializeTypeTableToFunction = false)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun createForLambda(extension: SerializerExtension): DescriptorSerializer {
|
||||
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableSinceKotlinInfoTable(),
|
||||
return DescriptorSerializer(null, Interner(), extension, MutableTypeTable(), MutableVersionRequirementTable(),
|
||||
serializeTypeTableToFunction = true)
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ class DescriptorSerializer private constructor(
|
||||
Interner(parentSerializer.typeParameters),
|
||||
parentSerializer.extension,
|
||||
MutableTypeTable(),
|
||||
MutableSinceKotlinInfoTable(),
|
||||
MutableVersionRequirementTable(),
|
||||
serializeTypeTableToFunction = false
|
||||
)
|
||||
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>() {
|
||||
override fun createTableBuilder(): ProtoBuf.SinceKotlinInfoTable.Builder = ProtoBuf.SinceKotlinInfoTable.newBuilder()
|
||||
class MutableVersionRequirementTable : MutableTable<ProtoBuf.VersionRequirement.Builder, ProtoBuf.VersionRequirementTable, ProtoBuf.VersionRequirementTable.Builder>() {
|
||||
override fun createTableBuilder(): ProtoBuf.VersionRequirementTable.Builder = ProtoBuf.VersionRequirementTable.newBuilder()
|
||||
|
||||
override fun addElement(builder: ProtoBuf.SinceKotlinInfoTable.Builder, element: ProtoBuf.SinceKotlinInfo.Builder) {
|
||||
builder.addInfo(element)
|
||||
override fun addElement(builder: ProtoBuf.VersionRequirementTable.Builder, element: ProtoBuf.VersionRequirement.Builder) {
|
||||
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.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
|
||||
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.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.File
|
||||
|
||||
class SinceKotlinInfoTest : TestCaseWithTmpdir() {
|
||||
class VersionRequirementTest : TestCaseWithTmpdir() {
|
||||
fun doTest(
|
||||
fileName: String,
|
||||
expectedSinceKotlinInfoVersion: SinceKotlinInfo.Version,
|
||||
expectedVersionRequirement: VersionRequirement.Version,
|
||||
expectedLevel: DeprecationLevel,
|
||||
expectedMessage: String?,
|
||||
expectedErrorCode: Int?,
|
||||
@@ -63,12 +61,12 @@ class SinceKotlinInfoTest : TestCaseWithTmpdir() {
|
||||
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(expectedLevel, sinceKotlinInfo.level)
|
||||
assertEquals(expectedMessage, sinceKotlinInfo.message)
|
||||
assertEquals(expectedErrorCode, sinceKotlinInfo.errorCode)
|
||||
assertEquals(expectedVersionRequirement, requirement.version)
|
||||
assertEquals(expectedLevel, requirement.level)
|
||||
assertEquals(expectedMessage, requirement.message)
|
||||
assertEquals(expectedErrorCode, requirement.errorCode)
|
||||
}
|
||||
|
||||
for (fqName in fqNames) {
|
||||
@@ -98,8 +96,8 @@ class SinceKotlinInfoTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
fun testSuspendFun() {
|
||||
doTest("compiler/testData/sinceKotlinInfo/suspendFun.kt",
|
||||
SinceKotlinInfo.Version(1, 1), DeprecationLevel.ERROR, null, null,
|
||||
doTest("compiler/testData/versionRequirement/suspendFun.kt",
|
||||
VersionRequirement.Version(1, 1), DeprecationLevel.ERROR, null, null,
|
||||
"test.topLevel",
|
||||
"test.Foo.member",
|
||||
"test.Foo.<init>",
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
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
|
||||
|
||||
class ApiVersion private constructor(
|
||||
@@ -60,8 +60,8 @@ class ApiVersion private constructor(
|
||||
fun createByLanguageVersion(version: LanguageVersion): ApiVersion = parse(version.versionString)!!
|
||||
|
||||
@JvmStatic
|
||||
fun createBySinceKotlinInfo(sinceKotlinInfo: SinceKotlinInfo): ApiVersion =
|
||||
sinceKotlinInfo.version.let { version -> parse(version.asString()) ?: error("Could not parse version: $version") }
|
||||
fun createByVersionRequirement(versionRequirement: VersionRequirement): ApiVersion =
|
||||
versionRequirement.version.let { version -> parse(version.asString()) ?: error("Could not parse version: $version") }
|
||||
|
||||
fun parse(versionString: String): ApiVersion? = try {
|
||||
ApiVersion(MavenComparableVersion(versionString), versionString)
|
||||
|
||||
@@ -211,10 +211,10 @@ message Class {
|
||||
|
||||
optional TypeTable type_table = 30;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
optional SinceKotlinInfoTable since_kotlin_info_table = 32;
|
||||
optional VersionRequirementTable version_requirement_table = 32;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ message Package {
|
||||
|
||||
optional TypeTable type_table = 30;
|
||||
|
||||
optional SinceKotlinInfoTable since_kotlin_info_table = 32;
|
||||
optional VersionRequirementTable version_requirement_table = 32;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -249,8 +249,8 @@ message Constructor {
|
||||
|
||||
repeated ValueParameter value_parameter = 2;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -286,8 +286,8 @@ message Function {
|
||||
|
||||
optional TypeTable type_table = 30;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -334,8 +334,8 @@ message Property {
|
||||
optional int32 getter_flags = 7 /* absent => same as property */;
|
||||
optional int32 setter_flags = 8 /* absent => same as property */;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -379,8 +379,8 @@ message TypeAlias {
|
||||
|
||||
repeated Annotation annotation = 8;
|
||||
|
||||
// Index into the SinceKotlinInfoTable
|
||||
optional int32 sinceKotlinInfo = 31;
|
||||
// Index into the VersionRequirementTable
|
||||
optional int32 version_requirement = 31;
|
||||
|
||||
extensions 100 to 199;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ enum MemberKind {
|
||||
SYNTHESIZED = 3;
|
||||
}
|
||||
|
||||
message SinceKotlinInfo {
|
||||
message VersionRequirement {
|
||||
enum Level {
|
||||
WARNING = 0;
|
||||
ERROR = 1;
|
||||
@@ -443,8 +443,8 @@ message SinceKotlinInfo {
|
||||
optional int32 message = 5 [(string_id_in_table) = true];
|
||||
}
|
||||
|
||||
message SinceKotlinInfoTable {
|
||||
repeated SinceKotlinInfo info = 1;
|
||||
message VersionRequirementTable {
|
||||
repeated VersionRequirement requirement = 1;
|
||||
}
|
||||
|
||||
// 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.serialization.ClassDataWithSource
|
||||
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) {
|
||||
private val classes: (ClassKey) -> ClassDescriptor? =
|
||||
@@ -61,7 +61,7 @@ class ClassDeserializer(private val components: DeserializationComponents) {
|
||||
components.createContext(
|
||||
fragment, nameResolver,
|
||||
TypeTable(classProto.typeTable),
|
||||
SinceKotlinInfoTable.create(classProto.sinceKotlinInfoTable),
|
||||
VersionRequirementTable.create(classProto.versionRequirementTable),
|
||||
containerSource = null
|
||||
)
|
||||
}
|
||||
|
||||
+4
-4
@@ -51,7 +51,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
proto,
|
||||
c.nameResolver,
|
||||
c.typeTable,
|
||||
c.sinceKotlinInfoTable,
|
||||
c.versionRequirementTable,
|
||||
c.containerSource
|
||||
)
|
||||
|
||||
@@ -158,7 +158,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
else Annotations.EMPTY
|
||||
val function = DeserializedSimpleFunctionDescriptor(
|
||||
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
|
||||
)
|
||||
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 typeAlias = DeserializedTypeAliasDescriptor(
|
||||
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)
|
||||
@@ -208,7 +208,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val classDescriptor = c.containingDeclaration as ClassDescriptor
|
||||
val descriptor = DeserializedClassConstructorDescriptor(
|
||||
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
|
||||
)
|
||||
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.serialization.ProtoBuf
|
||||
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
|
||||
|
||||
class DeserializationComponents(
|
||||
@@ -54,10 +54,10 @@ class DeserializationComponents(
|
||||
descriptor: PackageFragmentDescriptor,
|
||||
nameResolver: NameResolver,
|
||||
typeTable: TypeTable,
|
||||
sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
versionRequirementTable: VersionRequirementTable,
|
||||
containerSource: DeserializedContainerSource?
|
||||
): DeserializationContext =
|
||||
DeserializationContext(this, nameResolver, descriptor, typeTable, sinceKotlinInfoTable, containerSource,
|
||||
DeserializationContext(this, nameResolver, descriptor, typeTable, versionRequirementTable, containerSource,
|
||||
parentTypeDeserializer = null, typeParameters = listOf())
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class DeserializationContext(
|
||||
val nameResolver: NameResolver,
|
||||
val containingDeclaration: DeclarationDescriptor,
|
||||
val typeTable: TypeTable,
|
||||
val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
val versionRequirementTable: VersionRequirementTable,
|
||||
val containerSource: DeserializedContainerSource?,
|
||||
parentTypeDeserializer: TypeDeserializer?,
|
||||
typeParameters: List<ProtoBuf.TypeParameter>
|
||||
@@ -85,7 +85,7 @@ class DeserializationContext(
|
||||
nameResolver: NameResolver = this.nameResolver,
|
||||
typeTable: TypeTable = this.typeTable
|
||||
) = DeserializationContext(
|
||||
components, nameResolver, descriptor, typeTable, sinceKotlinInfoTable, this.containerSource,
|
||||
components, nameResolver, descriptor, typeTable, versionRequirementTable, this.containerSource,
|
||||
parentTypeDeserializer = this.typeDeserializer, typeParameters = typeParameterProtos
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -73,8 +73,8 @@ class DeserializedClassDescriptor(
|
||||
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
|
||||
)
|
||||
|
||||
val sinceKotlinInfo: SinceKotlinInfo?
|
||||
get() = SinceKotlinInfo.create(classProto, c.nameResolver, c.sinceKotlinInfoTable)
|
||||
val versionRequirement: VersionRequirement?
|
||||
get() = VersionRequirement.create(classProto, c.nameResolver, c.versionRequirementTable)
|
||||
|
||||
override val annotations =
|
||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
||||
|
||||
+11
-11
@@ -36,10 +36,10 @@ interface DeserializedMemberDescriptor : MemberDescriptor {
|
||||
|
||||
val typeTable: TypeTable
|
||||
|
||||
val sinceKotlinInfoTable: SinceKotlinInfoTable
|
||||
val versionRequirementTable: VersionRequirementTable
|
||||
|
||||
val sinceKotlinInfo: SinceKotlinInfo?
|
||||
get() = SinceKotlinInfo.create(proto, nameResolver, sinceKotlinInfoTable)
|
||||
val versionRequirement: VersionRequirement?
|
||||
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.
|
||||
// TODO: merge with sourceElement of containingDeclaration
|
||||
@@ -68,7 +68,7 @@ class DeserializedSimpleFunctionDescriptor(
|
||||
override val proto: ProtoBuf.Function,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
source: SourceElement? = null
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
@@ -86,7 +86,7 @@ class DeserializedSimpleFunctionDescriptor(
|
||||
): FunctionDescriptorImpl {
|
||||
return DeserializedSimpleFunctionDescriptor(
|
||||
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 nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
||||
@@ -124,7 +124,7 @@ class DeserializedPropertyDescriptor(
|
||||
): PropertyDescriptorImpl {
|
||||
return DeserializedPropertyDescriptor(
|
||||
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 nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
source: SourceElement? = null
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
@@ -156,7 +156,7 @@ class DeserializedClassConstructorDescriptor(
|
||||
): DeserializedClassConstructorDescriptor {
|
||||
return DeserializedClassConstructorDescriptor(
|
||||
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 nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val versionRequirementTable: VersionRequirementTable,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
) : AbstractTypeAliasDescriptor(containingDeclaration, annotations, name, SourceElement.NO_SOURCE, visibility),
|
||||
DeserializedMemberDescriptor {
|
||||
@@ -219,7 +219,7 @@ class DeserializedTypeAliasDescriptor(
|
||||
proto,
|
||||
nameResolver,
|
||||
typeTable,
|
||||
sinceKotlinInfoTable,
|
||||
versionRequirementTable,
|
||||
containerSource
|
||||
)
|
||||
substituted.initialize(declaredTypeParameters,
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ open class DeserializedPackageMemberScope(
|
||||
classNames: () -> Collection<Name>
|
||||
) : DeserializedMemberScope(
|
||||
components.createContext(packageDescriptor, nameResolver, TypeTable(proto.typeTable),
|
||||
SinceKotlinInfoTable.create(proto.sinceKotlinInfoTable), containerSource),
|
||||
VersionRequirementTable.create(proto.versionRequirementTable), containerSource),
|
||||
proto.functionList, proto.propertyList, proto.typeAliasList, classNames
|
||||
) {
|
||||
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.deserialization.NameResolver
|
||||
|
||||
class SinceKotlinInfoTable private constructor(private val infos: List<ProtoBuf.SinceKotlinInfo>) {
|
||||
operator fun get(id: Int): ProtoBuf.SinceKotlinInfo? = infos.getOrNull(id)
|
||||
class VersionRequirementTable private constructor(private val infos: List<ProtoBuf.VersionRequirement>) {
|
||||
operator fun get(id: Int): ProtoBuf.VersionRequirement? = infos.getOrNull(id)
|
||||
|
||||
companion object {
|
||||
val EMPTY = SinceKotlinInfoTable(emptyList())
|
||||
val EMPTY = VersionRequirementTable(emptyList())
|
||||
|
||||
fun create(table: ProtoBuf.SinceKotlinInfoTable): SinceKotlinInfoTable =
|
||||
if (table.infoCount == 0) EMPTY else SinceKotlinInfoTable(table.infoList)
|
||||
fun create(table: ProtoBuf.VersionRequirementTable): VersionRequirementTable =
|
||||
if (table.requirementCount == 0) EMPTY else VersionRequirementTable(table.requirementList)
|
||||
}
|
||||
}
|
||||
|
||||
class SinceKotlinInfo(
|
||||
class VersionRequirement(
|
||||
val version: Version,
|
||||
val level: DeprecationLevel,
|
||||
val errorCode: Int?,
|
||||
@@ -90,13 +90,13 @@ class SinceKotlinInfo(
|
||||
"since $version $level" + (if (errorCode != null) " error $errorCode" else "") + (if (message != null) ": $message" else "")
|
||||
|
||||
companion object {
|
||||
fun create(proto: MessageLite, nameResolver: NameResolver, table: SinceKotlinInfoTable): SinceKotlinInfo? {
|
||||
fun create(proto: MessageLite, nameResolver: NameResolver, table: VersionRequirementTable): VersionRequirement? {
|
||||
val id = when (proto) {
|
||||
is ProtoBuf.Class -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Constructor -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Function -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Property -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.TypeAlias -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Class -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.Constructor -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.Function -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.Property -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
is ProtoBuf.TypeAlias -> if (proto.hasVersionRequirement()) proto.versionRequirement else return null
|
||||
else -> throw IllegalStateException("Unexpected declaration: ${proto::class.java}")
|
||||
}
|
||||
|
||||
@@ -108,16 +108,16 @@ class SinceKotlinInfo(
|
||||
)
|
||||
|
||||
val level = when (info.level!!) {
|
||||
ProtoBuf.SinceKotlinInfo.Level.WARNING -> DeprecationLevel.WARNING
|
||||
ProtoBuf.SinceKotlinInfo.Level.ERROR -> DeprecationLevel.ERROR
|
||||
ProtoBuf.SinceKotlinInfo.Level.HIDDEN -> DeprecationLevel.HIDDEN
|
||||
ProtoBuf.VersionRequirement.Level.WARNING -> DeprecationLevel.WARNING
|
||||
ProtoBuf.VersionRequirement.Level.ERROR -> DeprecationLevel.ERROR
|
||||
ProtoBuf.VersionRequirement.Level.HIDDEN -> DeprecationLevel.HIDDEN
|
||||
}
|
||||
|
||||
val errorCode = if (info.hasErrorCode()) info.errorCode 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.NameResolver
|
||||
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.JvmProtoBufUtil
|
||||
import kotlin.jvm.internal.FunctionReference
|
||||
@@ -173,7 +173,7 @@ internal fun <M : MessageLite, D : CallableDescriptor> deserializeToDescriptor(
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
return MemberDeserializer(context).createDescriptor(proto)
|
||||
|
||||
Reference in New Issue
Block a user