Method from com.sun.tools.javac.file.Paths Detail: |
public Collection<File> bootClassPath() {
lazy();
return Collections.unmodifiableCollection(getPathForLocation(PLATFORM_CLASS_PATH));
}
|
public Collection<File> classSearchPath() {
if (classSearchPath == null) {
lazy();
Path bootClassPath = getPathForLocation(PLATFORM_CLASS_PATH);
Path userClassPath = getPathForLocation(CLASS_PATH);
classSearchPath = new Path();
classSearchPath.addAll(bootClassPath);
classSearchPath.addAll(userClassPath);
}
return Collections.unmodifiableCollection(classSearchPath);
}
|
Path getPathForLocation(Location location) {
Path path = pathsForLocation.get(location);
if (path == null)
setPathForLocation(location, null);
return pathsForLocation.get(location);
}
|
public static Paths instance(Context context) {
Paths instance = context.get(pathsKey);
if (instance == null)
instance = new Paths(context);
return instance;
}
Get the Paths instance for this context. |
public boolean isDefaultBootClassPath() {
lazy();
return isDefaultBootClassPath;
}
|
boolean isDefaultBootClassPathRtJar(File file) {
return file.equals(defaultBootClassPathRtJar);
}
|
protected void lazy() {
if (!inited) {
warn = lint.isEnabled(Lint.LintCategory.PATH);
pathsForLocation.put(PLATFORM_CLASS_PATH, computeBootClassPath());
pathsForLocation.put(CLASS_PATH, computeUserClassPath());
pathsForLocation.put(SOURCE_PATH, computeSourcePath());
inited = true;
}
}
|
Collection<File> otherSearchPath() {
if (otherSearchPath == null) {
lazy();
Path userClassPath = getPathForLocation(CLASS_PATH);
Path sourcePath = getPathForLocation(SOURCE_PATH);
if (sourcePath == null)
otherSearchPath = userClassPath;
else {
otherSearchPath = new Path();
otherSearchPath.addAll(userClassPath);
otherSearchPath.addAll(sourcePath);
}
}
return Collections.unmodifiableCollection(otherSearchPath);
}
|
public static URL[] pathToURLs(String path) {
StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
URL[] urls = new URL[st.countTokens()];
int count = 0;
while (st.hasMoreTokens()) {
URL url = fileToURL(new File(st.nextToken()));
if (url != null) {
urls[count++] = url;
}
}
if (urls.length != count) {
URL[] tmp = new URL[count];
System.arraycopy(urls, 0, tmp, 0, count);
urls = tmp;
}
return urls;
}
Utility method for converting a search path string to an array
of directory and JAR file URLs.
Note that this method is called by apt and the DocletInvoker. |
void setContext(Context context) {
log = Log.instance(context);
options = Options.instance(context);
lint = Lint.instance(context);
fsInfo = FSInfo.instance(context);
}
|
void setPathForLocation(Location location,
Iterable<File> path) {
// TODO? if (inited) throw new IllegalStateException
// TODO: otherwise reset sourceSearchPath, classSearchPath as needed
Path p;
if (path == null) {
if (location == CLASS_PATH)
p = computeUserClassPath();
else if (location == PLATFORM_CLASS_PATH)
p = computeBootClassPath(); // sets isDefaultBootClassPath
else if (location == ANNOTATION_PROCESSOR_PATH)
p = computeAnnotationProcessorPath();
else if (location == SOURCE_PATH)
p = computeSourcePath();
else
// no defaults for other paths
p = null;
} else {
if (location == PLATFORM_CLASS_PATH) {
defaultBootClassPathRtJar = null;
isDefaultBootClassPath = false;
}
p = new Path();
for (File f: path)
p.addFile(f, warn); // TODO: is use of warn appropriate?
}
pathsForLocation.put(location, p);
}
|
public Collection<File> sourcePath() {
lazy();
Path p = getPathForLocation(SOURCE_PATH);
return p == null || p.size() == 0
? null
: Collections.unmodifiableCollection(p);
}
|
public Collection<File> sourceSearchPath() {
if (sourceSearchPath == null) {
lazy();
Path sourcePath = getPathForLocation(SOURCE_PATH);
Path userClassPath = getPathForLocation(CLASS_PATH);
sourceSearchPath = sourcePath != null ? sourcePath : userClassPath;
}
return Collections.unmodifiableCollection(sourceSearchPath);
}
|
public Collection<File> userClassPath() {
lazy();
return Collections.unmodifiableCollection(getPathForLocation(CLASS_PATH));
}
|