[lc] introduce KotlinAsJavaSupportBase with new common facade logic

^KT-53543
This commit is contained in:
Dmitry Gridin
2022-08-11 15:55:58 +02:00
committed by Space
parent 0ea041a1eb
commit 924dd38144
22 changed files with 206 additions and 329 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -31,7 +31,7 @@ public abstract class KotlinDeclarationProvider {
public abstract fun getTopLevelCallableNamesInPackage(packageFqName: FqName): Set<Name>
public abstract fun getFacadeFilesInPackage(packageFqName: FqName): Collection<KtFile>
public abstract fun findFilesForFacadeByPackage(packageFqName: FqName): Collection<KtFile>
public abstract fun findFilesForFacade(facadeFqName: FqName): Collection<KtFile>
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -67,7 +67,7 @@ public class KotlinStaticDeclarationProvider internal constructor(
}
override fun getFacadeFilesInPackage(packageFqName: FqName): Collection<KtFile> =
override fun findFilesForFacadeByPackage(packageFqName: FqName): Collection<KtFile> =
index.facadeFileMap[packageFqName]
?.filter { ktFile ->
ktFile.virtualFile in scope
@@ -76,7 +76,7 @@ public class KotlinStaticDeclarationProvider internal constructor(
override fun findFilesForFacade(facadeFqName: FqName): Collection<KtFile> {
if (facadeFqName.shortNameOrSpecial().isSpecial) return emptyList()
return getFacadeFilesInPackage(facadeFqName.parent()) //TODO Not work correctly for classes with JvmPackageName
return findFilesForFacadeByPackage(facadeFqName.parent()) //TODO Not work correctly for classes with JvmPackageName
.filter { it.javaFileFacadeFqName == facadeFqName }
}