Don't look for classes with empty or special name in deserialized scope
Fix EA-59962, EA-64281, EA-65698. No new tests added because the only repro reported as KT-8187 now fails with another (much more understandable though) exception #KT-8187 Open
This commit is contained in:
@@ -36,5 +36,9 @@ public class SpecialNames {
|
|||||||
return name != null && !name.isSpecial() ? name : SAFE_IDENTIFIER_FOR_NO_NAME;
|
return name != null && !name.isSpecial() ? name : SAFE_IDENTIFIER_FOR_NO_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSafeIdentifier(@NotNull Name name) {
|
||||||
|
return !name.asString().isEmpty() && !name.isSpecial();
|
||||||
|
}
|
||||||
|
|
||||||
private SpecialNames() {}
|
private SpecialNames() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -16,11 +16,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.name.SpecialNames
|
||||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationComponents
|
import org.jetbrains.kotlin.serialization.deserialization.DeserializationComponents
|
||||||
@@ -43,7 +45,9 @@ public open class DeserializedPackageMemberScope(
|
|||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
|
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
|
||||||
= computeDescriptors(kindFilter, nameFilter)
|
= computeDescriptors(kindFilter, nameFilter)
|
||||||
|
|
||||||
override fun getClassDescriptor(name: Name) = c.components.deserializeClass(ClassId(packageFqName, name))
|
override fun getClassDescriptor(name: Name): ClassDescriptor? =
|
||||||
|
if (SpecialNames.isSafeIdentifier(name)) c.components.deserializeClass(ClassId(packageFqName, name))
|
||||||
|
else null
|
||||||
|
|
||||||
override fun addClassDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
override fun addClassDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
||||||
for (className in classNames) {
|
for (className in classNames) {
|
||||||
|
|||||||
Reference in New Issue
Block a user