[FE] Do not repeatedly load inner classes from class files.

Java protobufs generate a lot of inner classes and when compiling
Kotlin wrappers for those Java protobufs the inner classes can
be loaded hundreds of times leading to out of memory. This change
avoids reloading by fixing a bug in the cache implementation that
caused inner classes to not be cached.
This commit is contained in:
Mads Ager
2021-12-16 09:21:50 +01:00
committed by teamcity
parent 61265a6501
commit b5b1b38cb0
@@ -100,7 +100,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
classId.outerClassId?.let { outerClassId ->
val outerClass = outerClassFromRequest ?: findClass(outerClassId, searchScope)
return if (outerClass is BinaryJavaClass)
return@getOrPut if (outerClass is BinaryJavaClass)
outerClass.findInnerClass(classId.shortClassName, classFileContentFromRequest)
else
outerClass?.findInnerClass(classId.shortClassName)