From 0fc8023f18ea7fffb237b7d91cacb1a44ec3625f Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Wed, 2 Sep 2015 02:45:14 +0300 Subject: [PATCH] Use LoggingStorageManager only if necessary --- .../checkers/AbstractJetDiagnosticsTest.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/AbstractJetDiagnosticsTest.java b/compiler/tests/org/jetbrains/kotlin/checkers/AbstractJetDiagnosticsTest.java index 7414f11fba9..6520c574165 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/AbstractJetDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/AbstractJetDiagnosticsTest.java @@ -89,15 +89,30 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest { } ); - LazyOperationsLog lazyOperationsLog = new LazyOperationsLog(HASH_SANITIZER); + boolean checkLazyResolveLog = KotlinPackage.any(testFiles, new Function1() { + @Override + public Boolean invoke(TestFile file) { + return file.checkLazyLog; + } + }); + + LazyOperationsLog lazyOperationsLog = null; + GlobalContext context; + ExceptionTracker tracker = new ExceptionTracker(); - GlobalContext context = new SimpleGlobalContext( - new LoggingStorageManager( - LockBasedStorageManager.createWithExceptionHandling(tracker), - lazyOperationsLog.getAddRecordFunction() - ), - tracker - ); + if (checkLazyResolveLog) { + lazyOperationsLog = new LazyOperationsLog(HASH_SANITIZER); + context = new SimpleGlobalContext( + new LoggingStorageManager( + LockBasedStorageManager.createWithExceptionHandling(tracker), + lazyOperationsLog.getAddRecordFunction() + ), + tracker + ); + } + else { + context = new SimpleGlobalContext(LockBasedStorageManager.createWithExceptionHandling(tracker), tracker); + } Map modules = createModules(groupedByModule, context.getStorageManager()); Map moduleBindings = new HashMap(); @@ -123,12 +138,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest { // We want to always create a test data file (txt) if it was missing, // but don't want to skip the following checks in case this one fails Throwable exceptionFromLazyResolveLogValidation = null; - if (KotlinPackage.any(testFiles, new Function1() { - @Override - public Boolean invoke(TestFile file) { - return file.checkLazyLog; - } - })) { + if (checkLazyResolveLog) { exceptionFromLazyResolveLogValidation = checkLazyResolveLog(lazyOperationsLog, testDataFile); } else {