KTIJ-20637 Group files by module and create facade class for each one
Before all files were going to `getOrCreateSymbolLightFacade`. If there were both compiled and source files, it caused exceptions later (see `SymbolLightClassFacadeCache.getOrCreateFirLightFacadeNoCache`). When grouped by the `KtModule`, each file group should contain either only sources or only compiled classes. ^KTIJ-20637 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
71c60ce9d0
commit
35e2561dab
+9
-8
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
|
|||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.psi.KtScript
|
import org.jetbrains.kotlin.psi.KtScript
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
|
||||||
|
|
||||||
class IDEKotlinAsJavaFirSupport(private val project: Project) : KotlinAsJavaSupport() {
|
class IDEKotlinAsJavaFirSupport(private val project: Project) : KotlinAsJavaSupport() {
|
||||||
override fun findClassOrObjectDeclarationsInPackage(
|
override fun findClassOrObjectDeclarationsInPackage(
|
||||||
@@ -91,13 +90,15 @@ class IDEKotlinAsJavaFirSupport(private val project: Project) : KotlinAsJavaSupp
|
|||||||
override fun getLightClassForScript(script: KtScript): KtLightClass =
|
override fun getLightClassForScript(script: KtScript): KtLightClass =
|
||||||
error("Should not be called")
|
error("Should not be called")
|
||||||
|
|
||||||
override fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> =
|
override fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
|
||||||
//TODO Split by modules
|
val filesByModule = findFilesForFacade(facadeFqName, scope).groupBy { it.getKtModule(project) }
|
||||||
findFilesForFacade(facadeFqName, scope).ifNotEmpty {
|
|
||||||
listOfNotNull(
|
val lightClassFacadeCache = project.getService(SymbolLightClassFacadeCache::class.java)
|
||||||
project.getService(SymbolLightClassFacadeCache::class.java).getOrCreateSymbolLightFacade(this.toList(), facadeFqName)
|
|
||||||
)
|
return filesByModule.values.mapNotNull { files ->
|
||||||
} ?: emptyList()
|
lightClassFacadeCache.getOrCreateSymbolLightFacade(files, facadeFqName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getScriptClasses(scriptFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> =
|
override fun getScriptClasses(scriptFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> =
|
||||||
error("Should not be called")
|
error("Should not be called")
|
||||||
|
|||||||
Reference in New Issue
Block a user