Implement stub based package declaration provider for lazy resolve

Implement StubPackageMemberDeclarationProvider
Introduce DeclarationProviderFactoryService to provide difference factories in CLI and Plugin
When indexing treat top level declarations without name specially so that they can be found in index
Implement PluginDeclarationProviderFactoryService which uses file based approach for non indexed files and stub based for others
This commit is contained in:
Pavel V. Talanov
2014-03-17 17:53:30 +04:00
parent fd5aea7c14
commit 246466bdc5
32 changed files with 520 additions and 297 deletions
@@ -57,6 +57,8 @@ import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.java.JetFilesProvider;
import org.jetbrains.jet.lang.resolve.kotlin.KotlinBinaryClassCache;
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder;
import org.jetbrains.jet.lang.resolve.lazy.declarations.CliDeclarationProviderFactoryService;
import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFactoryService;
import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.utils.PathUtil;
@@ -75,7 +77,10 @@ public class JetCoreEnvironment {
private static int ourProjectCount = 0;
@NotNull
public static JetCoreEnvironment createForProduction(@NotNull Disposable parentDisposable, @NotNull CompilerConfiguration configuration) {
public static JetCoreEnvironment createForProduction(
@NotNull Disposable parentDisposable,
@NotNull CompilerConfiguration configuration
) {
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
// All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well
Disposer.register(parentDisposable, new Disposable() {
@@ -88,7 +93,8 @@ public class JetCoreEnvironment {
}
}
});
JetCoreEnvironment environment = new JetCoreEnvironment(parentDisposable, getOrCreateApplicationEnvironmentForProduction(), configuration);
JetCoreEnvironment environment =
new JetCoreEnvironment(parentDisposable, getOrCreateApplicationEnvironmentForProduction(), configuration);
synchronized (APPLICATION_LOCK) {
ourProjectCount++;
}
@@ -146,6 +152,8 @@ public class JetCoreEnvironment {
applicationEnvironment.getApplication().registerService(OperationModeProvider.class, new CompilerModeProvider());
applicationEnvironment.getApplication().registerService(KotlinBinaryClassCache.class, new KotlinBinaryClassCache());
applicationEnvironment.getApplication().registerService(DeclarationProviderFactoryService.class,
new CliDeclarationProviderFactoryService());
return applicationEnvironment;
}
@@ -185,7 +193,7 @@ public class JetCoreEnvironment {
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME,
ClsCustomNavigationPolicy.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME,
ClassFileDecompilers.Decompiler.class);
ClassFileDecompilers.Decompiler.class);
annotationsManager = new CoreExternalAnnotationsManager(project.getComponent(PsiManager.class));
project.registerService(ExternalAnnotationsManager.class, annotationsManager);