From 7c4d1e6b09676ff35433351c25e5df36f510b7a4 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Mon, 17 Dec 2012 17:31:56 +0400 Subject: [PATCH] KotlinCacheManager and LightClassGenerationSupport services added --- .../CliLightClassGenerationSupport.java | 70 ++++++++++++++++ .../cli/jvm/compiler/JetCoreEnvironment.java | 6 ++ .../compiler/KotlinToJVMBytecodeCompiler.java | 6 +- .../resolve/java/AnalyzerFacadeForJVM.java | 16 +++- .../jetbrains/jet/asJava/JetLightClass.java | 13 ++- .../asJava/LightClassConstructionContext.java | 41 +++++++++ .../asJava/LightClassGenerationSupport.java | 33 ++++++++ idea/src/META-INF/plugin.xml | 6 ++ ...alyzeExhaustAsKotlinDeclarationsCache.java | 57 +++++++++++++ .../IDELightClassGenerationSupport.java | 33 ++++++++ .../caches/resolve/KotlinCacheManager.java | 83 +++++++++++++++++++ .../resolve/KotlinDeclarationsCache.java | 18 ++++ 12 files changed, 371 insertions(+), 11 deletions(-) create mode 100644 compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CliLightClassGenerationSupport.java create mode 100644 compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassConstructionContext.java create mode 100644 compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationSupport.java create mode 100644 idea/src/org/jetbrains/jet/plugin/caches/resolve/AnalyzeExhaustAsKotlinDeclarationsCache.java create mode 100644 idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java create mode 100644 idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java create mode 100644 idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinDeclarationsCache.java diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CliLightClassGenerationSupport.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CliLightClassGenerationSupport.java new file mode 100644 index 00000000000..033b6606271 --- /dev/null +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CliLightClassGenerationSupport.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010-2012 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.jet.cli.jvm.compiler; + +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.asJava.LightClassConstructionContext; +import org.jetbrains.jet.asJava.LightClassGenerationSupport; +import org.jetbrains.jet.lang.psi.JetFile; +import org.jetbrains.jet.lang.resolve.BindingTrace; +import org.jetbrains.jet.lang.resolve.BindingTraceContext; + +/** + * This class solves the problem of interdependency between analyzing Kotlin code and generating JetLightClasses + * + * Consider the following example: + * + * KClass.kt refers to JClass.java and vice versa + * + * To analyze KClass.kt we need to load descriptors from JClass.java, and to do that we need a JetLightClass instance for KClass, + * which can only be constructed when the structure of KClass is known. + * + * To mitigate this, CliLightClassGenerationSupport hold a trace that is shared between the analyzer and JetLightClasses + */ +public class CliLightClassGenerationSupport extends LightClassGenerationSupport { + + public static CliLightClassGenerationSupport getInstanceForCli(@NotNull Project project) { + return ServiceManager.getService(project, CliLightClassGenerationSupport.class); + } + + private BindingTrace trace; + + public CliLightClassGenerationSupport() { + } + + @NotNull + public BindingTrace getTrace() { + if (trace == null) { + trace = new BindingTraceContext(); + } + return trace; + } + + public void clearBindingTrace() { + assert ApplicationManager.getApplication().isUnitTestMode() : "Mutating project service's state shouldn't happen other than in tests"; + trace = null; + } + + @NotNull + @Override + public LightClassConstructionContext analyzeRelevantCode(@NotNull JetFile file) { + return new LightClassConstructionContext(getTrace().getBindingContext(), null); + } +} diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java index ba32e810019..2975abb4c35 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java @@ -36,6 +36,7 @@ import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy; import com.intellij.psi.impl.file.impl.JavaFileManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.asJava.JavaElementFinder; +import org.jetbrains.jet.asJava.LightClassGenerationSupport; import org.jetbrains.jet.cli.common.CLIConfigurationKeys; import org.jetbrains.jet.cli.common.messages.CompilerMessageLocation; import org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity; @@ -86,6 +87,11 @@ public class JetCoreEnvironment { project.registerService(JetScriptDefinitionProvider.class, new JetScriptDefinitionProvider()); project.registerService(JetFilesProvider.class, new CliJetFilesProvider(this)); project.registerService(CoreJavaFileManager.class, (CoreJavaFileManager) ServiceManager.getService(project, JavaFileManager.class)); + + CliLightClassGenerationSupport cliLightClassGenerationSupport = new CliLightClassGenerationSupport(); + project.registerService(LightClassGenerationSupport.class, cliLightClassGenerationSupport); + project.registerService(CliLightClassGenerationSupport.class, cliLightClassGenerationSupport); + Extensions.getArea(project) .getExtensionPoint(PsiElementFinder.EP_NAME) .registerExtension(new JavaElementFinder(project)); diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java index 86357e48405..f7d443c1d90 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java @@ -44,6 +44,7 @@ import org.jetbrains.jet.lang.parsing.JetScriptDefinitionProvider; import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetPsiUtil; import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter; +import org.jetbrains.jet.lang.resolve.BindingTrace; import org.jetbrains.jet.lang.resolve.ScriptNameUtil; import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; import org.jetbrains.jet.lang.resolve.java.JvmAbi; @@ -311,11 +312,14 @@ public class KotlinToJVMBytecodeCompiler { @NotNull @Override public AnalyzeExhaust invoke() { + BindingTrace sharedTrace = CliLightClassGenerationSupport.getInstanceForCli(environment.getProject()).getTrace(); return AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration( environment.getProject(), environment.getSourceFiles(), + sharedTrace, scriptParameters, - filesToAnalyzeCompletely + filesToAnalyzeCompletely, + false ); } }, environment.getSourceFiles() diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java index 707c5ab576e..79751d612d7 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java @@ -189,6 +189,18 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade { boolean storeContextForBodiesResolve) { BindingTraceContext bindingTraceContext = new BindingTraceContext(); + return analyzeFilesWithJavaIntegration(project, files, bindingTraceContext, scriptParameters, filesToAnalyzeCompletely, + storeContextForBodiesResolve); + } + + public static AnalyzeExhaust analyzeFilesWithJavaIntegration( + Project project, + Collection files, + BindingTrace trace, + List scriptParameters, + Predicate filesToAnalyzeCompletely, + boolean storeContextForBodiesResolve + ) { final ModuleDescriptor owner = new ModuleDescriptor(Name.special("")); TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters( @@ -196,13 +208,13 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade { InjectorForTopDownAnalyzerForJvm injector = new InjectorForTopDownAnalyzerForJvm( project, topDownAnalysisParameters, - new ObservableBindingTrace(bindingTraceContext), owner); + new ObservableBindingTrace(trace), owner); try { injector.getTopDownAnalyzer().analyzeFiles(files, scriptParameters); BodiesResolveContext bodiesResolveContext = storeContextForBodiesResolve ? new CachedBodiesResolveContext(injector.getTopDownAnalysisContext()) : null; - return AnalyzeExhaust.success(bindingTraceContext.getBindingContext(), bodiesResolveContext, injector.getModuleConfiguration()); + return AnalyzeExhaust.success(trace.getBindingContext(), bodiesResolveContext, injector.getModuleConfiguration()); } finally { injector.destroy(); } diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java index 829c86d32af..9f71c5960ec 100644 --- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java +++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java @@ -36,7 +36,6 @@ import com.intellij.psi.util.*; import com.intellij.util.containers.Stack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.analyzer.AnalyzeExhaust; import org.jetbrains.jet.codegen.ClassBuilder; import org.jetbrains.jet.codegen.ClassBuilderFactory; import org.jetbrains.jet.codegen.ClassBuilderMode; @@ -45,8 +44,6 @@ import org.jetbrains.jet.codegen.binding.PsiCodegenPredictor; import org.jetbrains.jet.codegen.state.GenerationState; import org.jetbrains.jet.codegen.state.GenerationStrategy; import org.jetbrains.jet.lang.psi.*; -import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; -import org.jetbrains.jet.lang.resolve.java.JetFilesProvider; import org.jetbrains.jet.lang.resolve.java.JetJavaMirrorMarker; import org.jetbrains.jet.lang.resolve.java.JvmClassName; import org.jetbrains.jet.lang.resolve.name.FqName; @@ -208,15 +205,15 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa // The context must reflect _all files in the module_. not only the current file // Otherwise, the analyzer gets confused and can't, for example, tell which files come as sources and which // must be loaded from .class files - AnalyzeExhaust exhaust = AnalyzerFacadeForJVM.shallowAnalyzeFiles( - JetFilesProvider.getInstance(project).sampleToAllFilesInModule().fun(file)); + LightClassConstructionContext context = LightClassGenerationSupport.getInstance(project).analyzeRelevantCode(file); - if (exhaust.isError()) { - throw new IllegalStateException("failed to analyze: " + exhaust.getError(), exhaust.getError()); + Throwable error = context.getError(); + if (error != null) { + throw new IllegalStateException("failed to analyze: " + error, error); } try { - GenerationState state = new GenerationState(project, builderFactory, exhaust.getBindingContext(), Collections.singletonList(file)); + GenerationState state = new GenerationState(project, builderFactory, context.getBindingContext(), Collections.singletonList(file)); GenerationStrategy strategy = new LightClassGenerationStrategy(this, stubStack, answer); strategy.compileCorrectFiles(state, CompilationErrorHandler.THROW_EXCEPTION); diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassConstructionContext.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassConstructionContext.java new file mode 100644 index 00000000000..b50797e9ce7 --- /dev/null +++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassConstructionContext.java @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2012 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.jet.asJava; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.lang.resolve.BindingContext; + +public class LightClassConstructionContext { + private final BindingContext bindingContext; + private final Throwable error; + + public LightClassConstructionContext(@NotNull BindingContext bindingContext, @Nullable Throwable error) { + this.bindingContext = bindingContext; + this.error = error; + } + + @NotNull + public BindingContext getBindingContext() { + return bindingContext; + } + + @Nullable + public Throwable getError() { + return error; + } +} diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationSupport.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationSupport.java new file mode 100644 index 00000000000..2f921924ac5 --- /dev/null +++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationSupport.java @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2012 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.jet.asJava; + +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.psi.JetFile; + +public abstract class LightClassGenerationSupport { + + @NotNull + public static LightClassGenerationSupport getInstance(@NotNull Project project) { + return ServiceManager.getService(project, LightClassGenerationSupport.class); + } + + @NotNull + public abstract LightClassConstructionContext analyzeRelevantCode(@NotNull JetFile file); +} diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 5c8a6afbb19..86b4135d9b1 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -79,6 +79,12 @@ + + + + diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/AnalyzeExhaustAsKotlinDeclarationsCache.java b/idea/src/org/jetbrains/jet/plugin/caches/resolve/AnalyzeExhaustAsKotlinDeclarationsCache.java new file mode 100644 index 00000000000..d270b8290cb --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/caches/resolve/AnalyzeExhaustAsKotlinDeclarationsCache.java @@ -0,0 +1,57 @@ +/* + * Copyright 2010-2012 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.jet.plugin.caches.resolve; + +import com.intellij.openapi.diagnostic.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.analyzer.AnalyzeExhaust; +import org.jetbrains.jet.lang.ModuleConfiguration; +import org.jetbrains.jet.lang.resolve.BindingContext; +import org.jetbrains.jet.lang.resolve.BodiesResolveContext; + +public class AnalyzeExhaustAsKotlinDeclarationsCache implements KotlinDeclarationsCache { + + private static final Logger LOG = Logger.getInstance(AnalyzeExhaustAsKotlinDeclarationsCache.class); + + private final AnalyzeExhaust exhaust; + + public AnalyzeExhaustAsKotlinDeclarationsCache(@NotNull AnalyzeExhaust exhaust) { + this.exhaust = exhaust; + if (exhaust.isError()) { + LOG.error(exhaust.getError()); + } + } + + @Nullable + @Override + public BodiesResolveContext getBodiesResolveContext() { + return exhaust.getBodiesResolveContext(); + } + + @Override + @NotNull + public BindingContext getBindingContext() { + return exhaust.getBindingContext(); + } + + @Override + @NotNull + public ModuleConfiguration getModuleConfiguration() { + return exhaust.getModuleConfiguration(); + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java b/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java new file mode 100644 index 00000000000..4990ef7833c --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2012 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.jet.plugin.caches.resolve; + +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.asJava.LightClassConstructionContext; +import org.jetbrains.jet.asJava.LightClassGenerationSupport; +import org.jetbrains.jet.lang.psi.JetFile; + +public class IDELightClassGenerationSupport extends LightClassGenerationSupport { + @NotNull + @Override + public LightClassConstructionContext analyzeRelevantCode(@NotNull JetFile file) { + Project project = file.getProject(); + KotlinDeclarationsCache cache = KotlinCacheManager.getInstance(project).getDeclarationsFromProject(project); + return new LightClassConstructionContext(cache.getBindingContext(), null); + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java new file mode 100644 index 00000000000..d629a09ac3f --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java @@ -0,0 +1,83 @@ +/* + * Copyright 2010-2012 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.jet.plugin.caches.resolve; + +import com.google.common.base.Predicates; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Key; +import com.intellij.psi.PsiFile; +import com.intellij.psi.search.GlobalSearchScope; +import com.intellij.psi.util.CachedValue; +import com.intellij.psi.util.CachedValueProvider; +import com.intellij.psi.util.CachedValuesManager; +import com.intellij.psi.util.PsiModificationTracker; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.analyzer.AnalyzeExhaust; +import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter; +import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; +import org.jetbrains.jet.lang.resolve.java.JetFilesProvider; + +import java.util.Collections; + +public class KotlinCacheManager { + + public static KotlinCacheManager getInstance(@NotNull Project project) { + return ServiceManager.getService(project, KotlinCacheManager.class); + } + + private final Key> KOTLIN_DECLARATIONS_CACHE = Key.create("KOTLIN_DECLARATIONS_CACHE"); + + private final Project project; + private final Object declarationAnalysisLock = new Object(); + + + public KotlinCacheManager(@NotNull Project project) { + this.project = project; + } + + @NotNull + public KotlinDeclarationsCache getDeclarationsFromProject(@NotNull Project project) { + synchronized (declarationAnalysisLock) { + return CachedValuesManager.getManager(project).getCachedValue( + project, + KOTLIN_DECLARATIONS_CACHE, + new KotlinDeclarationsCacheProvider(), + false + ); + } + } + + private class KotlinDeclarationsCacheProvider implements CachedValueProvider { + @Nullable + @Override + public Result compute() { + AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.INSTANCE.analyzeFiles( + project, + JetFilesProvider.getInstance(project).allInScope(GlobalSearchScope.allScope(project)), + Collections.emptyList(), + Predicates.alwaysFalse() + ); + return Result.create( + new AnalyzeExhaustAsKotlinDeclarationsCache(analyzeExhaust), + PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT + ); + } + + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinDeclarationsCache.java b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinDeclarationsCache.java new file mode 100644 index 00000000000..fc00d77f4d6 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinDeclarationsCache.java @@ -0,0 +1,18 @@ +package org.jetbrains.jet.plugin.caches.resolve; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.lang.ModuleConfiguration; +import org.jetbrains.jet.lang.resolve.BindingContext; +import org.jetbrains.jet.lang.resolve.BodiesResolveContext; + +public interface KotlinDeclarationsCache { + @NotNull + BindingContext getBindingContext(); + + @Nullable + BodiesResolveContext getBodiesResolveContext(); + + @NotNull @Deprecated // ModuleConfiguration must be obtained from the module + ModuleConfiguration getModuleConfiguration(); +}