com.sun.tools.javac.file.CacheFSInfo Java Examples

The following examples show how to use com.sun.tools.javac.file.CacheFSInfo. 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: JavacTool.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override @DefinedBy(Api.COMPILER)
public JavacFileManager getStandardFileManager(
    DiagnosticListener<? super JavaFileObject> diagnosticListener,
    Locale locale,
    Charset charset) {
    Context context = new Context();
    context.put(Locale.class, locale);
    if (diagnosticListener != null)
        context.put(DiagnosticListener.class, diagnosticListener);
    PrintWriter pw = (charset == null)
            ? new PrintWriter(System.err, true)
            : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
    context.put(Log.errKey, pw);
    CacheFSInfo.preRegister(context);
    return new JavacFileManager(context, true, charset);
}
 
Example #2
Source File: JavacTool.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override @DefinedBy(Api.COMPILER)
public JavacFileManager getStandardFileManager(
    DiagnosticListener<? super JavaFileObject> diagnosticListener,
    Locale locale,
    Charset charset) {
    Context context = new Context();
    context.put(Locale.class, locale);
    if (diagnosticListener != null)
        context.put(DiagnosticListener.class, diagnosticListener);
    PrintWriter pw = (charset == null)
            ? new PrintWriter(System.err, true)
            : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
    context.put(Log.errKey, pw);
    CacheFSInfo.preRegister(context);
    return new JavacFileManager(context, true, charset);
}
 
Example #3
Source File: FSInfoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
void testCacheEnabled() throws IOException {

    String[] args = { };
    String[] files = { "C.java"};

    TestResult tr = runMain(args, files);
    FSInfo info = tr.context.get(FSInfo.class);
    if (!(info instanceof CacheFSInfo))
        error("unexpected FSInfo; found " + info.getClass() + ", expected CacheFSInfo");
}
 
Example #4
Source File: FSInfoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
void testCacheDisabled() throws IOException {
    writeFile("C.java", "class C { }");

    String[] args = { "-XDnonBatchMode" };
    String[] files = { "C.java"};

    TestResult tr = runMain(args, files);
    FSInfo info = tr.context.get(FSInfo.class);
    if (info instanceof CacheFSInfo)
        error("unexpected CacheFSInfo found");
}
 
Example #5
Source File: JavacTurbineCompiler.java    From bazel with Apache License 2.0 4 votes vote down vote up
private static Context getContext() {
  Context context = new Context();
  CacheFSInfo.preRegister(context);
  return context;
}
 
Example #6
Source File: BlazeJavacMain.java    From bazel with Apache License 2.0 4 votes vote down vote up
private static Context getContext() {
  Context context = new Context();
  CacheFSInfo.preRegister(context);
  return context;
}