Package com.sun.tools.javac.util

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


    public JavacFileManager getStandardFileManager(
        DiagnosticListener<? super JavaFileObject> diagnosticListener,
        Locale locale,
        Charset charset) {
        Context context = new Context();
        if (diagnosticListener != null)
            context.put(DiagnosticListener.class, diagnosticListener);
        context.put(Log.outKey, new PrintWriter(System.err, true)); // FIXME
        return new JavacFileManager(context, true, charset);
    }
View Full Code Here


                if (cu.getKind() != JavaFileObject.Kind.SOURCE) // implicit null check
                    throw new IllegalArgumentException(kindMsg);
            }
        }

        Context context = new Context();

        if (diagnosticListener != null)
            context.put(DiagnosticListener.class, 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);
        context.put(JavaFileManager.class, fileManager);
        processOptions(context, fileManager, options);
        Main compiler = new Main("javacTask", context.get(Log.outKey));
        return new JavacTaskImpl(this, compiler, options, context, classes, compilationUnits);
       
        }finally{//ζˆ‘εŠ δΈŠηš„
  DEBUG.P(0,this,"getTask(6)");
  }
View Full Code Here

    protected Map<String, String> options;

    @Override
    public void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
        final Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
        symTable = Symtab.instance(context);
        trees = Trees.instance(processingEnv);
        elementUtils = JavacElements.instance(context);
        msgr = processingEnv.getMessager();
        tm = TreeMaker.instance(((JavacProcessingEnvironment) processingEnv).getContext());
View Full Code Here

  public JcTreeBuilder() {
    this(null, createNewContext());
  }
 
  private static Context createNewContext() {
    Context c = new Context();
    // Older javacs such as the 1.6 of apple has DefaultFileManager. Newer ones have JavacFileManager.
    // As javac6 might be on the classpath, JavacFileManager will probably exist but its initialization will fail.
    // Initializing both is as far as I know not an issue. -ReinierZ
    try {
      Method m = Class.forName("com.sun.tools.javac.util.DefaultFileManager").getDeclaredMethod("preRegister", Context.class);
View Full Code Here

  public static void main(String[] args) throws IOException {
    if (args.length == 0) {
      System.out.println("Usage: Supply a file name to print.");
      return;
    }
    Context context = new Context();
   
    Options.instance(context).put(OptionName.ENCODING, "UTF-8");
   
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
View Full Code Here

  private static final Logger logger = Logger.getLogger(JAXBDocletTest.class.getName());

  @Test
  public void testStart() throws IOException {
    Context context = new Context();
    Options compOpts = Options.instance(context);
    compOpts.put("-sourcepath", "src/test/java");
    new PublicMessager(context, "test", new PrintWriter(new LogWriter(Level.SEVERE), true), new PrintWriter(new LogWriter(Level.WARNING),
        true), new PrintWriter(new LogWriter(Level.FINE), true));
View Full Code Here

      ReportingParseRunner.run(parser.CompilationUnit(), source.getRawInput());
    }
  }
 
  private void parseWithJavac(Source source) {
    Context context = new Context();
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.parse(new ContentBasedJavaFileObject(source.getName(), source.getRawInput()));
  }
View Full Code Here

   
    return nodes.get(0);
  }
 
  protected Node parseWithTargetCompiler(Source source) {
    Context context = new Context();
   
    Options.instance(context).put(OptionName.ENCODING, "UTF-8");
   
    CommentCatcher catcher = CommentCatcher.create(context);
    JavaCompiler compiler = catcher.getCompiler();
View Full Code Here

  protected boolean checkForLombokAstParseFailure() {
    return false;
  }
 
  protected JCTree parseWithLombok(Source source) {
    Context context = new Context();
   
    Options.instance(context).put(OptionName.ENCODING, "UTF-8");
   
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
View Full Code Here

    builder.visit(converter.getResult());
    return builder.get();
  }
 
  protected JCTree parseWithTargetCompiler(Source source) {
    Context context = new Context();
   
    Options.instance(context).put(OptionName.ENCODING, "UTF-8");
   
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
View Full Code Here

TOP

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

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.