diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java b/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java index 15e07a425db..7a9278895c4 100644 --- a/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java +++ b/idea/src/org/jetbrains/jet/plugin/caches/resolve/IDELightClassGenerationSupport.java @@ -134,8 +134,16 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport return new LightClassConstructionContext(session.getBindingContext(), null); } else { - KotlinCacheManager cacheManager = KotlinCacheManager.getInstance(project); - return new LightClassConstructionContext(cacheManager.getLightClassContextCache().getLightClassBindingContext(classOrObject), null); + BindingContext bindingContext; + if (JetPsiUtil.isLocal(classOrObject)) { + bindingContext = AnalyzerFacadeWithCache.getContextForElement(classOrObject); + } + else { + bindingContext = KotlinCacheManager.getInstance(project) + .getPossiblyIncompleteDeclarationsForLightClassGeneration().getBindingContext(); + } + + return new LightClassConstructionContext(bindingContext, null); } } finally { diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java index 21dc4c50980..5d000a91cf3 100644 --- a/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java +++ b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinCacheManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 JetBrains s.r.o. + * Copyright 2010-2014 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. @@ -23,7 +23,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.DefaultModificationTracker; import com.intellij.openapi.util.ModificationTracker; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.asJava.KotlinLightClassContextCache; import org.jetbrains.jet.plugin.project.TargetPlatform; import java.util.Map; @@ -35,14 +34,12 @@ public class KotlinCacheManager { } private final Map cacheProviders = Maps.newHashMap(); - private final KotlinLightClassContextCache lightClassContextCache; private final DefaultModificationTracker kotlinDeclarationsTracker = new DefaultModificationTracker(); public KotlinCacheManager(@NotNull Project project) { cacheProviders.put(TargetPlatform.JVM, new JvmDeclarationsCacheProvider(project)); cacheProviders.put(TargetPlatform.JS, new JSDeclarationsCacheProvider(project)); - lightClassContextCache = new KotlinLightClassContextCache(project); } /** @@ -88,10 +85,6 @@ public class KotlinCacheManager { return provider; } - public KotlinLightClassContextCache getLightClassContextCache() { - return lightClassContextCache; - } - public void invalidateCache() { kotlinDeclarationsTracker.incModificationCount(); } diff --git a/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinLightClassContextCache.kt b/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinLightClassContextCache.kt deleted file mode 100644 index 911cc4b3e10..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/caches/resolve/KotlinLightClassContextCache.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2010-2014 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.jet.lang.resolve.BindingContext -import org.jetbrains.jet.lang.psi.JetClassOrObject -import com.intellij.openapi.project.Project -import org.jetbrains.jet.lang.psi.JetPsiUtil -import org.jetbrains.jet.plugin.caches.resolve.KotlinCacheManager -import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache - -class KotlinLightClassContextCache(val project: Project) { - public fun getLightClassBindingContext(classOrObject: JetClassOrObject): BindingContext { - if (JetPsiUtil.isLocal(classOrObject)) { - return AnalyzerFacadeWithCache.getContextForElement(classOrObject) - } - - return KotlinCacheManager.getInstance(project).getPossiblyIncompleteDeclarationsForLightClassGeneration().getBindingContext() - } - -}