com.sun.tools.javac.util.JCDiagnostic.DiagnosticType Java Examples
The following examples show how to use
com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.
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: Log.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return noticeWriter; case WARNING: return warnWriter; case ERROR: return errWriter; default: throw new Error(); } }
Example #2
Source File: Log.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return noticeWriter; case WARNING: return warnWriter; case ERROR: return errWriter; default: throw new Error(); } }
Example #3
Source File: Resolve.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { List<Symbol> diagSyms = ambiguousSyms.reverse(); Symbol s1 = diagSyms.head; Symbol s2 = diagSyms.tail.head; Name sname = s1.name; if (sname == names.init) sname = s1.owner.name; return diags.create(dkind, log.currentSource(), pos, "ref.ambiguous", sname, kindName(s1), s1, s1.location(site, types), kindName(s2), s2, s2.location(site, types)); }
Example #4
Source File: Messager.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void report(DiagnosticType type, SourcePosition pos, String msg) { switch (type) { case ERROR: case WARNING: Object prefix = (pos == null) ? programName : pos; report(javadocDiags.create(type, null, null, "msg", prefix, msg)); break; case NOTE: String key = (pos == null) ? "msg" : "pos.msg"; report(javadocDiags.create(type, null, null, key, pos, msg)); break; default: throw new IllegalArgumentException(type.toString()); } }
Example #5
Source File: Messager.java From hottub with GNU General Public License v2.0 | 6 votes |
private void report(DiagnosticType type, SourcePosition pos, String msg) { switch (type) { case ERROR: case WARNING: Object prefix = (pos == null) ? programName : pos; report(javadocDiags.create(type, null, null, "msg", prefix, msg)); break; case NOTE: String key = (pos == null) ? "msg" : "pos.msg"; report(javadocDiags.create(type, null, null, key, pos, msg)); break; default: throw new IllegalArgumentException(type.toString()); } }
Example #6
Source File: Messager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void report(DiagnosticType type, SourcePosition pos, String msg) { switch (type) { case ERROR: case WARNING: Object prefix = (pos == null) ? programName : pos; report(javadocDiags.create(type, null, null, "msg", prefix, msg)); break; case NOTE: String key = (pos == null) ? "msg" : "pos.msg"; report(javadocDiags.create(type, null, null, key, pos, msg)); break; default: throw new IllegalArgumentException(type.toString()); } }
Example #7
Source File: Messager.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void report(DiagnosticType type, String pos, String msg) { switch (type) { case ERROR: case WARNING: Object prefix = (pos == null) ? programName : pos; report(javadocDiags.create(type, null, null, "msg", prefix, msg)); break; case NOTE: String key = (pos == null) ? "msg" : "pos.msg"; report(javadocDiags.create(type, null, null, key, pos, msg)); break; default: throw new IllegalArgumentException(type.toString()); } }
Example #8
Source File: Log.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return noticeWriter; case WARNING: return warnWriter; case ERROR: return errWriter; default: throw new Error(); } }
Example #9
Source File: Log.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return noticeWriter; case WARNING: return warnWriter; case ERROR: return errWriter; default: throw new Error(); } }
Example #10
Source File: Log.java From hottub with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return noticeWriter; case WARNING: return warnWriter; case ERROR: return errWriter; default: throw new Error(); } }
Example #11
Source File: Log.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return writers.get(WriterKind.NOTICE); case WARNING: return writers.get(WriterKind.WARNING); case ERROR: return writers.get(WriterKind.ERROR); default: throw new Error(); } }
Example #12
Source File: Log.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Deprecated protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) { switch (dt) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: return noticeWriter; case WARNING: return warnWriter; case ERROR: return errWriter; default: throw new Error(); } }
Example #13
Source File: Resolve.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { List<Symbol> diagSyms = ambiguousSyms.reverse(); Symbol s1 = diagSyms.head; Symbol s2 = diagSyms.tail.head; Name sname = s1.name; if (sname == names.init) sname = s1.owner.name; return diags.create(dkind, log.currentSource(), pos, "ref.ambiguous", sname, kindName(s1), s1, s1.location(site, types), kindName(s2), s2, s2.location(site, types)); }
Example #14
Source File: Analyzer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public AnalyzeDeferredDiagHandler(AnalysisContext context) { super(log, d -> { if (d.getType() == DiagnosticType.ERROR) { context.errors.add(d); } return true; }); this.context = context; }
Example #15
Source File: Resolve.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { Symbol errSym = ((sym.kind == TYP && sym.type.hasTag(CLASS)) ? types.erasure(sym.type).tsym : sym); return diags.create(dkind, log.currentSource(), pos, "non-static.cant.be.ref", kindName(sym), errSym); }
Example #16
Source File: Analyzer.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Simple deferred diagnostic handler which filters out all messages and keep track of errors. */ Log.DeferredDiagnosticHandler diagHandler() { return new Log.DeferredDiagnosticHandler(log, d -> { if (d.getType() == DiagnosticType.ERROR) { erroneous = true; } return true; }); }
Example #17
Source File: Messager.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void printNotice(Element e, String msg) { String pos = getDiagSource(e); if (diagListener != null) { report(DiagnosticType.NOTE, pos, msg); return; } PrintWriter noticeWriter = getWriter(WriterKind.NOTICE); if (e == null) { printRawLines(noticeWriter, msg); } else { printRawLines(noticeWriter, pos + ": " + msg); } noticeWriter.flush(); }
Example #18
Source File: Resolve.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { final String key; if (!unboundLookup) { key = "bad.static.method.in.bound.lookup"; } else if (sym.isStatic()) { key = "bad.static.method.in.unbound.lookup"; } else { key = "bad.instance.method.in.unbound.lookup"; } return sym.kind.isResolutionError() ? ((ResolveError)sym).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes) : diags.create(dkind, log.currentSource(), pos, key, Kinds.kindName(sym), sym); }
Example #19
Source File: Messager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Print a message. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printNotice(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.NOTE, pos, msg); return; } if (pos == null) noticeWriter.println(msg); else noticeWriter.println(pos + ": " + msg); noticeWriter.flush(); }
Example #20
Source File: Resolve.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (sym.owner.type.hasTag(ERROR)) return null; if (sym.name == names.init && sym.owner != site.tsym) { return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes); } else if ((sym.flags() & PUBLIC) != 0 || (env != null && this.site != null && !isAccessible(env, this.site))) { return diags.create(dkind, log.currentSource(), pos, "not.def.access.class.intf.cant.access", sym, sym.location()); } else if ((sym.flags() & (PRIVATE | PROTECTED)) != 0) { return diags.create(dkind, log.currentSource(), pos, "report.access", sym, asFlagSet(sym.flags() & (PRIVATE | PROTECTED)), sym.location()); } else { return diags.create(dkind, log.currentSource(), pos, "not.def.public.cant.access", sym, sym.location()); } }
Example #21
Source File: Messager.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Print warning message, increment warning count. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printWarning(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.WARNING, pos, msg); return; } if (nwarnings < MaxWarnings) { String prefix = (pos == null) ? programName : pos.toString(); warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg); warnWriter.flush(); nwarnings++; } }
Example #22
Source File: Resolve.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected void reportMC(DiagnosticPosition pos, MethodCheckDiag diag, InferenceContext inferenceContext, Object... args) { boolean inferDiag = inferenceContext != infer.emptyContext; InapplicableMethodException ex = inferDiag ? infer.inferenceException : inapplicableMethodException; if (inferDiag && (!diag.inferKey.equals(diag.basicKey))) { Object[] args2 = new Object[args.length + 1]; System.arraycopy(args, 0, args2, 1, args.length); args2[0] = inferenceContext.inferenceVars(); args = args2; } String key = inferDiag ? diag.inferKey : diag.basicKey; throw ex.setMessage(diags.create(DiagnosticType.FRAGMENT, log.currentSource(), pos, key, args)); }
Example #23
Source File: Resolve.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (sym.owner.type.hasTag(ERROR)) return null; if (sym.name == names.init && sym.owner != site.tsym) { return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes); } else if ((sym.flags() & PUBLIC) != 0 || (env != null && this.site != null && !isAccessible(env, this.site))) { return diags.create(dkind, log.currentSource(), pos, "not.def.access.class.intf.cant.access", sym, sym.location()); } else if ((sym.flags() & (PRIVATE | PROTECTED)) != 0) { return diags.create(dkind, log.currentSource(), pos, "report.access", sym, asFlagSet(sym.flags() & (PRIVATE | PROTECTED)), sym.location()); } else { return diags.create(dkind, log.currentSource(), pos, "not.def.public.cant.access", sym, sym.location()); } }
Example #24
Source File: Messager.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Print error message, increment error count. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printError(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.ERROR, pos, msg); return; } if (nerrors < MaxErrors) { String prefix = (pos == null) ? programName : pos.toString(); errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg); errWriter.flush(); prompt(); nerrors++; } }
Example #25
Source File: Messager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Print warning message, increment warning count. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printWarning(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.WARNING, pos, msg); return; } if (nwarnings < MaxWarnings) { String prefix = (pos == null) ? programName : pos.toString(); warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg); warnWriter.flush(); nwarnings++; } }
Example #26
Source File: Messager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Print error message, increment error count. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printError(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.ERROR, pos, msg); return; } if (nerrors < MaxErrors) { String prefix = (pos == null) ? programName : pos.toString(); errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg); errWriter.flush(); prompt(); nerrors++; } }
Example #27
Source File: Messager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Print error message, increment error count. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printError(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.ERROR, pos, msg); return; } if (nerrors < MaxErrors) { String prefix = (pos == null) ? programName : pos.toString(); errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg); errWriter.flush(); prompt(); nerrors++; } }
Example #28
Source File: Resolve.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { Symbol errSym = ((sym.kind == TYP && sym.type.hasTag(CLASS)) ? types.erasure(sym.type).tsym : sym); return diags.create(dkind, log.currentSource(), pos, "non-static.cant.be.ref", kindName(sym), errSym); }
Example #29
Source File: Resolve.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (sym.owner.type.tag == ERROR) return null; if (sym.name == names.init && sym.owner != site.tsym) { return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes); } else if ((sym.flags() & PUBLIC) != 0 || (env != null && this.site != null && !isAccessible(env, this.site))) { return diags.create(dkind, log.currentSource(), pos, "not.def.access.class.intf.cant.access", sym, sym.location()); } else if ((sym.flags() & (PRIVATE | PROTECTED)) != 0) { return diags.create(dkind, log.currentSource(), pos, "report.access", sym, asFlagSet(sym.flags() & (PRIVATE | PROTECTED)), sym.location()); } else { return diags.create(dkind, log.currentSource(), pos, "not.def.public.cant.access", sym, sym.location()); } }
Example #30
Source File: Messager.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Print warning message, increment warning count. * Part of DocErrorReporter. * * @param pos the position where the error occurs * @param msg message to print */ public void printWarning(SourcePosition pos, String msg) { if (diagListener != null) { report(DiagnosticType.WARNING, pos, msg); return; } if (nwarnings < MaxWarnings) { String prefix = (pos == null) ? programName : pos.toString(); warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg); warnWriter.flush(); nwarnings++; } }