Example usage for javax.tools StandardLocation PLATFORM_CLASS_PATH

List of usage examples for javax.tools StandardLocation PLATFORM_CLASS_PATH

Introduction

In this page you can find the example usage for javax.tools StandardLocation PLATFORM_CLASS_PATH.

Prototype

StandardLocation PLATFORM_CLASS_PATH

To view the source code for javax.tools StandardLocation PLATFORM_CLASS_PATH.

Click Source Link

Document

Location to search for platform classes.

Usage

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public ClassLoader getClassLoader(final Location location) {
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("returning class loader from standard file manager for location: " + location);
        return super.getClassLoader(location);
    } else {/*from w w  w . j a  va 2s.  com*/
        logger.trace("class loader from standard file manager blocked for location: " + location);
        return null;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public FileObject getFileForInput(final Location location, final String packageName, final String relativeName)
        throws IOException {
    final String loggingName = "location [" + location + "], package [" + packageName + "], name ["
            + relativeName + "]";
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("returning input file from standard file manager for " + loggingName);
        return super.getFileForInput(location, packageName, relativeName);
    } else {//  w  w w.  j a  v a 2s.c  o m
        logger.trace("input file from standard file manager blocked for " + loggingName);
        return null;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public FileObject getFileForOutput(final Location location, final String packageName, final String relativeName,
        final FileObject sibling) throws IOException {
    final String loggingName = "location [" + location + "], package [" + packageName + "], name ["
            + relativeName + "]";
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("returning output file from standard file manager for " + loggingName);
        return super.getFileForOutput(location, packageName, relativeName, sibling);
    } else {/*www .jav  a 2 s  .c o m*/
        logger.trace("output file from standard file manager blocked for " + loggingName);
        return null;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public JavaFileObject getJavaFileForInput(final Location location, final String className, final Kind kind)
        throws IOException {
    final String loggingName = "location [" + location + "], class [" + className + "], kind [" + kind + "]";
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("returning java input file from standard file manager for " + loggingName);
        return super.getJavaFileForInput(location, className, kind);
    } else {//from w w  w  .ja v  a  2 s . c om
        logger.trace("java input file from standard file manager blocked for " + loggingName);
        return null;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public JavaFileObject getJavaFileForOutput(final Location location, final String className, final Kind kind,
        final FileObject sibling) throws IOException {
    final String loggingName = "location [" + location + "], class [" + className + "], kind [" + kind + "]";
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("returning java output file from standard file manager for " + loggingName);
        return super.getJavaFileForOutput(location, className, kind, sibling);
    } else {// ww  w .  jav a  2s .c  o m
        logger.trace("java output file from standard file manager blocked for " + loggingName);
        return null;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public boolean hasLocation(final Location location) {
    final String loggingName = "location [" + location + "]";
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("checking location in standard file manager: " + loggingName);
        final boolean result = super.hasLocation(location);
        logger.trace("location found: " + result);
        return result;
    } else {/*from www. j  av  a  2s .c  o m*/
        logger.trace("location from standard file manager blocked: " + loggingName);
        return false;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public String inferBinaryName(final Location location, final JavaFileObject file) {
    String loggingName = "location [" + location + "], file [" + file + "] / [" + file.getName() + "]";
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("standard file manager inferring binary name for " + loggingName);
        final String result = super.inferBinaryName(location, file);
        logger.trace("binary name: " + result);
        return result;
    } else {//from  w w w  .j a va 2 s. com
        logger.trace("inferring binary name skipped for standard file manager for " + loggingName);
        return null;
    }
}

From source file:name.martingeisse.webide.features.java.compiler.classpath.PlatformClasspathShieldFileManager.java

@Override
public Iterable<JavaFileObject> list(final Location location, final String packageName, final Set<Kind> kinds,
        final boolean recurse) throws IOException {
    if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        logger.trace("listing files from standard file manager, location [" + location + "], package ["
                + packageName + "], kinds [" + StringUtils.join(kinds, ", ") + "], recurse [" + recurse + "]");
        final Iterable<JavaFileObject> files = super.list(location, packageName, kinds, recurse);
        logger.trace("contributed files from the standard file manager: "
                + StringUtils.join(files.iterator(), ", "));
        return files;
    } else {/*w  ww.j a v  a 2 s . co  m*/
        logger.trace("blocking file list from standard file manager, location [" + location + "], package ["
                + packageName + "], kinds [" + StringUtils.join(kinds, ", ") + "], recurse [" + recurse + "]");
        return new EmptyIterable<JavaFileObject>();
    }
}

From source file:org.cdmckay.coffeep.Program.java

private static JavaFileObject getFileObject(String className) throws IOException {
    final Context context = new Context();
    final JavaFileManager fileManager = new JavacFileManager(context, true, null);

    JavaFileObject fileObject;/*from   w  w  w  .  j a  va 2  s .  com*/

    fileObject = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className,
            JavaFileObject.Kind.CLASS);
    if (fileObject != null)
        return fileObject;

    fileObject = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className,
            JavaFileObject.Kind.CLASS);
    if (fileObject != null)
        return fileObject;

    final StandardJavaFileManager standardFileManager = (StandardJavaFileManager) fileManager;
    return standardFileManager.getJavaFileObjects(className).iterator().next();
}