KT-65425 [SLC] Correctly compute getQualifiedName for generated classes
Since the declarations generated by compiler plugins do not have proper PSI (`classOrObjectDeclaration` in this case), we need to resort to symbols for such declarations to compute the proper qualified name ^KT-65425 Fixed
This commit is contained in:
committed by
Space Team
parent
6271f5cbe5
commit
a55b8d30fd
+2
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisAp
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiLibraryBaseTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AnalysisApiFirTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.configureOptionalTestCompilerPlugin
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryBinaryModuleFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
|
||||
@@ -34,6 +35,7 @@ object AnalysisApiFirLibraryBinaryTestConfigurator : AnalysisApiTestConfigurator
|
||||
builder.apply {
|
||||
useAdditionalService<KtModuleFactory> { KtLibraryBinaryModuleFactory }
|
||||
configureLibraryCompilationSupport(this)
|
||||
configureOptionalTestCompilerPlugin()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -158,7 +158,12 @@ abstract class SymbolLightClassForClassLike<SType : KtClassOrObjectSymbol> prote
|
||||
|
||||
override val originKind: LightClassOriginKind get() = LightClassOriginKind.SOURCE
|
||||
|
||||
override fun getQualifiedName(): String? = classOrObjectDeclaration?.fqName?.asString()
|
||||
override fun getQualifiedName(): String? {
|
||||
val classOrObjectFqName = classOrObjectDeclaration?.fqName
|
||||
?: withClassOrObjectSymbol { s -> s.classIdIfNonLocal?.asSingleFqName() }
|
||||
|
||||
return classOrObjectFqName?.toString()
|
||||
}
|
||||
|
||||
override fun getInterfaces(): Array<PsiClass> = PsiClassImplUtil.getInterfaces(this)
|
||||
override fun getSuperClass(): PsiClass? = PsiClassImplUtil.getSuperClass(this)
|
||||
|
||||
+6
@@ -616,5 +616,11 @@ public class SymbolLightClassesByFqNameForLibraryTestGenerated extends AbstractS
|
||||
public void testAllOpen() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/allOpen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt")
|
||||
public void testCompanionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -616,5 +616,11 @@ public class SymbolLightClassesEqualityByFqNameForLibraryTestGenerated extends A
|
||||
public void testAllOpen() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/allOpen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt")
|
||||
public void testCompanionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -616,5 +616,11 @@ public class SymbolLightClassesParentingByFqNameForLibraryTestGenerated extends
|
||||
public void testAllOpen() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/allOpen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt")
|
||||
public void testCompanionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -806,5 +806,11 @@ public class SymbolLightClassesByFqNameForSourceTestGenerated extends AbstractSy
|
||||
public void testAllOpen() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/allOpen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt")
|
||||
public void testCompanionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -806,5 +806,11 @@ public class SymbolLightClassesEqualityByFqNameForSourceTestGenerated extends Ab
|
||||
public void testAllOpen() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/allOpen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt")
|
||||
public void testCompanionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -806,5 +806,11 @@ public class SymbolLightClassesParentingByFqNameForSourceTestGenerated extends A
|
||||
public void testAllOpen() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/allOpen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt")
|
||||
public void testCompanionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/withTestCompilerPluginEnabled/companionWithFoo_companionTypeUsedInJava_ReferenceFromKotlin.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user