src/share/classes/com/sun/tools/javac/file/Paths.java

changeset 818
d33d8c381aa1
parent 809
e63b1f8341ce
child 874
e0c16199b2e0
equal deleted inserted replaced
817:17b271281525 818:d33d8c381aa1
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
110 110
111 /** 111 /**
112 * rt.jar as found on the default bootclass path. If the user specified a 112 * rt.jar as found on the default bootclass path. If the user specified a
113 * bootclasspath, null is used. 113 * bootclasspath, null is used.
114 */ 114 */
115 private File bootClassPathRtJar = null; 115 private File defaultBootClassPathRtJar = null;
116 116
117 /** 117 /**
118 * Is bootclasspath the default? 118 * Is bootclasspath the default?
119 */ 119 */
120 private boolean isDefaultBootClassPath; 120 private boolean isDefaultBootClassPath;
141 p = computeSourcePath(); 141 p = computeSourcePath();
142 else 142 else
143 // no defaults for other paths 143 // no defaults for other paths
144 p = null; 144 p = null;
145 } else { 145 } else {
146 if (location == PLATFORM_CLASS_PATH) 146 if (location == PLATFORM_CLASS_PATH) {
147 defaultBootClassPathRtJar = null;
147 isDefaultBootClassPath = false; 148 isDefaultBootClassPath = false;
149 }
148 p = new Path(); 150 p = new Path();
149 for (File f: path) 151 for (File f: path)
150 p.addFile(f, warn); // TODO: is use of warn appropriate? 152 p.addFile(f, warn); // TODO: is use of warn appropriate?
151 } 153 }
152 pathsForLocation.put(location, p); 154 pathsForLocation.put(location, p);
183 return p == null || p.size() == 0 185 return p == null || p.size() == 0
184 ? null 186 ? null
185 : Collections.unmodifiableCollection(p); 187 : Collections.unmodifiableCollection(p);
186 } 188 }
187 189
188 boolean isBootClassPathRtJar(File file) { 190 boolean isDefaultBootClassPathRtJar(File file) {
189 return file.equals(bootClassPathRtJar); 191 return file.equals(defaultBootClassPathRtJar);
190 } 192 }
191 193
192 /** 194 /**
193 * Split a path into its elements. Empty path elements will be ignored. 195 * Split a path into its elements. Empty path elements will be ignored.
194 * @param path The path to be split 196 * @param path The path to be split
353 } 355 }
354 } 356 }
355 } 357 }
356 358
357 private Path computeBootClassPath() { 359 private Path computeBootClassPath() {
358 bootClassPathRtJar = null; 360 defaultBootClassPathRtJar = null;
359 Path path = new Path(); 361 Path path = new Path();
360 362
361 String bootclasspathOpt = options.get(BOOTCLASSPATH); 363 String bootclasspathOpt = options.get(BOOTCLASSPATH);
362 String endorseddirsOpt = options.get(ENDORSEDDIRS); 364 String endorseddirsOpt = options.get(ENDORSEDDIRS);
363 String extdirsOpt = options.get(EXTDIRS); 365 String extdirsOpt = options.get(EXTDIRS);
378 String files = System.getProperty("sun.boot.class.path"); 380 String files = System.getProperty("sun.boot.class.path");
379 path.addFiles(files, false); 381 path.addFiles(files, false);
380 File rt_jar = new File("rt.jar"); 382 File rt_jar = new File("rt.jar");
381 for (File file : getPathEntries(files)) { 383 for (File file : getPathEntries(files)) {
382 if (new File(file.getName()).equals(rt_jar)) 384 if (new File(file.getName()).equals(rt_jar))
383 bootClassPathRtJar = file; 385 defaultBootClassPathRtJar = file;
384 } 386 }
385 } 387 }
386 388
387 path.addFiles(xbootclasspathAppendOpt); 389 path.addFiles(xbootclasspathAppendOpt);
388 390

mercurial