com.sun.tools.javac.api.Formattable Java Examples
The following examples show how to use
com.sun.tools.javac.api.Formattable.
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: AbstractDiagnosticFormatter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #2
Source File: AbstractDiagnosticFormatter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #3
Source File: RawDiagnosticFormatter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #4
Source File: AbstractDiagnosticFormatter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #5
Source File: RawDiagnosticFormatter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #6
Source File: AbstractDiagnosticFormatter.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #7
Source File: RawDiagnosticFormatter.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #8
Source File: RawDiagnosticFormatter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof PathFileObject) { s = ((PathFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #9
Source File: AbstractDiagnosticFormatter.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #10
Source File: RawDiagnosticFormatter.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) s = arg.toString(); else if (arg instanceof BaseFileObject) s = ((BaseFileObject) arg).getShortName(); else s = super.formatArgument(diag, arg, null); if (arg instanceof JCDiagnostic) return "(" + s + ")"; else return s; }
Example #11
Source File: RawDiagnosticFormatter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #12
Source File: RawDiagnosticFormatter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #13
Source File: RawDiagnosticFormatter.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { Assert.checkNonNull(rawDiagnosticPosHelper); s = "@" + rawDiagnosticPosHelper.getPosition((JCExpression)arg); } else if (arg instanceof PathFileObject) { s = ((PathFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #14
Source File: AbstractDiagnosticFormatter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #15
Source File: RawDiagnosticFormatter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #16
Source File: AbstractDiagnosticFormatter.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #17
Source File: RawDiagnosticFormatter.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) s = arg.toString(); else if (arg instanceof BaseFileObject) s = ((BaseFileObject) arg).getShortName(); else s = super.formatArgument(diag, arg, null); if (arg instanceof JCDiagnostic) return "(" + s + ")"; else return s; }
Example #18
Source File: AbstractDiagnosticFormatter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #19
Source File: RawDiagnosticFormatter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) { String s; if (arg instanceof Formattable) { s = arg.toString(); } else if (arg instanceof JCExpression) { JCExpression tree = (JCExpression)arg; s = "@" + tree.getStartPosition(); } else if (arg instanceof BaseFileObject) { s = ((BaseFileObject) arg).getShortName(); } else { s = super.formatArgument(diag, arg, null); } return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s; }
Example #20
Source File: AbstractDiagnosticFormatter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #21
Source File: AbstractDiagnosticFormatter.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?>) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Option) { return ((Option)arg).primaryName; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }
Example #22
Source File: AbstractDiagnosticFormatter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Format a single argument of a given diagnostic. * * @param d diagnostic whose argument is to be formatted * @param arg argument to be formatted * @param l locale object to be used for i18n * @return string representation of the diagnostic argument */ protected String formatArgument(JCDiagnostic d, Object arg, Locale l) { if (arg instanceof JCDiagnostic) { String s = null; depth++; try { s = formatMessage((JCDiagnostic)arg, l); } finally { depth--; } return s; } else if (arg instanceof JCExpression) { return expr2String((JCExpression)arg); } else if (arg instanceof Iterable<?> && !(arg instanceof Path)) { return formatIterable(d, (Iterable<?>)arg, l); } else if (arg instanceof Type) { return printer.visit((Type)arg, l); } else if (arg instanceof Symbol) { return printer.visit((Symbol)arg, l); } else if (arg instanceof JavaFileObject) { return ((JavaFileObject)arg).getName(); } else if (arg instanceof Profile) { return ((Profile)arg).name; } else if (arg instanceof Option) { return ((Option)arg).primaryName; } else if (arg instanceof Formattable) { return ((Formattable)arg).toString(l, messages); } else { return String.valueOf(arg); } }