Temporarily caching resolved classes in the trace (for existing code in the IDE to be happy)

This commit is contained in:
Andrey Breslav
2013-11-14 06:48:14 +04:00
parent ef220eff92
commit 01b456f5c2
2 changed files with 15 additions and 4 deletions
@@ -151,11 +151,16 @@ public class LazyJavaClassMemberScope(
val jNestedClass = nestedClassIndex()[name]
if (jNestedClass == null)
null
else
LazyJavaClassDescriptor(c,
else {
// TODO: this caching is a temporary workaround, should be replaced with properly caching the whole LazyJavaSubModule
val alreadyResolved = c.javaResolverCache.getClass(jNestedClass)
if (alreadyResolved != null)
alreadyResolved
else LazyJavaClassDescriptor(c,
getContainingDeclaration(),
DescriptorUtils.getFQName(getContainingDeclaration()).child(name).toSafe(),
jNestedClass)
}
}
override fun getClassifier(name: Name): ClassifierDescriptor? = if (enumClassObject) null else nestedClasses(name)
@@ -27,8 +27,14 @@ public abstract class LazyJavaPackageFragmentScope(
val javaClass = c.finder.findClass(fqName)
if (javaClass == null)
c.javaClassResolver.resolveClassByFqName(fqName)
else
LazyJavaClassDescriptor(c.withTypes(TypeParameterResolver.EMPTY), packageFragment, fqName, javaClass)
else {
// TODO: this caching is a temporary workaround, should be replaced with properly caching the whole LazyJavaSubModule
val cached = c.javaResolverCache.getClass(javaClass)
if (cached != null)
cached
else
LazyJavaClassDescriptor(c.withTypes(TypeParameterResolver.EMPTY), packageFragment, fqName, javaClass)
}
}
protected fun computeMemberIndexForSamConstructors(delegate: MemberIndex): MemberIndex = object : MemberIndex by delegate {