stubs: inline logic for data externalization if compression is disabled
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Thu, 13 Aug 2020 07:49:27 +0000 (10:49 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 13 Aug 2020 08:14:54 +0000 (08:14 +0000)
GitOrigin-RevId: 8beca71d43308ae63b19e1246510336e3d8a1166

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

index ecceb34943816c4660d9773f9bff7881aba9b7c8..aca5bb30f634a896235592d2f1b1bc38e1ae7594 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;
@@ -23,22 +21,16 @@ 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);
   }
 
   @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);
@@ -50,11 +42,5 @@ public class SerializedStubTreeDataExternalizer implements DataExternalizer<Seri
       return new SerializedStubTree(bytes, bytes.length, indexedStubBytes, indexedStubByteLength,
                                     null, myStubIndexesExternalizer, mySerializationManager);
     }
-    else {
-      byte[] treeBytes = CompressionUtil.readCompressed(in);
-      byte[] indexedStubBytes = CompressionUtil.readCompressed(in);
-      return new SerializedStubTree(treeBytes, treeBytes.length, indexedStubBytes, indexedStubBytes.length,
-                                    null, myStubIndexesExternalizer, mySerializationManager);
-    }
   }
 }