Provide proper platformSpecficContainer in CompositePlatformConfigurator
Now, call 'configureDefaultCheckers' and 'configureExtensionsAndCheckers' from all childs configurators, instead of taking just container from CommonPlatformAnalyzerServices This is needed because some IDE services tend to re-create containers (in particular, PerFileAnalysisCache and ResolveElementCache do that to re-inject new trace) and use usual injection DSL, which, in particular, takes 'platformSpecificContainer'. Returning 'common'-conatiner leads to losing all platform-specific checkers. On the other hand, calling exactly 'configureDefaultCheckers' + 'configureExtensionsAndCheckers' should be correct, because that's how single-platform 'platformSpecificContainer' is composed (see PlatformConfiguratorBase), and in 'createContainerForCompositePlatform' we don't use 'platformSpecificContainer' anyways ^KT-23305 Fixed
This commit is contained in:
+6
-5
@@ -236,12 +236,13 @@ class CompositeAnalyzerServices(val services: List<PlatformDependentAnalyzerServ
|
||||
}
|
||||
|
||||
class CompositePlatformConigurator(private val componentConfigurators: List<PlatformConfigurator>) : PlatformConfigurator {
|
||||
// TODO(dsavvinov): this is actually a hack. Review callers of that method, think about how to refactor it
|
||||
// Unfortunately, clients of that container will inject additional services into them,
|
||||
// without knowing about composite platform (see LocalClassifierAnalyzer), so we can't just use [createContainerForCompositePlatform]
|
||||
// here. Hopefully, platformSpecific container won't at least make things worse.
|
||||
override val platformSpecificContainer: StorageComponentContainer
|
||||
get() = CommonPlatformAnalyzerServices.platformConfigurator.platformSpecificContainer
|
||||
get() = composeContainer(this::class.java.simpleName) {
|
||||
configureDefaultCheckers()
|
||||
for (configurator in componentConfigurators) {
|
||||
(configurator as PlatformConfiguratorBase).configureExtensionsAndCheckers(this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun configureModuleComponents(container: StorageComponentContainer) {
|
||||
componentConfigurators.forEach { it.configureModuleComponents(container) }
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// !DIAGNOSTICS: -ABSTRACT_MEMBER_NOT_IMPLEMENTED
|
||||
|
||||
// Implementing kotlin functions isn't allowed on JS
|
||||
class <!IMPLEMENTING_FUNCTION_INTERFACE!>A<!> : (Int) -> Int
|
||||
|
||||
// Array as upper bound isn't allowed on JVM
|
||||
class B<<!UPPER_BOUND_CANNOT_BE_ARRAY!>T : Array<*><!>>
|
||||
@@ -0,0 +1 @@
|
||||
MODULE common { platform=[JS, JVM, Native] }
|
||||
Generated
+5
@@ -94,6 +94,11 @@ public class MultiplatformAnalysisTestGenerated extends AbstractMultiplatformAna
|
||||
runTest("idea/testData/multiplatform/multilevelParents/");
|
||||
}
|
||||
|
||||
@TestMetadata("platformSpecificChecksInCommon")
|
||||
public void testPlatformSpecificChecksInCommon() throws Exception {
|
||||
runTest("idea/testData/multiplatform/platformSpecificChecksInCommon/");
|
||||
}
|
||||
|
||||
@TestMetadata("qualifiedReceiver")
|
||||
public void testQualifiedReceiver() throws Exception {
|
||||
runTest("idea/testData/multiplatform/qualifiedReceiver/");
|
||||
|
||||
Reference in New Issue
Block a user