Skip to content

Commit 89fe54c

Browse files
committed
Remove NameResolver#getFqName, replace with getClassId
1 parent 7d5bd3c commit 89fe54c

File tree

5 files changed

+4
-28
lines changed

5 files changed

+4
-28
lines changed

compiler/tests/org/jetbrains/kotlin/checkers/LazyOperationsLog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class LazyOperationsLog(
157157
val context = typeDeserializer.field<DeserializationContext>("c")
158158
val typeProto = o.field<ProtoBuf.Type>("typeProto")
159159
val text = when {
160-
typeProto.hasClassName() -> context.nameResolver.getFqName(typeProto.className).asString()
160+
typeProto.hasClassName() -> context.nameResolver.getClassId(typeProto.className).asSingleFqName().asString()
161161
typeProto.hasTypeParameter() -> {
162162
val classifier = (o as JetType).constructor.declarationDescriptor!!
163163
"" + classifier.name + " in " + DescriptorUtils.getFqName(classifier.containingDeclaration)

core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NameResolver.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import org.jetbrains.annotations.NotNull;
2020
import org.jetbrains.kotlin.name.ClassId;
21-
import org.jetbrains.kotlin.name.FqName;
2221
import org.jetbrains.kotlin.name.Name;
2322

2423
public interface NameResolver {
@@ -30,7 +29,4 @@ public interface NameResolver {
3029

3130
@NotNull
3231
ClassId getClassId(int index);
33-
34-
@NotNull
35-
FqName getFqName(int index);
3632
}

core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NameResolverImpl.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static NameResolverImpl read(@NotNull InputStream in) {
4545
private final ProtoBuf.StringTable strings;
4646
private final ProtoBuf.QualifiedNameTable qualifiedNames;
4747

48-
public NameResolverImpl(
48+
private NameResolverImpl(
4949
@NotNull ProtoBuf.StringTable strings,
5050
@NotNull ProtoBuf.QualifiedNameTable qualifiedNames
5151
) {
@@ -93,15 +93,4 @@ public ClassId getClassId(int index) {
9393

9494
return new ClassId(FqName.fromSegments(packageFqName), FqName.fromSegments(relativeClassName), local);
9595
}
96-
97-
@Override
98-
@NotNull
99-
public FqName getFqName(int index) {
100-
QualifiedName qualifiedName = qualifiedNames.getQualifiedName(index);
101-
Name shortName = getName(qualifiedName.getShortName());
102-
if (!qualifiedName.hasParentQualifiedName()) {
103-
return FqName.topLevel(shortName);
104-
}
105-
return getFqName(qualifiedName.getParentQualifiedName()).child(shortName);
106-
}
10796
}

generators/src/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class GenerateProtoBufCompare {
5353
private val RESULT_NAME = "result"
5454
private val STRING_INDEXES_NANE = "StringIndexes"
5555
private val CLASS_ID_INDEXES_NANE = "ClassIdIndexes"
56-
private val FQ_NAME_INDEXES_NANE = "FqNameIndexes"
5756
private val OLD_PREFIX = "old"
5857
private val NEW_PREFIX = "new"
5958
private val CHECK_EQAULS_NAME = "checkEquals"
@@ -75,7 +74,6 @@ class GenerateProtoBufCompare {
7574
p.println()
7675

7776
p.println("import org.jetbrains.kotlin.name.ClassId")
78-
p.println("import org.jetbrains.kotlin.name.FqName")
7977
p.println("import org.jetbrains.kotlin.serialization.ProtoBuf")
8078
p.println("import org.jetbrains.kotlin.serialization.deserialization.NameResolver")
8179
p.println("import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf")
@@ -95,9 +93,7 @@ class GenerateProtoBufCompare {
9593
p.println("public val $NEW_PREFIX${CLASS_ID_INDEXES_NANE}Map: MutableMap<Int, Int> = hashMapOf()")
9694

9795
p.println()
98-
p.println("private val fqNames = Interner<FqName>()")
9996
p.println("private val classIds = Interner<ClassId>()")
100-
p.println()
10197

10298
val fileDescriptor = DebugProtoBuf.getDescriptor()
10399

@@ -150,9 +146,7 @@ class GenerateProtoBufCompare {
150146
p.println("public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {")
151147
p.println(" map[index]?.let { return it }")
152148
p.println()
153-
// TODO fqNames -> classIds
154-
p.println(" val result = fqNames.intern(nameResolver.getFqName(index))")
155-
//p.println(" val result = classIds.intern(nameResolver.getClassId(index))")
149+
p.println(" val result = classIds.intern(nameResolver.getClassId(index))")
156150
p.println(" map[index] = result")
157151
p.println(" return result")
158152
p.println("}")

jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.jetbrains.kotlin.jps.incremental
1818

1919
import org.jetbrains.kotlin.name.ClassId
20-
import org.jetbrains.kotlin.name.FqName
2120
import org.jetbrains.kotlin.serialization.ProtoBuf
2221
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
2322
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
@@ -33,10 +32,8 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
3332
public val oldClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
3433
public val newClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
3534

36-
private val fqNames = Interner<FqName>()
3735
private val classIds = Interner<ClassId>()
3836

39-
4037
open fun checkEquals(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
4138
if (!checkEqualsPackageMember(old, new)) return false
4239

@@ -556,7 +553,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
556553
public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
557554
map[index]?.let { return it }
558555

559-
val result = fqNames.intern(nameResolver.getFqName(index))
556+
val result = classIds.intern(nameResolver.getClassId(index))
560557
map[index] = result
561558
return result
562559
}

0 commit comments

Comments
 (0)