langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
changeset 8223 638daa596494
parent 8034 d3b29ef9c062
child 8432 d3380b1e4779
--- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Jan 24 16:34:25 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Jan 24 16:38:56 2011 -0800
@@ -76,8 +76,6 @@
  */
 public class JavacFileManager extends BaseFileManager implements StandardJavaFileManager {
 
-    boolean useZipFileIndex;
-
     public static char[] toArray(CharBuffer buffer) {
         if (buffer.hasArray())
             return ((CharBuffer)buffer.compact().flip()).array();
@@ -91,6 +89,9 @@
 
     private FSInfo fsInfo;
 
+    private boolean useZipFileIndex;
+    private ZipFileIndexCache zipFileIndexCache;
+
     private final File uninited = new File("U N I N I T E D");
 
     private final Set<JavaFileObject.Kind> sourceOrClass =
@@ -163,7 +164,11 @@
 
         fsInfo = FSInfo.instance(context);
 
-        useZipFileIndex = System.getProperty("useJavaUtilZip") == null;// TODO: options.get("useJavaUtilZip") == null;
+        // retain check for system property for compatibility
+        useZipFileIndex = options.isUnset("useJavaUtilZip")
+                && System.getProperty("useJavaUtilZip") == null;
+        if (useZipFileIndex)
+            zipFileIndexCache = ZipFileIndexCache.getSharedInstance();
 
         mmappedIO = options.isSet("mmappedIO");
         ignoreSymbolFile = options.isSet("ignore.symbol.file");
@@ -526,7 +531,7 @@
                     archive = new ZipArchive(this, zdir);
                 } else {
                     archive = new ZipFileIndexArchive(this,
-                                ZipFileIndex.getZipFileIndex(zipFileName,
+                                zipFileIndexCache.getZipFileIndex(zipFileName,
                                     null,
                                     usePreindexedCache,
                                     preindexCacheLocation,
@@ -538,7 +543,7 @@
                 }
                 else {
                     archive = new ZipFileIndexArchive(this,
-                                ZipFileIndex.getZipFileIndex(zipFileName,
+                                zipFileIndexCache.getZipFileIndex(zipFileName,
                                     symbolFilePrefix,
                                     usePreindexedCache,
                                     preindexCacheLocation,