/*
* 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 provides access to the source, class and other files
* used by the compiler and related tools.
*
* <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>
*/
else
}
/** Encapsulates knowledge of paths
*/
private boolean contextUseOptimizedZip;
/** The standard output directory, primarily used for classes.
* Initialized by the "-d" option.
* If classOutDir = null, files are written into same directory as the sources
* they were generated from.
*/
/** The output directory, used when generating sources while processing annotations.
* Initialized by the "-s" option.
*/
protected boolean mmappedIO;
protected boolean ignoreSymbolFile;
FORWARD {
}
},
REVERSE {
}
};
};
/**
* Register a Context.Factory to create a JavacFileManager.
*/
return new JavacFileManager(c, true, null);
}
});
}
/**
* Create a JavacFileManager using a given context, optionally registering
* it as the JavaFileManager for that context.
*/
super(charset);
if (register)
}
/**
* Set the context for JavacFileManager.
*/
super.setContext(context);
} else {
// Reuse the Paths object as it stores the locations that
// have been set with setLocation, etc.
}
}
}
public boolean isDefaultBootClassPath() {
return paths.isDefaultBootClassPath();
}
}
return new RegularFileObject(this, file);
}
throws IOException
{
}
}
}
// Arguably, isValidName should reject keywords (such as in SourceVersion.isName() ),
// but the set of keywords depends on the source level, and we don't want
// impls of JavaFileManager to have to be dependent on the source level.
// Therefore we simply check that the argument is a sequence of identifiers
// separated by ".".
if (!SourceVersion.isIdentifier(s))
return false;
}
return true;
}
if (!isValidName(className))
}
}
boolean isValidPackageName,
boolean isValidClassName)
{
try {
if (!isValidPackageName)
} catch (IllegalArgumentException e) {
if (isValidPackageName)
}
try {
if (!isValidClassName)
} catch (IllegalArgumentException e) {
if (isValidClassName)
}
}
try {
throw new AssertionError(ex);
}
}
/**
* Insert all files in subdirectory subdirectory of directory directory
* which match fileKinds into resultList
*/
boolean recurse,
if (!caseMapCheck(d, subdirectory))
return;
return;
if (f.isDirectory()) {
}
} else {
}
}
}
}
/**
* Insert all files in subdirectory subdirectory of archive archive
* which match fileKinds into resultList
*/
boolean recurse,
// Get the files directly in the subdir
}
}
}
if (recurse) {
if (subdirectory.contains(s)) {
// Because the archive map is a flat list of directories,
// the enclosing loop will pick up all child subdirectories.
// Therefore, there is no need to recurse deeper.
}
}
}
}
/**
* container is a directory, a zip file, or a non-existant path.
* Insert all files in subdirectory subdirectory of container which
* match fileKinds into resultList
*/
boolean recurse,
// archives are not created for directories.
return;
}
// Not a directory; either a file or non-existant, create the archive
try {
} catch (IOException ex) {
return;
}
}
}
}
private static final boolean fileSystemIsCaseSensitive =
/** Hack to make Windows case sensitive. Test whether given path
* ends in a string of characters with the same case as given name.
* Ignore file separators in both path and name.
*/
if (fileSystemIsCaseSensitive) return true;
// Note that getCanonicalPath() returns the case-sensitive
// spelled file name.
try {
path = f.getCanonicalPath();
} catch (IOException ex) {
return false;
}
while (i >= 0 && j >= 0) {
if (i >= 0 && j >= 0) {
i--;
j--;
}
}
return j < 0;
}
/**
* An archive provides a flat directory structure of a ZipFile by
* mapping directory names to lists of files (basenames).
*/
public interface Archive {
}
zipFileName = name;
}
return false;
}
public void close() {
}
return null;
}
}
return Collections.emptySet();
}
}
}
/** A directory of zip files already opened.
*/
= new RelativeDirectory("META-INF/sym/rt.jar/");
/*
* This method looks for a ZipFormatException and takes appropriate
* evasive action. If there is a failure in the fast mode then we
* fail over to the platform zip, and allow it to deal with a potentially
* non compliant zip file.
*/
try {
} catch (IOException ioe) {
return openArchive(zipFilename, false);
} else {
throw ioe;
}
}
}
/** Open a new zip file directory, and cache it.
*/
// file == ${jdk.home}
zipFileName = file;
}
try {
boolean usePreindexedCache = false;
if (!useOptimizedZip) {
} else {
}
else {
}
}
}
}
}
}
if (origZipFileName == zipFileName) {
if (!useOptimizedZip) {
} else {
archive = new ZipFileIndexArchive(this,
null,
}
} else {
if (!useOptimizedZip) {
} else {
archive = new ZipFileIndexArchive(this,
}
}
} catch (FileNotFoundException ex) {
throw zfe;
} catch (IOException ex) {
if (zipFileName.exists())
}
return archive;
}
/** Flush any output resources.
*/
public void flush() {
}
/**
* Close the JavaFileManager, releasing resources.
*/
public void close() {
i.remove();
try {
a.close();
} catch (IOException e) {
}
}
}
if (defaultEncodingName == null) {
}
return defaultEncodingName;
}
return null;
try {
} catch (MalformedURLException e) {
throw new AssertionError(e);
}
}
}
boolean recurse)
throws IOException
{
// validatePackageName(packageName);
}
// Need to match the path semantics of list(location, ...)
return null;
}
if (file instanceof BaseFileObject) {
} else
}
nullCheck(a);
nullCheck(b);
if (!(a instanceof BaseFileObject))
throw new IllegalArgumentException("Not supported: " + a);
if (!(b instanceof BaseFileObject))
throw new IllegalArgumentException("Not supported: " + b);
return a.equals(b);
}
}
throws IOException
{
// validateClassName(className);
}
throws IOException
{
// validatePackageName(packageName);
if (!isRelativeUri(relativeName))
? new RelativeFile(relativeName)
}
return null;
if (a == null) {
if (f.exists())
return new RegularFileObject(this, f);
continue;
}
// Not a directory, create the archive
a = openArchive(dir);
}
// Process the archive
}
}
return null;
}
throws IOException
{
// validateClassName(className);
}
throws IOException
{
// validatePackageName(packageName);
if (!isRelativeUri(relativeName))
? new RelativeFile(relativeName)
}
throws IOException
{
if (location == CLASS_OUTPUT) {
if (getClassOutDir() != null) {
dir = getClassOutDir();
} else {
}
}
} else if (location == SOURCE_OUTPUT) {
} else {
dir = f;
break;
}
}
return new RegularFileObject(this, file);
}
{
if (files instanceof Collection<?>)
else
return result;
}
}
throws IOException
{
if (location == CLASS_OUTPUT)
else if (location == SOURCE_OUTPUT)
else
}
// where
return null;
throw new IllegalArgumentException("empty path for directory");
throw new IllegalArgumentException("path too long for directory");
else if (!dir.isDirectory())
return dir;
}
return dir;
return null;
}
if (location == CLASS_OUTPUT) {
} else if (location == SOURCE_OUTPUT) {
} else
}
if (classOutDir == uninited)
return classOutDir;
}
if (sourceOutDir == uninited)
return sourceOutDir;
}
/**
* Enforces the specification of a "relative" URI as used in
* {@linkplain #getFileForInput(Location,String,URI)
* getFileForInput}. This method must follow the rules defined in
* that method, do not make any changes without consulting the
* specification.
*/
if (uri.isAbsolute())
return false;
return false;
return false;
return false;
return true;
}
// Convenience method
try {
return isRelativeUri(new URI(u));
} catch (URISyntaxException e) {
return false;
}
}
/**
* Converts a relative file name to a relative URI. This is
* different from File.toURI as this method does not canonicalize
* the file before creating the URI. Furthermore, no schema is
* used.
* @param file a relative file name
* @return a relative URI
* @throws IllegalArgumentException if the file name is not
* relative according to the definition given in {@link
* javax.tools.JavaFileManager#getFileForInput}
*/
if (!file.isAbsolute()) {
if (isRelativeUri(result))
return result;
}
}
/**
* Get a detail message from an IOException.
* Most, but not all, instances of IOException provide a non-null result
* for getLocalizedMessage(). But some instances return null: in these
* cases, fallover to getMessage(), and if even that is null, return the
* name of the exception itself.
* @param e an IOException
* @return a string to include in a compiler diagnostic
*/
String s = e.getLocalizedMessage();
if (s != null)
return s;
s = e.getMessage();
if (s != null)
return s;
return e.toString();
}
}