/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/** This class converts command line arguments, environment variables
* and system properties (in File.pathSeparator-separated String form)
* into a boot class path, user class path, and source path (in
* Collection<String> form).
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
public class Paths {
/** The context key for the todo list */
/** Get the Paths instance for this context.
* @param context the context
* @return the Paths instance for this context
*/
return instance;
}
/** The log to use for warning output */
/** Collection of command-line options */
/** Handler for -Xlint options */
/** Access to (possibly cached) file info */
}
}
/** Whether to warn about non-existent path elements */
private boolean warn;
/**
* rt.jar as found on the default bootclass path. If the user specified a
* bootclasspath, null is used.
*/
/**
* Is bootclasspath the default?
*/
private boolean isDefaultBootClassPath;
}
// TODO? if (inited) throw new IllegalStateException
// TODO: otherwise reset sourceSearchPath, classSearchPath as needed
Path p;
if (location == CLASS_PATH)
p = computeUserClassPath();
else if (location == PLATFORM_CLASS_PATH)
p = computeBootClassPath(); // sets isDefaultBootClassPath
else if (location == ANNOTATION_PROCESSOR_PATH)
else if (location == SOURCE_PATH)
p = computeSourcePath();
else
// no defaults for other paths
p = null;
} else {
if (location == PLATFORM_CLASS_PATH) {
isDefaultBootClassPath = false;
}
p = new Path();
}
}
public boolean isDefaultBootClassPath() {
lazy();
return isDefaultBootClassPath;
}
protected void lazy() {
if (!inited) {
inited = true;
}
}
lazy();
}
lazy();
}
lazy();
? null
}
}
/**
* Split a path into its elements. Empty path elements will be ignored.
* @param path The path to be split
* @return The elements of the path
*/
}
/**
* Split a path into its elements. If emptyPathDefault is not null, all
* empty elements in the path, including empty elements at either end of
* the path, will be replaced with the value of emptyPathDefault.
* @param path The path to be split
* @param emptyPathDefault The value to substitute for empty path elements,
* or null, to ignore empty path elements
* @return The elements of the path
*/
int start = 0;
if (sep == -1)
else if (emptyPathDefault != null)
}
return entries;
}
private boolean expandJarClassPaths = false;
expandJarClassPaths = x;
return this;
}
/** What to use when path element is the empty string */
emptyPathDefault = x;
return this;
}
public Path() { super(); }
boolean prev = expandJarClassPaths;
expandJarClassPaths = true;
try {
return this;
} finally {
}
}
}
if (!dir.isDirectory()) {
if (warn)
"dir.path.element.not.found", dir);
return;
}
return;
}
}
}
return this;
}
}
// discard duplicates
return;
}
/* No such file or directory exists */
if (warn) {
"path.element.not.found", file);
}
return;
}
/* Discard duplicates and avoid infinite recursion */
return;
}
/* File is an ordinary file. */
/* Not a recognized extension; open it to see if
it looks like a valid zip file. */
try {
z.close();
if (warn) {
"unexpected.archive.file", file);
}
} catch (IOException e) {
// FIXME: include e.getLocalizedMessage in warning
if (warn) {
"invalid.archive.file", file);
}
return;
}
}
}
/* Now what we have left is either a directory or a file name
conforming to archive naming convention */
}
// Adds referenced classpath elements from a jar's Class-Path
// Manifest entry. In some future release, we may want to
// update this code to recognize URLs rather than simple
// filenames, but if we do, we should redo all path-related code.
try {
}
} catch (IOException e) {
}
}
}
if (endorseddirsOpt != null)
else
if (bootclasspathOpt != null) {
} else {
// Standard system classes for this compiler's release.
}
}
// Strictly speaking, standard extensions are not bootstrap
// classes, but we treat them identically, so we'll pretend
// that they are.
if (extdirsOpt != null)
else
(xbootclasspathPrependOpt == null) &&
(bootclasspathOpt == null) &&
(xbootclasspathAppendOpt == null);
return path;
}
// CLASSPATH environment variable when run from `javac'.
// If invoked via a java VM (not the javac launcher), use the
// platform class path
// Default to current working directory.
return new Path()
.expandJarClassPaths(true) // Only search user jars for Class-Paths
}
if (sourcePathArg == null)
return null;
}
if (processorPathArg == null)
return null;
}
/** The actual effective locations searched for sources */
if (sourceSearchPath == null) {
lazy();
}
}
/** The actual effective locations searched for classes */
if (classSearchPath == null) {
lazy();
classSearchPath = new Path();
}
}
/** The actual effective locations for non-source, non-class files */
if (otherSearchPath == null) {
lazy();
if (sourcePath == null)
else {
otherSearchPath = new Path();
}
}
}
/** Is this the name of an archive file? */
}
/**
* 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.
*
* @param path the search path string
* @return the resulting array of directory and JAR file URLs
*/
int count = 0;
while (st.hasMoreTokens()) {
}
}
}
return urls;
}
/**
* Returns the directory or JAR file URL corresponding to the specified
* local file name.
*
* @param file the File object
* @return the resulting directory or JAR file URL, or null if unknown
*/
try {
} catch (IOException e) {
}
}
// If the file does not exist, then assume that it's a directory
}
try {
} catch (MalformedURLException e) {
}
}
}