From 6c203657df3eba5b3da3c9cfae41d5f0167b6dd5 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 30 Jun 2015 14:11:00 -0700 Subject: [PATCH] Cosmetics. --- .../core/pdom/indexer/FileExistsCache.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java index 3ef850f6700..dceef4e088c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/FileExistsCache.java @@ -25,9 +25,9 @@ import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.runtime.CoreException; /** - * A cache for checking whether a file exists. The cache shall be used for a limited amount of time, only (e.g. one - * indexer task). It uses as much memory as it needs. To protect against OutOfMemory situations, a soft reference is - * used. + * A cache for checking whether a file exists. The cache shall be used for a limited amount of time, + * only (e.g. one indexer task). It uses as much memory as it needs. To protect against OutOfMemory + * situations, a soft reference is used. * @since 5.0 */ public final class FileExistsCache { @@ -48,7 +48,9 @@ public final class FileExistsCache { public FileExistsCache(boolean caseInsensitive) { fCaseInSensitive= caseInsensitive; - fCache= new SoftReference>(new HashMap()); // before running out of memory the entire map will be thrown away. + Map cache = new HashMap<>(); + // Before running out of memory the entire map will be thrown away. + fCache= new SoftReference<>(cache); } public boolean isFile(String path) { @@ -132,8 +134,9 @@ public final class FileExistsCache { private Map getExistsCache() { Map cache= fCache.get(); if (cache == null) { - cache= new HashMap(); - fCache= new SoftReference>(cache); // before running out of memory the entire map will be thrown away. + cache= new HashMap<>(); + // Before running out of memory the entire map will be thrown away. + fCache= new SoftReference<>(cache); } return cache; }