Use LoggingStorageManager only if necessary

This commit is contained in:
Stanislav Erokhin
2015-09-02 02:45:14 +03:00
parent acbc39bf9f
commit 0fc8023f18
@@ -89,15 +89,30 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
} }
); );
LazyOperationsLog lazyOperationsLog = new LazyOperationsLog(HASH_SANITIZER); boolean checkLazyResolveLog = KotlinPackage.any(testFiles, new Function1<TestFile, Boolean>() {
@Override
public Boolean invoke(TestFile file) {
return file.checkLazyLog;
}
});
LazyOperationsLog lazyOperationsLog = null;
GlobalContext context;
ExceptionTracker tracker = new ExceptionTracker(); ExceptionTracker tracker = new ExceptionTracker();
GlobalContext context = new SimpleGlobalContext( if (checkLazyResolveLog) {
new LoggingStorageManager( lazyOperationsLog = new LazyOperationsLog(HASH_SANITIZER);
LockBasedStorageManager.createWithExceptionHandling(tracker), context = new SimpleGlobalContext(
lazyOperationsLog.getAddRecordFunction() new LoggingStorageManager(
), LockBasedStorageManager.createWithExceptionHandling(tracker),
tracker lazyOperationsLog.getAddRecordFunction()
); ),
tracker
);
}
else {
context = new SimpleGlobalContext(LockBasedStorageManager.createWithExceptionHandling(tracker), tracker);
}
Map<TestModule, ModuleDescriptorImpl> modules = createModules(groupedByModule, context.getStorageManager()); Map<TestModule, ModuleDescriptorImpl> modules = createModules(groupedByModule, context.getStorageManager());
Map<TestModule, BindingContext> moduleBindings = new HashMap<TestModule, BindingContext>(); Map<TestModule, BindingContext> moduleBindings = new HashMap<TestModule, BindingContext>();
@@ -123,12 +138,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
// We want to always create a test data file (txt) if it was missing, // 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 // but don't want to skip the following checks in case this one fails
Throwable exceptionFromLazyResolveLogValidation = null; Throwable exceptionFromLazyResolveLogValidation = null;
if (KotlinPackage.any(testFiles, new Function1<TestFile, Boolean>() { if (checkLazyResolveLog) {
@Override
public Boolean invoke(TestFile file) {
return file.checkLazyLog;
}
})) {
exceptionFromLazyResolveLogValidation = checkLazyResolveLog(lazyOperationsLog, testDataFile); exceptionFromLazyResolveLogValidation = checkLazyResolveLog(lazyOperationsLog, testDataFile);
} }
else { else {