com.sun.tools.javac.main.JavaCompiler.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(222)

本文整理了Java中com.sun.tools.javac.main.JavaCompiler.<init>()方法的一些代码示例,展示了JavaCompiler.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaCompiler.<init>()方法的具体详情如下:
包路径:com.sun.tools.javac.main.JavaCompiler
类名称:JavaCompiler
方法名:<init>

JavaCompiler.<init>介绍

[英]Construct a new compiler using a shared context.
[中]使用共享上下文构造新编译器。

代码示例

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Get the JavaCompiler instance for this context. */
public static JavaCompiler instance(Context context) {
  JavaCompiler instance = context.get(compilerKey);
  if (instance == null)
    instance = new JavaCompiler(context);
  return instance;
}

代码示例来源:origin: sc.fiji/javac

/** Get the JavaCompiler instance for this context. */
public static JavaCompiler instance(Context context) {
  JavaCompiler instance = context.get(compilerKey);
  if (instance == null)
    instance = new JavaCompiler(context);
  return instance;
}

代码示例来源:origin: konsoletyper/teavm-javac

/** Get the JavaCompiler instance for this context. */
public static JavaCompiler instance(Context context) {
  JavaCompiler instance = context.get(compilerKey);
  if (instance == null)
    instance = new JavaCompiler(context);
  return instance;
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** Get the JavaCompiler instance for this context. */
public static JavaCompiler instance(Context context) {
  JavaCompiler instance = context.get(compilerKey);
  if (instance == null)
    instance = new JavaCompiler(context);
  return instance;
}

代码示例来源:origin: org.projectlombok/lombok-utils

public static CommentCatcher create(Context context) {
  registerCommentsCollectingScannerFactory(context);
  JavaCompiler compiler = new JavaCompiler(context);
  
  setInCompiler(compiler, context);
  
  compiler.keepComments = true;
  compiler.genEndPos = true;
  
  return new CommentCatcher(compiler);
}

代码示例来源:origin: org.projectlombok/lombok.ast

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;
  compiler.keepComments = true;
  
  @SuppressWarnings("deprecation") JCCompilationUnit cu = compiler.parse(args[0]);
  JcTreePrinter printer = new JcTreePrinter(true);
  printer.visit(cu);
  System.out.println(printer);
}

代码示例来源:origin: me.tatarka.retrolambda.projectlombok/lombok.ast

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;
  compiler.keepComments = true;
  
  @SuppressWarnings("deprecation") JCCompilationUnit cu = compiler.parse(args[0]);
  JcTreePrinter printer = new JcTreePrinter(true);
  printer.visit(cu);
  System.out.println(printer);
}

代码示例来源:origin: com.android.tools.external.lombok/lombok-ast

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;
  compiler.keepComments = true;
  
  @SuppressWarnings("deprecation") JCCompilationUnit cu = compiler.parse(args[0]);
  JcTreePrinter printer = new JcTreePrinter(true);
  printer.visit(cu);
  System.out.println(printer);
}

代码示例来源:origin: com.android.tools.external.lombok/lombok-ast

@Override public JCCompilationUnit process(Source in, Void irrelevant) throws ConversionProblem {
    Context context = new Context();
    
    Options.instance(context).put(OptionName.ENCODING, charset.name());
    
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.keepComments = true;
    
    JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(in.getName(), in.getRawInput()));
    
    return cu;
  }
};

代码示例来源:origin: org.projectlombok/lombok.ast

@Override public JCCompilationUnit process(Source in, Void irrelevant) throws ConversionProblem {
    Context context = new Context();
    
    Options.instance(context).put(OptionName.ENCODING, charset.name());
    
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.keepComments = true;
    
    JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(in.getName(), in.getRawInput()));
    
    return cu;
  }
};

代码示例来源:origin: me.tatarka.retrolambda.projectlombok/lombok.ast

@Override public JCCompilationUnit process(Source in, Void irrelevant) throws ConversionProblem {
    Context context = new Context();
    
    Options.instance(context).put(OptionName.ENCODING, charset.name());
    
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.keepComments = true;
    
    JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(in.getName(), in.getRawInput()));
    
    return cu;
  }
};

代码示例来源:origin: org.checkerframework/dataflow

JavaCompiler javac = new JavaCompiler(context);
JavacFileManager fileManager = (JavacFileManager) context.get(JavaFileManager.class);

相关文章