Java Code Examples for javax.tools.StandardJavaFileManager#getLocationAsPaths()

The following examples show how to use javax.tools.StandardJavaFileManager#getLocationAsPaths() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavacProcessingEnvironment.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an empty processor iterator if no processors are on the
 * relevant path, otherwise if processors are present, logs an
 * error.  Called when a service loader is unavailable for some
 * reason, either because a service loader class cannot be found
 * or because a security policy prevents class loaders from being
 * created.
 *
 * @param key The resource key to use to log an error message
 * @param e   If non-null, pass this exception to Abort
 */
private Iterator<Processor> handleServiceLoaderUnavailability(String key, Exception e) {
    if (fileManager instanceof JavacFileManager) {
        StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager;
        Iterable<? extends Path> workingPath = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH)
            ? standardFileManager.getLocationAsPaths(ANNOTATION_PROCESSOR_PATH)
            : standardFileManager.getLocationAsPaths(CLASS_PATH);

        if (needClassLoader(options.get(Option.PROCESSOR), workingPath) )
            handleException(key, e);

    } else {
        handleException(key, e);
    }

    java.util.List<Processor> pl = Collections.emptyList();
    return pl.iterator();
}
 
Example 2
Source File: SJFM_Locations.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void test_setFiles_getPaths(StandardJavaFileManager fm, List<File> inFiles) throws IOException {
    System.err.println("test_setFiles_getPaths");
    JavaFileManager.Location l = newLocation();
    fm.setLocation(l, inFiles);
    Iterable<? extends Path> outPaths = fm.getLocationAsPaths(l);
    compare(inFiles, outPaths);
}
 
Example 3
Source File: SJFM_Locations.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void test_setPaths_getPaths(StandardJavaFileManager fm, List<Path> inPaths) throws IOException {
    System.err.println("test_setPaths_getPaths");
    JavaFileManager.Location l = newLocation();
    fm.setLocationFromPaths(l, inPaths);
    Iterable<? extends Path> outPaths = fm.getLocationAsPaths(l);
    compare(inPaths, outPaths);
}