本文整理了Java中com.sun.tools.javac.main.JavaCompiler.initProcessAnnotations()
方法的一些代码示例,展示了JavaCompiler.initProcessAnnotations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaCompiler.initProcessAnnotations()
方法的具体详情如下:
包路径:com.sun.tools.javac.main.JavaCompiler
类名称:JavaCompiler
方法名:initProcessAnnotations
[英]Check if we should process annotations. If so, and if no scanner is yet registered, then set up the DocCommentScanner to catch doc comments, and set keepComments so the parser records them in the compilation unit.
[中]检查是否应该处理注释。如果是这样,并且还没有注册扫描程序,则设置DocCommentScanner以捕获文档注释,并设置keepComments,以便解析器在编译单元中记录它们。
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
private void prepareCompiler() throws IOException {
if (used.getAndSet(true)) {
if (compiler == null)
throw new IllegalStateException();
} else {
initContext();
compilerMain.log = Log.instance(context);
compilerMain.setOptions(Options.instance(context));
compilerMain.filenames = new LinkedHashSet<File>();
Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
if (filenames != null && !filenames.isEmpty())
throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
compiler = JavaCompiler.instance(context);
compiler.keepComments = true;
compiler.genEndPos = true;
// NOTE: this value will be updated after annotation processing
compiler.initProcessAnnotations(processors);
notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
for (JavaFileObject file: fileObjects)
notYetEntered.put(file, null);
genList = new ListBuffer<Env<AttrContext>>();
// endContext will be called when all classes have been generated
// TODO: should handle the case after each phase if errors have occurred
args = null;
classNames = null;
}
}
代码示例来源:origin: konsoletyper/teavm-javac
private void prepareCompiler() throws IOException {
if (used.getAndSet(true)) {
if (compiler == null)
throw new IllegalStateException();
} else {
initContext();
compilerMain.log = Log.instance(context);
compilerMain.setOptions(Options.instance(context));
compilerMain.filenames = new LinkedHashSet<File>();
Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
if (filenames != null && !filenames.isEmpty())
throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
compiler = JavaCompiler.instance(context);
compiler.keepComments = true;
compiler.genEndPos = true;
// NOTE: this value will be updated after annotation processing
compiler.initProcessAnnotations(processors);
notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
for (JavaFileObject file: fileObjects)
notYetEntered.put(file, null);
genList = new ListBuffer<Env<AttrContext>>();
// endContext will be called when all classes have been generated
// TODO: should handle the case after each phase if errors have occurred
args = null;
classNames = null;
}
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
private void prepareCompiler() throws IOException {
if (!used.getAndSet(true)) {
beginContext();
compilerMain.setOptions(Options.instance(context));
compilerMain.filenames = new ListBuffer<File>();
List<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
if (!filenames.isEmpty())
throw new IllegalArgumentException("Malformed arguments " + filenames.toString(" "));
compiler = JavaCompiler.instance(context);
// force the use of the scanner that captures Javadoc comments
com.sun.tools.javac.parser.DocCommentScanner.Factory.preRegister(context);
compiler.keepComments = true;
compiler.genEndPos = true;
// NOTE: this value will be updated after annotation processing
compiler.initProcessAnnotations(processors);
notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
for (JavaFileObject file: fileObjects)
notYetEntered.put(file, null);
genList = new ListBuffer<Env<AttrContext>>();
// endContext will be called when all classes have been generated
// TODO: should handle the case after each phase if errors have occurred
args = null;
}
}
代码示例来源:origin: sc.fiji/javac
private void prepareCompiler() throws IOException {
if (!used.getAndSet(true)) {
beginContext();
compilerMain.setOptions(Options.instance(context));
compilerMain.filenames = new ListBuffer<File>();
List<File> filenames = compilerMain.processArgs(CommandLine.parse(args));
if (!filenames.isEmpty())
throw new IllegalArgumentException("Malformed arguments " + filenames.toString(" "));
compiler = JavaCompiler.instance(context);
// force the use of the scanner that captures Javadoc comments
com.sun.tools.javac.parser.DocCommentScanner.Factory.preRegister(context);
compiler.keepComments = true;
compiler.genEndPos = true;
// NOTE: this value will be updated after annotation processing
compiler.initProcessAnnotations(processors);
notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
for (JavaFileObject file: fileObjects)
notYetEntered.put(file, null);
genList = new ListBuffer<Env<AttrContext>>();
// endContext will be called when all classes have been generated
// TODO: should handle the case after each phase if errors have occurred
args = null;
}
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
initProcessAnnotations(processors);
代码示例来源:origin: sc.fiji/javac
initProcessAnnotations(processors);
代码示例来源:origin: konsoletyper/teavm-javac
initProcessAnnotations(processors);
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
initProcessAnnotations(processors);
内容来源于网络,如有侵权,请联系作者删除!