diff --git a/compiler/frontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java b/compiler/frontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java index f333e37bce6..5f376e442a8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java +++ b/compiler/frontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java @@ -24,6 +24,7 @@ import org.jetbrains.jet.lang.resolve.BodiesResolveContext; import org.jetbrains.jet.lang.types.ErrorUtils; public class AnalyzeExhaust { + public static final AnalyzeExhaust EMPTY = success(BindingContext.EMPTY, ErrorUtils.getErrorModule()); public static AnalyzeExhaust success(@NotNull BindingContext bindingContext, @NotNull ModuleDescriptor module) { return new AnalyzeExhaust(bindingContext, module, null, null); @@ -69,6 +70,7 @@ public class AnalyzeExhaust { @NotNull public Throwable getError() { + if (error == null) throw new IllegalStateException("Should be called only for error analyze result"); return error; } diff --git a/idea/src/org/jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java b/idea/src/org/jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java index c6dcbdcb7ea..8bc47acdb32 100644 --- a/idea/src/org/jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java +++ b/idea/src/org/jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java @@ -45,7 +45,6 @@ import org.jetbrains.jet.lang.resolve.*; import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; import org.jetbrains.jet.lang.resolve.java.JetFilesProvider; import org.jetbrains.jet.lang.resolve.lazy.ResolveSession; -import org.jetbrains.jet.lang.types.ErrorUtils; import org.jetbrains.jet.plugin.caches.resolve.*; import org.jetbrains.jet.plugin.util.ApplicationUtils; @@ -162,13 +161,12 @@ public final class AnalyzerFacadeWithCache { public AnalyzeExhaust createValue(JetFile file) { try { if (DumbService.isDumb(file.getProject())) { - return emptyExhaust(); + return AnalyzeExhaust.EMPTY; } ApplicationUtils.warnTimeConsuming(LOG); AnalyzeExhaust analyzeExhaustHeaders = analyzeHeadersWithCacheOnFile(file); - return analyzeBodies(analyzeExhaustHeaders, file); } catch (ProcessCanceledException e) { @@ -183,10 +181,6 @@ public final class AnalyzerFacadeWithCache { return Result.create(cache, PsiModificationTracker.MODIFICATION_COUNT); } - private static AnalyzeExhaust emptyExhaust() { - return AnalyzeExhaust.success(BindingContext.EMPTY, ErrorUtils.getErrorModule()); - } - private static AnalyzeExhaust analyzeHeadersWithCacheOnFile(@NotNull JetFile fileToCache) { VirtualFile virtualFile = fileToCache.getVirtualFile(); if (LightClassUtil.belongsToKotlinBuiltIns(fileToCache) ||