stubs: inline logic for data externalization if compression is disabled
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Wed, 12 Aug 2020 10:06:20 +0000 (13:06 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Wed, 12 Aug 2020 11:40:34 +0000 (11:40 +0000)
GitOrigin-RevId: 2d3967f3d8b3554f9a5eb77c1f0f82fbb6a7f5e0

platform/indexing-impl/src/com/intellij/psi/stubs/SerializedStubTreeDataExternalizer.java

index 4c386a443e88c2f897f00775a42e6e5cc069f9bb..c4197f1f3c0e39f1fdcb129eb786ab769fb5a529 100644 (file)
@@ -1,10 +1,8 @@
 // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.psi.stubs;
 
-import com.intellij.util.CompressionUtil;
 import com.intellij.util.io.DataExternalizer;
 import com.intellij.util.io.DataInputOutputUtil;
-import com.intellij.util.io.PersistentHashMapValueStorage;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.DataInput;
@@ -28,16 +26,10 @@ public class SerializedStubTreeDataExternalizer implements DataExternalizer<Seri
 
   @Override
   public final void save(@NotNull final DataOutput out, @NotNull final SerializedStubTree tree) throws IOException {
-    if (PersistentHashMapValueStorage.COMPRESSION_ENABLED) {
-      DataInputOutputUtil.writeINT(out, tree.myTreeByteLength);
-      out.write(tree.myTreeBytes, 0, tree.myTreeByteLength);
-      DataInputOutputUtil.writeINT(out, tree.myIndexedStubByteLength);
-      out.write(tree.myIndexedStubBytes, 0, tree.myIndexedStubByteLength);
-    }
-    else {
-      CompressionUtil.writeCompressed(out, tree.myTreeBytes, 0, tree.myTreeByteLength);
-      CompressionUtil.writeCompressed(out, tree.myIndexedStubBytes, 0, tree.myIndexedStubByteLength);
-    }
+    DataInputOutputUtil.writeINT(out, tree.myTreeByteLength);
+    out.write(tree.myTreeBytes, 0, tree.myTreeByteLength);
+    DataInputOutputUtil.writeINT(out, tree.myIndexedStubByteLength);
+    out.write(tree.myIndexedStubBytes, 0, tree.myIndexedStubByteLength);
     IndexingStampInfo indexingStampInfo = tree.getIndexingStampInfo();
     if (indexingStampInfo != null && mySaveIndexingStamp) {
       indexingStampInfo.save(out);
@@ -47,7 +39,7 @@ public class SerializedStubTreeDataExternalizer implements DataExternalizer<Seri
   @NotNull
   @Override
   public final SerializedStubTree read(@NotNull final DataInput in) throws IOException {
-    if (PersistentHashMapValueStorage.COMPRESSION_ENABLED) {
+    {
       int serializedStubsLength = DataInputOutputUtil.readINT(in);
       byte[] bytes = new byte[serializedStubsLength];
       in.readFully(bytes);
@@ -57,15 +49,14 @@ public class SerializedStubTreeDataExternalizer implements DataExternalizer<Seri
       indexedStubBytes = new byte[indexedStubByteLength];
       in.readFully(indexedStubBytes);
       IndexingStampInfo indexingStampInfo = mySaveIndexingStamp ? IndexingStampInfo.read((DataInputStream)in) : null;
-      return new SerializedStubTree(bytes, bytes.length, indexedStubBytes, indexedStubByteLength,
-                                    null, myStubIndexesExternalizer, mySerializationManager,  indexingStampInfo);
-    }
-    else {
-      byte[] treeBytes = CompressionUtil.readCompressed(in);
-      byte[] indexedStubBytes = CompressionUtil.readCompressed(in);
-      IndexingStampInfo indexingStampInfo = mySaveIndexingStamp ? IndexingStampInfo.read((DataInputStream)in) : null;
-      return new SerializedStubTree(treeBytes, treeBytes.length, indexedStubBytes, indexedStubBytes.length,
-                                    null, myStubIndexesExternalizer, mySerializationManager, indexingStampInfo);
+      return new SerializedStubTree(bytes,
+                                    bytes.length,
+                                    indexedStubBytes,
+                                    indexedStubByteLength,
+                                    null,
+                                    myStubIndexesExternalizer,
+                                    mySerializationManager,
+                                    indexingStampInfo);
     }
   }
 }