// where private String expr2String(JCExpression tree) { switch (tree.getTag()) { case PARENS: return expr2String(((JCParens) tree).expr); case LAMBDA: case REFERENCE: case CONDEXPR: return Pretty.toSimpleString(tree); default: Assert.error("unexpected tree kind " + tree.getKind()); return null; } }
/** * Static factory method; build a custom diagnostic key using given kind, prefix, code and args. */ public static DiagnosticInfo of( DiagnosticType type, String prefix, String code, Object... args) { switch (type) { case ERROR: return new Error(prefix, code, args); case WARNING: return new Warning(prefix, code, args); case NOTE: return new Note(prefix, code, args); case FRAGMENT: return new Fragment(prefix, code, args); default: Assert.error("Wrong diagnostic type: " + type); return null; } }
public String formatPosition(JCDiagnostic d, PositionKind pk, Locale l) { Assert.check(d.getPosition() != Position.NOPOS); return String.valueOf(getPosition(d, pk)); }