< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java

Print this page
@@ -386,10 +386,19 @@
              return List.nil();
          }
      };
  
      private final class JRTImageContainer implements Container {
+         // Monotonic, created on demand.
+         private JRTIndex jrtIndex = null;
+ 
+         private synchronized JRTIndex getJRTIndex() {
+             if (jrtIndex == null) {
+                 jrtIndex = JRTIndex.instance(previewMode);
+             }
+             return jrtIndex;
+         }
  
          /**
           * Insert all files in a subdirectory of the platform image
           * which match fileKinds into resultList.
           */

@@ -435,10 +444,13 @@
              }
          }
  
          @Override
          public void close() throws IOException {
+             if (jrtIndex != null) {
+                 jrtIndex.close();
+             }
          }
  
          @Override
          public boolean maintainsDirectoryIndex() {
              return false;

@@ -448,18 +460,10 @@
          public Iterable<RelativeDirectory> indexedDirectories() {
              return List.nil();
          }
      }
  
-     private synchronized JRTIndex getJRTIndex() {
-         if (jrtIndex == null)
-             jrtIndex = JRTIndex.getSharedInstance();
-         return jrtIndex;
-     }
- 
-     private JRTIndex jrtIndex;
- 
      private final class DirectoryContainer implements Container {
          private final Path directory;
  
          public DirectoryContainer(Path directory) {
              this.directory = directory;
< prev index next >