Drop ExternalDeclarationsProvider
It was added for Android extensions, but now another mechanism is used there (PackageFragmentProviderExtension), and there were no other implementations of ExternalDeclarationsProvider in the project
This commit is contained in:
@@ -76,7 +76,6 @@ import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinderFactory
|
||||
@@ -170,7 +169,6 @@ class KotlinCoreEnvironment private constructor(
|
||||
|
||||
project.registerService(JvmVirtualFileFinderFactory::class.java, JvmCliVirtualFileFinderFactory(rootsIndex))
|
||||
|
||||
ExternalDeclarationsProvider.registerExtensionPoint(project)
|
||||
ExpressionCodegenExtension.registerExtensionPoint(project)
|
||||
ClassBuilderInterceptorExtension.registerExtensionPoint(project)
|
||||
AnalysisCompletedHandlerExtension.registerExtensionPoint(project)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.resolve.jvm
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analyzer.*
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
|
||||
@@ -26,11 +25,9 @@ import org.jetbrains.kotlin.context.ModuleContext
|
||||
import org.jetbrains.kotlin.descriptors.PackagePartProvider
|
||||
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.frontend.java.di.createContainerForLazyResolveWithJava
|
||||
import org.jetbrains.kotlin.load.java.lazy.ModuleClassResolverImpl
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
@@ -38,7 +35,6 @@ import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtens
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService
|
||||
import java.util.*
|
||||
|
||||
class JvmPlatformParameters(
|
||||
val moduleByJavaClass: (JavaClass) -> ModuleInfo?
|
||||
@@ -58,9 +54,8 @@ object JvmAnalyzerFacade : AnalyzerFacade<JvmPlatformParameters>() {
|
||||
): ResolverForModule {
|
||||
val (syntheticFiles, moduleContentScope) = moduleContent
|
||||
val project = moduleContext.project
|
||||
val filesToAnalyze = getAllFilesToAnalyze(project, moduleInfo, syntheticFiles)
|
||||
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
|
||||
project, moduleContext.storageManager, filesToAnalyze,
|
||||
project, moduleContext.storageManager, syntheticFiles,
|
||||
if (moduleInfo.isLibrary) GlobalSearchScope.EMPTY_SCOPE else moduleContentScope
|
||||
)
|
||||
|
||||
@@ -106,14 +101,6 @@ object JvmAnalyzerFacade : AnalyzerFacade<JvmPlatformParameters>() {
|
||||
return ResolverForModule(CompositePackageFragmentProvider(providersForModule), container)
|
||||
}
|
||||
|
||||
@JvmStatic fun getAllFilesToAnalyze(project: Project, moduleInfo: ModuleInfo?, baseFiles: Collection<KtFile>): List<KtFile> {
|
||||
val allFiles = ArrayList(baseFiles)
|
||||
for (externalDeclarationsProvider in ExternalDeclarationsProvider.getInstances(project)) {
|
||||
allFiles.addAll(externalDeclarationsProvider.getExternalDeclarations(moduleInfo))
|
||||
}
|
||||
return allFiles
|
||||
}
|
||||
|
||||
override val targetPlatform: TargetPlatform
|
||||
get() = JvmPlatform
|
||||
|
||||
|
||||
+2
-3
@@ -69,10 +69,9 @@ public enum TopDownAnalyzerFacadeForJVM {
|
||||
@NotNull PackagePartProvider packagePartProvider
|
||||
) {
|
||||
Project project = moduleContext.getProject();
|
||||
List<KtFile> allFiles = JvmAnalyzerFacade.getAllFilesToAnalyze(project, null, files);
|
||||
|
||||
FileBasedDeclarationProviderFactory providerFactory =
|
||||
new FileBasedDeclarationProviderFactory(moduleContext.getStorageManager(), allFiles);
|
||||
new FileBasedDeclarationProviderFactory(moduleContext.getStorageManager(), files);
|
||||
|
||||
IncrementalCompilationComponents incrementalCompilationComponents =
|
||||
configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS);
|
||||
@@ -128,7 +127,7 @@ public enum TopDownAnalyzerFacadeForJVM {
|
||||
if (provider != null) additionalProviders.add(provider);
|
||||
}
|
||||
|
||||
container.getLazyTopDownAnalyzerForTopLevel().analyzeFiles(TopDownAnalysisMode.TopLevelDeclarations, allFiles, additionalProviders);
|
||||
container.getLazyTopDownAnalyzerForTopLevel().analyzeFiles(TopDownAnalysisMode.TopLevelDeclarations, files, additionalProviders);
|
||||
|
||||
BindingContext bindingContext = trace.getBindingContext();
|
||||
ModuleDescriptor module = moduleContext.getModule();
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.extensions
|
||||
|
||||
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
interface ExternalDeclarationsProvider {
|
||||
companion object : ProjectExtensionDescriptor<ExternalDeclarationsProvider>(
|
||||
"org.jetbrains.kotlin.externalDeclarationsProvider",
|
||||
ExternalDeclarationsProvider::class.java
|
||||
)
|
||||
|
||||
fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<KtFile>
|
||||
}
|
||||
@@ -8,9 +8,6 @@
|
||||
interface="org.jetbrains.kotlin.resolve.diagnostics.SuppressStringProvider"/>
|
||||
<extensionPoint name="diagnosticSuppressor"
|
||||
interface="org.jetbrains.kotlin.resolve.diagnostics.DiagnosticSuppressor"/>
|
||||
<extensionPoint name="externalDeclarationsProvider"
|
||||
interface="org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider"
|
||||
area="IDEA_PROJECT"/>
|
||||
<extensionPoint name="expressionCodegenExtension"
|
||||
interface="org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension"
|
||||
area="IDEA_PROJECT"/>
|
||||
|
||||
-1
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.compiler.plugin.CliOptionProcessingException
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.com.intellij.mock.MockProject
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
|
||||
|
||||
public object ExampleConfigurationKeys {
|
||||
|
||||
Reference in New Issue
Block a user