< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java

Print this page




  91             }
  92         }
  93         SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.DEFAULT));
  94     }
  95 
  96     private static String targetNumericVersion(Target target) {
  97         return Integer.toString(target.ordinal() - Target.JDK1_1.ordinal() + 1);
  98     }
  99 
 100     static class PlatformDescriptionImpl implements PlatformDescription {
 101 
 102         private final Map<Path, FileSystem> ctSym2FileSystem = new HashMap<>();
 103         private final String version;
 104 
 105         PlatformDescriptionImpl(String version) {
 106             this.version = version;
 107         }
 108 
 109         @Override
 110         public Collection<Path> getPlatformPath() {
 111             if (Target.lookup(version) == Target.DEFAULT) {


 112                 return null;
 113             }
 114 
 115             List<Path> paths = new ArrayList<>();
 116             Path file = findCtSym();
 117             // file == ${jdk.home}/lib/ct.sym
 118             if (Files.exists(file)) {
 119                 FileSystem fs = ctSym2FileSystem.get(file);
 120                 if (fs == null) {
 121                     try {
 122                         ctSym2FileSystem.put(file, fs = FileSystems.newFileSystem(file, null));
 123                     } catch (IOException ex) {
 124                         throw new IllegalStateException(ex);
 125                     }
 126                 }
 127                 Path root = fs.getRootDirectories().iterator().next();
 128                 try (DirectoryStream<Path> dir = Files.newDirectoryStream(root)) {
 129                     for (Path section : dir) {
 130                         if (section.getFileName().toString().contains(version)) {
 131                             paths.add(section);




  91             }
  92         }
  93         SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.DEFAULT));
  94     }
  95 
  96     private static String targetNumericVersion(Target target) {
  97         return Integer.toString(target.ordinal() - Target.JDK1_1.ordinal() + 1);
  98     }
  99 
 100     static class PlatformDescriptionImpl implements PlatformDescription {
 101 
 102         private final Map<Path, FileSystem> ctSym2FileSystem = new HashMap<>();
 103         private final String version;
 104 
 105         PlatformDescriptionImpl(String version) {
 106             this.version = version;
 107         }
 108 
 109         @Override
 110         public Collection<Path> getPlatformPath() {
 111             // Comparison should be == Target.DEFAULT once --release 9
 112             // is distinct from 10
 113             if (Target.lookup(version).compareTo(Target.JDK1_9)  >=  0) {
 114                 return null;
 115             }
 116 
 117             List<Path> paths = new ArrayList<>();
 118             Path file = findCtSym();
 119             // file == ${jdk.home}/lib/ct.sym
 120             if (Files.exists(file)) {
 121                 FileSystem fs = ctSym2FileSystem.get(file);
 122                 if (fs == null) {
 123                     try {
 124                         ctSym2FileSystem.put(file, fs = FileSystems.newFileSystem(file, null));
 125                     } catch (IOException ex) {
 126                         throw new IllegalStateException(ex);
 127                     }
 128                 }
 129                 Path root = fs.getRootDirectories().iterator().next();
 130                 try (DirectoryStream<Path> dir = Files.newDirectoryStream(root)) {
 131                     for (Path section : dir) {
 132                         if (section.getFileName().toString().contains(version)) {
 133                             paths.add(section);


< prev index next >