本文整理汇总了Java中com.sun.tools.javac.util.Log.getWriter方法的典型用法代码示例。如果您正苦于以下问题:Java Log.getWriter方法的具体用法?Java Log.getWriter怎么用?Java Log.getWriter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.util.Log
的用法示例。
在下文中一共展示了Log.getWriter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.sun.tools.javac.util.Log; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
Log log = Log.instance(context);
PrintWriter noteOut = log.getWriter(Log.WriterKind.NOTICE);
PrintWriter warnOut = log.getWriter(Log.WriterKind.WARNING);
PrintWriter errOut = log.getWriter(Log.WriterKind.ERROR);
Locale locale = context.get(Locale.class);
JavacMessages messages = context.get(JavacMessages.messagesKey);
round++;
if (round == 1) {
initialLocale = locale;
initialMessages = messages;
initialNoteWriter = noteOut;
initialWarnWriter = warnOut;
initialErrWriter = errOut;
String writerStringOpt = options.get("WriterString").intern();
checkEqual("noteWriterString", noteOut.toString().intern(), writerStringOpt);
checkEqual("warnWriterString", warnOut.toString().intern(), writerStringOpt);
checkEqual("errWriterString", errOut.toString().intern(), writerStringOpt);
} else {
checkEqual("locale", locale, initialLocale);
checkEqual("messages", messages, initialMessages);
checkEqual("noteWriter", noteOut, initialNoteWriter);
checkEqual("warnWriter", warnOut, initialWarnWriter);
checkEqual("errWriter", errOut, initialErrWriter);
}
return true;
}