com.sun.tools.javac.util.JavacMessages Java Examples
The following examples show how to use
com.sun.tools.javac.util.JavacMessages.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: T6597678.java From hottub with GNU General Public License v2.0 | 5 votes |
@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; }
Example #2
Source File: JavacProcessingEnvironment.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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(); }
Example #3
Source File: Messager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #4
Source File: JavacProcessingEnvironment.java From javaide with GNU General Public License v3.0 | 5 votes |
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); }
Example #5
Source File: Types.java From javaide with GNU General Public License v3.0 | 5 votes |
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); }
Example #6
Source File: Messager.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example #7
Source File: Messager.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #8
Source File: T6597678.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #9
Source File: Messager.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #10
Source File: JavacProcessingEnvironment.java From hottub with GNU General Public License v2.0 | 5 votes |
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(); }
Example #11
Source File: T6597678.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@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; }
Example #12
Source File: Messager.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #13
Source File: JavacProcessingEnvironment.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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(); }
Example #14
Source File: T6597678.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@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; }
Example #15
Source File: Messager.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #16
Source File: JavacProcessingEnvironment.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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(); }
Example #17
Source File: T6597678.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #18
Source File: FastBuildJavacImpl.java From intellij with Apache License 2.0 | 5 votes |
@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 DiagnosticLine( diagnostic.getKind(), diagnostic.getMessage(locale), formatted, diagnostic.getSource() != null ? diagnostic.getSource().toUri() : null, diagnostic.getLineNumber(), diagnostic.getColumnNumber())); }
Example #19
Source File: FormattedDiagnostic.java From bazel with Apache License 2.0 | 5 votes |
@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); LintCategory lintCategory = ((JCDiagnostic) diagnostic).getLintCategory(); FormattedDiagnostic formattedDiagnostic = new FormattedDiagnostic( diagnostic, formatted, lintCategory != null ? lintCategory.option : null); diagnostics.add(formattedDiagnostic); if (failFast && diagnostic.getKind().equals(Diagnostic.Kind.ERROR)) { throw new FailFastException(formatted); } }
Example #20
Source File: Messager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #21
Source File: JavacProcessingEnvironment.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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(); }
Example #22
Source File: T6597678.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #23
Source File: Log.java From deptective with Apache License 2.0 | 5 votes |
private void registerResourceBundle(JavacMessages messages) { // Without touch the class here, I'm getting a weird classloading error // when using Maven and not having <fork>true</fork> :( DeptectiveMessages.class.getName(); try { messages.add(l -> ResourceBundle.getBundle(DeptectiveMessages.class.getName(), l)); } // add(ResourceBundleHelper) doesn't exist in Java 8 catch (Throwable t) { registeredResourceBundle = false; } }
Example #24
Source File: Messager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #25
Source File: JavacProcessingEnvironment.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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(); }
Example #26
Source File: T6597678.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #27
Source File: JavacProcessingEnvironment.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
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); }
Example #28
Source File: Types.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
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); }
Example #29
Source File: Messager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #30
Source File: JavacProcessingEnvironment.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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(); }