From 46b63f04a13cc1e516010d0b160bc60526cb588a Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 11 Jul 2018 12:11:39 +0200 Subject: [PATCH] do not expose persistent string enumerator --- .../com/intellij/openapi/vfs/newvfs/impl/FileNameCache.java | 6 ++---- .../intellij/openapi/vfs/newvfs/persistent/FSRecords.java | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FileNameCache.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FileNameCache.java index f2d0589221d4..b1af0f0b9260 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FileNameCache.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FileNameCache.java @@ -18,7 +18,6 @@ package com.intellij.openapi.vfs.newvfs.impl; import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; import com.intellij.util.IntSLRUCache; import com.intellij.util.containers.IntObjectLinkedMap; -import com.intellij.util.io.PersistentStringEnumerator; import com.intellij.util.text.ByteArrayCharSequence; import org.jetbrains.annotations.NotNull; @@ -29,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger; * @author peter */ public class FileNameCache { - private static final PersistentStringEnumerator ourNames = FSRecords.getNames(); + @SuppressWarnings("unchecked") private static final IntSLRUCache>[] ourNameCache = new IntSLRUCache[16]; static { final int protectedSize = 40000 / ourNameCache.length; @@ -48,8 +47,7 @@ public class FileNameCache { @NotNull private static IntObjectLinkedMap.MapEntry cacheData(String name, int id, int stripe) { if (name == null) { - ourNames.markCorrupted(); - throw new RuntimeException("VFS name enumerator corrupted"); + FSRecords.handleError(new RuntimeException("VFS name enumerator corrupted")); } CharSequence rawName = ByteArrayCharSequence.convertToBytesIfAsciiString(name); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java index fe3e73d03f85..dd531f803d58 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java @@ -557,7 +557,7 @@ public class FSRecords { return DbConnection.myAttributes; } - public static PersistentStringEnumerator getNames() { + private static PersistentStringEnumerator getNames() { return DbConnection.getNames(); } @@ -1833,7 +1833,7 @@ public class FSRecords { } @Contract("_->fail") - static void handleError(Throwable e) throws RuntimeException, Error { + public static void handleError(Throwable e) throws RuntimeException, Error { DbConnection.handleError(e); } }