com.sun.tools.javac.util.BaseFileManager Java Examples

The following examples show how to use com.sun.tools.javac.util.BaseFileManager. 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: CompilerThread.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #2
Source File: CompilerThread.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #3
Source File: CompilerThread.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #4
Source File: CompilerThread.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #5
Source File: CompilerThread.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #6
Source File: CompilerThread.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #7
Source File: CompilerThread.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepare the compiler thread for use. It is not yet started.
 * It will be started by the executor service.
 */
public synchronized void use() {
    assert(!inUse);
    inUse = true;
    compiler = com.sun.tools.javac.api.JavacTool.create();
    fileManager = compiler.getStandardFileManager(null, null, null);
    fileManagerBase = (BaseFileManager)fileManager;
    smartFileManager = new SmartFileManager(fileManager);
    context = new Context();
    context.put(JavaFileManager.class, smartFileManager);
    ResolveWithDeps.preRegister(context);
    JavaCompilerWithDeps.preRegister(context, this);
    subTasks = new ArrayList<Future<?>>();
}
 
Example #8
Source File: PathFileObject.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}
 
Example #9
Source File: PathFileObject.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}
 
Example #10
Source File: BaseFileObject.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #11
Source File: PathFileObject.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}
 
Example #12
Source File: BaseFileObject.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #13
Source File: PathFileObject.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}
 
Example #14
Source File: BaseFileObject.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #15
Source File: BaseFileObject.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
protected static Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #16
Source File: JavaCompiler.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Construct a new compiler using a shared context.
 */
public JavaCompiler(Context context) {
    this.context = context;
    context.put(compilerKey, this);

    // if fileManager not already set, register the JavacFileManager to be used
    if (context.get(JavaFileManager.class) == null)
        JavacFileManager.preRegister(context);

    names = Names.instance(context);
    log = Log.instance(context);
    diagFactory = JCDiagnostic.Factory.instance(context);
    reader = ClassReader.instance(context);
    make = TreeMaker.instance(context);
    writer = ClassWriter.instance(context);
    enter = Enter.instance(context);
    todo = Todo.instance(context);

    fileManager = context.get(JavaFileManager.class);
    parserFactory = ParserFactory.instance(context);

    try {
        // catch completion problems with predefineds
        syms = Symtab.instance(context);
    } catch (CompletionFailure ex) {
        // inlined Check.completionError as it is not initialized yet
        log.error("cant.access", ex.sym, ex.getDetailValue());
        if (ex instanceof ClassReader.BadClassFile)
            throw new Abort();
    }
    source = Source.instance(context);
    attr = Attr.instance(context);
    chk = Check.instance(context);
    gen = Gen.instance(context);
    flow = Flow.instance(context);
    transTypes = TransTypes.instance(context);
    lower = Lower.instance(context);
    annotate = Annotate.instance(context);
    types = Types.instance(context);
    taskListener = context.get(TaskListener.class);

    reader.sourceCompleter = this;

    options = Options.instance(context);

    verbose = options.isSet(VERBOSE);
    sourceOutput = options.isSet(PRINTSOURCE); // used to be -s
    stubOutput = options.isSet("-stubs");
    relax = options.isSet("-relax");
    printFlat = options.isSet("-printflat");
    attrParseOnly = options.isSet("-attrparseonly");
    encoding = options.get(ENCODING);
    lineDebugInfo = options.isUnset(G_CUSTOM) ||
            options.isSet(G_CUSTOM, "lines");
    genEndPos = options.isSet(XJCOV) ||
            context.get(DiagnosticListener.class) != null;
    devVerbose = options.isSet("dev");
    processPcks = options.isSet("process.packages");
    werror = options.isSet(WERROR);

    if (source.compareTo(Source.DEFAULT) < 0) {
        if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) {
            if (fileManager instanceof BaseFileManager) {
                if (((BaseFileManager) fileManager).isDefaultBootClassPath())
                    log.warning(LintCategory.OPTIONS, "source.no.bootclasspath", source.name);
            }
        }
    }

    verboseCompilePolicy = options.isSet("verboseCompilePolicy");

    if (attrParseOnly)
        compilePolicy = CompilePolicy.ATTR_ONLY;
    else
        compilePolicy = CompilePolicy.decode(options.get("compilePolicy"));

    implicitSourcePolicy = ImplicitSourcePolicy.decode(options.get("-implicit"));

    completionFailureName =
            options.isSet("failcomplete")
                    ? names.fromString(options.get("failcomplete"))
                    : null;

    shouldStopPolicy =
            options.isSet("shouldStopPolicy")
                    ? CompileState.valueOf(options.get("shouldStopPolicy"))
                    : null;
    if (options.isUnset("oldDiags"))
        log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context));
}
 
