From 9496fd7ad9e948bc1268efd65454264875d8ec68 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Wed, 22 Mar 2017 23:01:39 +0300 Subject: [PATCH] re-fix for read-only indices (rewrite assignment of read-only status for ValueContainerMap) --- .../intellij/util/indexing/impl/MapIndexStorage.java | 7 ++++++- .../util/indexing/impl/ValueContainerMap.java | 11 +---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/platform/util/src/com/intellij/util/indexing/impl/MapIndexStorage.java b/platform/util/src/com/intellij/util/indexing/impl/MapIndexStorage.java index ff0a411175a8..3d32084031b0 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/MapIndexStorage.java +++ b/platform/util/src/com/intellij/util/indexing/impl/MapIndexStorage.java @@ -80,7 +80,12 @@ public abstract class MapIndexStorage implements IndexStorage(getStorageFile(), myKeyDescriptor, myDataExternalizer, myKeyIsUniqueForIndexedFile, myReadOnly); + map = new ValueContainerMap(getStorageFile(), myKeyDescriptor, myDataExternalizer, myKeyIsUniqueForIndexedFile) { + @Override + protected boolean isReadOnly() { + return myReadOnly; + } + }; } finally { PersistentHashMapValueStorage.CreationTimeOptions.EXCEPTIONAL_IO_CANCELLATION.set(null); PersistentHashMapValueStorage.CreationTimeOptions.COMPACT_CHUNKS_WITH_VALUE_DESERIALIZATION.set(null); diff --git a/platform/util/src/com/intellij/util/indexing/impl/ValueContainerMap.java b/platform/util/src/com/intellij/util/indexing/impl/ValueContainerMap.java index 930954963d77..e0a10df2f213 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/ValueContainerMap.java +++ b/platform/util/src/com/intellij/util/indexing/impl/ValueContainerMap.java @@ -29,18 +29,14 @@ import java.io.*; class ValueContainerMap extends PersistentHashMap> { @NotNull private final DataExternalizer myValueExternalizer; private final boolean myKeyIsUniqueForIndexedFile; - private final boolean myReadOnly; ValueContainerMap(@NotNull final File file, @NotNull KeyDescriptor keyKeyDescriptor, @NotNull DataExternalizer valueExternalizer, - boolean keyIsUniqueForIndexedFile, - boolean readOnly - ) throws IOException { + boolean keyIsUniqueForIndexedFile) throws IOException { super(file, keyKeyDescriptor, new ValueContainerExternalizer(valueExternalizer)); myValueExternalizer = valueExternalizer; myKeyIsUniqueForIndexedFile = keyIsUniqueForIndexedFile; - myReadOnly = readOnly; } @NotNull @@ -71,11 +67,6 @@ class ValueContainerMap extends PersistentHashMap implements DataExternalizer> { @NotNull private final DataExternalizer myValueExternalizer;