371 boolean recurse,
372 ListBuffer<JavaFileObject> resultList) throws IOException {
373 }
374 @Override
375 public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
376 return null;
377 }
378 @Override
379 public void close() throws IOException {}
380 @Override
381 public boolean maintainsDirectoryIndex() {
382 return false;
383 }
384 @Override
385 public Iterable<RelativeDirectory> indexedDirectories() {
386 return List.nil();
387 }
388 };
389
390 private final class JRTImageContainer implements Container {
391
392 /**
393 * Insert all files in a subdirectory of the platform image
394 * which match fileKinds into resultList.
395 */
396 @Override
397 public void list(Path userPath,
398 RelativeDirectory subdirectory,
399 Set<JavaFileObject.Kind> fileKinds,
400 boolean recurse,
401 ListBuffer<JavaFileObject> resultList) throws IOException {
402 try {
403 JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
404 if (symbolFileEnabled && e.ctSym.hidden)
405 return;
406 for (Path file: e.files.values()) {
407 if (fileKinds.contains(getKind(file))) {
408 JavaFileObject fe
409 = PathFileObject.forJRTPath(JavacFileManager.this, file);
410 resultList.append(fe);
420 ex.printStackTrace(System.err);
421 log.error(Errors.ErrorReadingFile(userPath, getMessage(ex)));
422 }
423 }
424
425 @Override
426 public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
427 JRTIndex.Entry e = getJRTIndex().getEntry(name.dirname());
428 if (symbolFileEnabled && e.ctSym.hidden)
429 return null;
430 Path p = e.files.get(name.basename());
431 if (p != null) {
432 return PathFileObject.forJRTPath(JavacFileManager.this, p);
433 } else {
434 return null;
435 }
436 }
437
438 @Override
439 public void close() throws IOException {
440 }
441
442 @Override
443 public boolean maintainsDirectoryIndex() {
444 return false;
445 }
446
447 @Override
448 public Iterable<RelativeDirectory> indexedDirectories() {
449 return List.nil();
450 }
451 }
452
453 private synchronized JRTIndex getJRTIndex() {
454 if (jrtIndex == null)
455 jrtIndex = JRTIndex.getSharedInstance();
456 return jrtIndex;
457 }
458
459 private JRTIndex jrtIndex;
460
461 private final class DirectoryContainer implements Container {
462 private final Path directory;
463
464 public DirectoryContainer(Path directory) {
465 this.directory = directory;
466 }
467
468 /**
469 * Insert all files in subdirectory subdirectory of directory userPath
470 * which match fileKinds into resultList
471 */
472 @Override
473 public void list(Path userPath,
474 RelativeDirectory subdirectory,
475 Set<JavaFileObject.Kind> fileKinds,
476 boolean recurse,
477 ListBuffer<JavaFileObject> resultList) throws IOException {
478 Path d;
479 try {
480 d = subdirectory.resolveAgainst(userPath);
|
371 boolean recurse,
372 ListBuffer<JavaFileObject> resultList) throws IOException {
373 }
374 @Override
375 public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
376 return null;
377 }
378 @Override
379 public void close() throws IOException {}
380 @Override
381 public boolean maintainsDirectoryIndex() {
382 return false;
383 }
384 @Override
385 public Iterable<RelativeDirectory> indexedDirectories() {
386 return List.nil();
387 }
388 };
389
390 private final class JRTImageContainer implements Container {
391 // Monotonic, created on demand.
392 private JRTIndex jrtIndex = null;
393
394 private synchronized JRTIndex getJRTIndex() {
395 if (jrtIndex == null) {
396 jrtIndex = JRTIndex.instance(previewMode);
397 }
398 return jrtIndex;
399 }
400
401 /**
402 * Insert all files in a subdirectory of the platform image
403 * which match fileKinds into resultList.
404 */
405 @Override
406 public void list(Path userPath,
407 RelativeDirectory subdirectory,
408 Set<JavaFileObject.Kind> fileKinds,
409 boolean recurse,
410 ListBuffer<JavaFileObject> resultList) throws IOException {
411 try {
412 JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
413 if (symbolFileEnabled && e.ctSym.hidden)
414 return;
415 for (Path file: e.files.values()) {
416 if (fileKinds.contains(getKind(file))) {
417 JavaFileObject fe
418 = PathFileObject.forJRTPath(JavacFileManager.this, file);
419 resultList.append(fe);
429 ex.printStackTrace(System.err);
430 log.error(Errors.ErrorReadingFile(userPath, getMessage(ex)));
431 }
432 }
433
434 @Override
435 public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
436 JRTIndex.Entry e = getJRTIndex().getEntry(name.dirname());
437 if (symbolFileEnabled && e.ctSym.hidden)
438 return null;
439 Path p = e.files.get(name.basename());
440 if (p != null) {
441 return PathFileObject.forJRTPath(JavacFileManager.this, p);
442 } else {
443 return null;
444 }
445 }
446
447 @Override
448 public void close() throws IOException {
449 if (jrtIndex != null) {
450 jrtIndex.close();
451 }
452 }
453
454 @Override
455 public boolean maintainsDirectoryIndex() {
456 return false;
457 }
458
459 @Override
460 public Iterable<RelativeDirectory> indexedDirectories() {
461 return List.nil();
462 }
463 }
464
465 private final class DirectoryContainer implements Container {
466 private final Path directory;
467
468 public DirectoryContainer(Path directory) {
469 this.directory = directory;
470 }
471
472 /**
473 * Insert all files in subdirectory subdirectory of directory userPath
474 * which match fileKinds into resultList
475 */
476 @Override
477 public void list(Path userPath,
478 RelativeDirectory subdirectory,
479 Set<JavaFileObject.Kind> fileKinds,
480 boolean recurse,
481 ListBuffer<JavaFileObject> resultList) throws IOException {
482 Path d;
483 try {
484 d = subdirectory.resolveAgainst(userPath);
|