Example #17
Source File: BaseFileObject.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #18
Source File: BaseFileObject.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #19
Source File: PathFileObject.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}
 
Example #20
Source File: BaseFileObject.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #21
Source File: BaseFileObject.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
protected static Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #22
Source File: JavaCompiler.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Construct a new compiler using a shared context.
 */
public JavaCompiler(Context context) {
    this.context = context;
    context.put(compilerKey, this);

    // if fileManager not already set, register the JavacFileManager to be used
    if (context.get(JavaFileManager.class) == null)
        JavacFileManager.preRegister(context);

    names = Names.instance(context);
    log = Log.instance(context);
    diagFactory = JCDiagnostic.Factory.instance(context);
    reader = ClassReader.instance(context);
    make = TreeMaker.instance(context);
    writer = ClassWriter.instance(context);
    enter = Enter.instance(context);
    todo = Todo.instance(context);

    fileManager = context.get(JavaFileManager.class);
    parserFactory = ParserFactory.instance(context);

    try {
        // catch completion problems with predefineds
        syms = Symtab.instance(context);
    } catch (CompletionFailure ex) {
        // inlined Check.completionError as it is not initialized yet
        log.error("cant.access", ex.sym, ex.getDetailValue());
        if (ex instanceof ClassReader.BadClassFile)
            throw new Abort();
    }
    source = Source.instance(context);
    attr = Attr.instance(context);
    chk = Check.instance(context);
    gen = Gen.instance(context);
    flow = Flow.instance(context);
    transTypes = TransTypes.instance(context);
    lower = Lower.instance(context);
    annotate = Annotate.instance(context);
    types = Types.instance(context);
    taskListener = context.get(TaskListener.class);

    reader.sourceCompleter = this;

    options = Options.instance(context);

    verbose = options.isSet(VERBOSE);
    sourceOutput = options.isSet(PRINTSOURCE); // used to be -s
    stubOutput = options.isSet("-stubs");
    relax = options.isSet("-relax");
    printFlat = options.isSet("-printflat");
    attrParseOnly = options.isSet("-attrparseonly");
    encoding = options.get(ENCODING);
    lineDebugInfo = options.isUnset(G_CUSTOM) ||
            options.isSet(G_CUSTOM, "lines");
    genEndPos = options.isSet(XJCOV) ||
            context.get(DiagnosticListener.class) != null;
    devVerbose = options.isSet("dev");
    processPcks = options.isSet("process.packages");
    werror = options.isSet(WERROR);

    if (source.compareTo(Source.DEFAULT) < 0) {
        if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) {
            if (fileManager instanceof BaseFileManager) {
                if (((BaseFileManager) fileManager).isDefaultBootClassPath())
                    log.warning(LintCategory.OPTIONS, "source.no.bootclasspath", source.name);
            }
        }
    }

    verboseCompilePolicy = options.isSet("verboseCompilePolicy");

    if (attrParseOnly)
        compilePolicy = CompilePolicy.ATTR_ONLY;
    else
        compilePolicy = CompilePolicy.decode(options.get("compilePolicy"));

    implicitSourcePolicy = ImplicitSourcePolicy.decode(options.get("-implicit"));

    completionFailureName =
            options.isSet("failcomplete")
                    ? names.fromString(options.get("failcomplete"))
                    : null;

    shouldStopPolicy =
            options.isSet("shouldStopPolicy")
                    ? CompileState.valueOf(options.get("shouldStopPolicy"))
                    : null;
    if (options.isUnset("oldDiags"))
        log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context));
}
 
Example #23
Source File: PathFileObject.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}
 
Example #24
Source File: BaseFileObject.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected static JavaFileObject.Kind getKind(String filename) {
    return BaseFileManager.getKind(filename);
}
 
Example #25
Source File: PathFileObject.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Kind getKind() {
    return BaseFileManager.getKind(path.getFileName().toString());
}