当前位置: 首页>>代码示例>>Java>>正文


Java JavacMessages类代码示例

本文整理汇总了Java中com.sun.tools.javac.util.JavacMessages的典型用法代码示例。如果您正苦于以下问题:Java JavacMessages类的具体用法?Java JavacMessages怎么用?Java JavacMessages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavacMessages类属于com.sun.tools.javac.util包,在下文中一共展示了JavacMessages类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
    Locale locale = context.get(Locale.class);
    JavacMessages messages = context.get(JavacMessages.messagesKey);

    round++;
    if (round == 1) {
        initialLocale = locale;
        initialMessages = messages;
    } else {
        checkEqual("locale", locale, initialLocale);
        checkEqual("messages", messages, initialMessages);
    }

    return true;
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:18,代码来源:T6597678.java

示例2: JavacProcessingEnvironment

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
public JavacProcessingEnvironment(Context context, Iterable<? extends Processor> processors) {
    this.context = context;
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    procOnly = options.isSet(PROC, "only") || options.isSet(XPRINT);
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();
    foundTypeProcessors = false;

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    initProcessorIterator(context, processors);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:JavacProcessingEnvironment.java

示例3: Types

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:Types.java

示例4: Messager

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
/**
 * Constructor
 * @param programName  Name of the program (for error messages).
 * @param errWriter    Stream for error messages
 * @param warnWriter   Stream for warnings
 * @param noticeWriter Stream for other messages
 */
@SuppressWarnings("deprecation")
protected Messager(Context context,
                   String programName,
                   PrintWriter errWriter,
                   PrintWriter warnWriter,
                   PrintWriter noticeWriter) {
    super(context, errWriter, warnWriter, noticeWriter);
    messages = JavacMessages.instance(context);
    messages.add("com.sun.tools.javadoc.resources.javadoc");
    javadocDiags = new JCDiagnostic.Factory(messages, "javadoc");
    this.programName = programName;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:Messager.java

示例5: JavacProcessingEnvironment

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
protected JavacProcessingEnvironment(Context context) {
    this.context = context;
    context.put(JavacProcessingEnvironment.class, this);
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    if (options.isSet(PROC, "only") || options.isSet(XPRINT)) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
    }
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    taskListener = MultiTaskListener.instance(context);
    initProcessorClassLoader();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:JavacProcessingEnvironment.java

示例6: Messager

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
/**
 * Constructor
 * @param programName  Name of the program (for error messages).
 * @param outWriter    Stream for notices etc.
 * @param errWriter    Stream for errors and warnings
 */
@SuppressWarnings("deprecation")
public Messager(Context context, String programName, PrintWriter outWriter, PrintWriter errWriter) {
    super(context, errWriter, errWriter, outWriter);
    messages = JavacMessages.instance(context);
    messages.add(locale -> ResourceBundle.getBundle("jdk.javadoc.internal.tool.resources.javadoc",
                                                     locale));
    javadocDiags = new JCDiagnostic.Factory(messages, "javadoc");
    this.programName = programName;
    this.context = context;
    locale = Locale.getDefault();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Messager.java

示例7: Messager

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
/**
 * Constructor
 * @param programName  Name of the program (for error messages).
 * @param errWriter    Stream for error messages
 * @param warnWriter   Stream for warnings
 * @param noticeWriter Stream for other messages
 */
@SuppressWarnings("deprecation")
protected Messager(Context context,
                   String programName,
                   PrintWriter errWriter,
                   PrintWriter warnWriter,
                   PrintWriter noticeWriter) {
    super(context, errWriter, warnWriter, noticeWriter);
    messages = JavacMessages.instance(context);
    messages.add(locale -> ResourceBundle.getBundle("com.sun.tools.javadoc.resources.javadoc",
                                                     locale));
    javadocDiags = new JCDiagnostic.Factory(messages, "javadoc");
    this.programName = programName;

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:Messager.java

示例8: process

import com.sun.tools.javac.util.JavacMessages; //导入依赖的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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:T6597678.java

示例9: Bark

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
/**
 * Creates a Bark.
 */
protected Bark(Context context) {
    super(context); // will register this object in context with Log.logKey
    context.put(barkKey, this);

    // register additional resource bundle for APT messages.
    JavacMessages aptMessages = JavacMessages.instance(context);
    aptMessages.add("com.sun.tools.apt.resources.apt");
    aptDiags = new JCDiagnostic.Factory(aptMessages, "apt");

    multipleErrors = true;
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:15,代码来源:Bark.java

示例10: report

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
@Override
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
  DiagnosticFormatter<JCDiagnostic> formatter = Log.instance(context).getDiagnosticFormatter();
  Locale locale = JavacMessages.instance(context).getCurrentLocale();
  String formatted = formatter.format((JCDiagnostic) diagnostic, locale);
  diagnostics.add(new FormattedDiagnostic(diagnostic, formatted));
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:8,代码来源:FormattedDiagnostic.java

示例11: JavacProcessingEnvironment

import com.sun.tools.javac.util.JavacMessages; //导入依赖的package包/类
protected JavacProcessingEnvironment(Context context) {
    this.context = context;
    context.put(JavacProcessingEnvironment.class, this);
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(Option.XPRINTPROCESSORINFO);
    printRounds = options.isSet(Option.XPRINTROUNDS);
    verbose = options.isSet(Option.VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    compiler = JavaCompiler.instance(context);
    if (options.isSet(Option.PROC, "only") || options.isSet(Option.XPRINT)) {
        compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
    }
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(Option.WERROR);
    fileManager = context.get(JavaFileManager.class);
    platformAnnotations = initPlatformAnnotations();

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    modules = Modules.instance(context);
    types = Types.instance(context);
    annotate = Annotate.instance(context);
    processorOptions = initProcessorOptions();
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    taskListener = MultiTaskListener.instance(context);
    symtab = Symtab.instance(context);
    names = Names.instance(context);
    enter = Enter.instance(context);
    initialCompleter = ClassFinder.instance(context).getCompleter();
    chk = Check.instance(context);
    initProcessorLoader();

    allowModules = source.allowModules();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:JavacProcessingEnvironment.java


注:本文中的com.sun.tools.javac.util.JavacMessages类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。