Don't track lookups from deserializer & java loader
This commit is contained in:
+2
-1
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.constants.AnnotationValue
|
||||
@@ -133,7 +134,7 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
|
||||
private fun resolveEnumValue(enumClassId: ClassId, enumEntryName: Name): ConstantValue<*> {
|
||||
val enumClass = resolveClass(enumClassId)
|
||||
if (enumClass.getKind() == ClassKind.ENUM_CLASS) {
|
||||
val enumEntry = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(enumEntryName)
|
||||
val enumEntry = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(enumEntryName, NoLookupLocation.FROM_DESERIALIZATION)
|
||||
if (enumEntry is ClassDescriptor) {
|
||||
return factory.createEnumValue(enumEntry)
|
||||
}
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class DeserializedClassDescriptor(
|
||||
if (!classProto.hasCompanionObjectName()) return null
|
||||
|
||||
val companionObjectName = c.nameResolver.getName(classProto.getCompanionObjectName())
|
||||
return memberScope.getClassifier(companionObjectName) as? ClassDescriptor
|
||||
return memberScope.getClassifier(companionObjectName, NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor
|
||||
}
|
||||
|
||||
override fun getCompanionObjectDescriptor(): ClassDescriptor? = companionObjectDescriptor()
|
||||
|
||||
+5
-6
@@ -17,18 +17,17 @@
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
public fun ModuleDescriptor.findClassAcrossModuleDependencies(classId: ClassId): ClassDescriptor? {
|
||||
val packageViewDescriptor = getPackage(classId.getPackageFqName())
|
||||
val segments = classId.getRelativeClassName().pathSegments()
|
||||
val topLevelClass = packageViewDescriptor.memberScope.getClassifier(segments.first()) as? ClassDescriptor ?: return null
|
||||
val packageViewDescriptor = getPackage(classId.packageFqName)
|
||||
val segments = classId.relativeClassName.pathSegments()
|
||||
val topLevelClass = packageViewDescriptor.memberScope.getClassifier(segments.first(), NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor ?: return null
|
||||
var result = topLevelClass
|
||||
for (name in segments.subList(1, segments.size())) {
|
||||
result = result.getUnsubstitutedInnerClassesScope().getClassifier(name) as? ClassDescriptor ?: return null
|
||||
result = result.unsubstitutedInnerClassesScope.getClassifier(name, NoLookupLocation.FROM_DESERIALIZATION) as? ClassDescriptor ?: return null
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user