Package com.sun.tools.javac.util

Examples of com.sun.tools.javac.util.Context$Key


    validateQuery(query);
    validateSplitSize(numSplits);

    List<Query> splits = new ArrayList<Query>(numSplits);
    List<Key> scatterKeys = getScatterKeys(numSplits, query, datastore);
    Key lastKey = null;
    for (Key nextKey : getSplitKey(scatterKeys, numSplits)) {
      splits.add(createSplit(lastKey, nextKey, query));
      lastKey = nextKey;
    }
    splits.add(createSplit(lastKey, null, query));
View Full Code Here


    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.outKey, pw);
        return new JavacFileManager(context, true, charset);
    }
View Full Code Here

                             Iterable<String> options,
                             Iterable<String> classes,
                             Iterable<? extends JavaFileObject> compilationUnits)
    {
        try {
            Context context = new Context();
            ClientCodeWrapper ccw = ClientCodeWrapper.instance(context);

            final String kindMsg = "All compilation units must be of SOURCE kind";
            if (options != null)
                for (String option : options)
                    option.getClass(); // null check
            if (classes != null) {
                for (String cls : classes)
                    if (!SourceVersion.isName(cls)) // implicit null check
                        throw new IllegalArgumentException("Not a valid class name: " + cls);
            }
            if (compilationUnits != null) {
                compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check
                for (JavaFileObject cu : compilationUnits) {
                    if (cu.getKind() != JavaFileObject.Kind.SOURCE)
                        throw new IllegalArgumentException(kindMsg);
                }
            }

            if (diagnosticListener != null)
                context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));

            if (out == null)
                context.put(Log.outKey, new PrintWriter(System.err, true));
            else
                context.put(Log.outKey, new PrintWriter(out, true));

            if (fileManager == null)
                fileManager = getStandardFileManager(diagnosticListener, null, null);
            fileManager = ccw.wrap(fileManager);
            context.put(JavaFileManager.class, fileManager);
            processOptions(context, fileManager, options);
            Main compiler = new Main("javacTask", context.get(Log.outKey));
            return new JavacTaskImpl(compiler, options, context, classes, compilationUnits);
        } catch (ClientCodeException ex) {
            throw new RuntimeException(ex.getCause());
        }
    }
View Full Code Here

      return SourceVersion.latest();
    }

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
      Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
      assertSame(expected, context.get(Scanner.class));
      return false;
    }
View Full Code Here

public class ErrorProneInMemoryFileManager extends JavacPathFileManager {
 
  private final FileSystem fileSystem;
 
  public ErrorProneInMemoryFileManager() {
    super(new Context(), false, UTF_8);
    this.fileSystem = Jimfs.newFileSystem(Configuration.unix());
    setDefaultFileSystem(fileSystem);
  }
View Full Code Here

    return compile(new String[]{}, sources, processors);
  }
 
  public Result compile(String[] args, List<JavaFileObject> sources, List<? extends Processor>
      processors) {
    Context context = new Context();
    context.put(JavaFileManager.class, fileManager);
    List<String> processedArgs =
        CompilationTestHelper.disableImplicitProcessing(Arrays.asList(args));
    String[] argsArray = processedArgs.toArray(new String[processedArgs.size()]);
    return compiler.compile(argsArray, context, asJavacList(sources), processors);
  }
View Full Code Here

    assertCompileFailsWithMessages(ImmutableList.of(source));
  }

  Result compile(Iterable<JavaFileObject> sources, String[] args) {
    checkWellFormed(sources, args);
    Context context = new Context();
    context.put(JavaFileManager.class, fileManager);
    return compiler.compile(args, context, asJavacList(sources), null);
  }
View Full Code Here

    defaultFilter = 5L;
    docLocale = "";
    breakiterator = false;
    encoding = null;
    rejectWarnings = false;
    context = new Context();
    messager = new net.jangaroo.joodoc.Messager(context, s);
    defaultDocletClassName = s1;
  }
View Full Code Here

    defaultFilter = 5L;
    docLocale = "";
    breakiterator = false;
    encoding = null;
    rejectWarnings = false;
    context = new Context();
    messager = new net.jangaroo.joodoc.Messager(context, s, printwriter, printwriter1, printwriter2);
    defaultDocletClassName = s1;
  }
View Full Code Here

     */
    public static JavacTask instance(ProcessingEnvironment processingEnvironment) {
        if (!processingEnvironment.getClass().getName().equals(
                "com.sun.tools.javac.processing.JavacProcessingEnvironment"))
            throw new IllegalArgumentException();
        Context c = ((JavacProcessingEnvironment) processingEnvironment).getContext();
        JavacTask t = c.get(JavacTask.class);
        return (t != null) ? t : new BasicJavacTask(c, true);
    }
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.util.Context$Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.