/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A basic formatter for diagnostic messages.
* The basic formatter will format a diagnostic according to one of three format patterns, depending on whether
* or not the source name and position are set. The formatter supports a printf-like string for patterns
* with the following special characters:
* <ul>
* <li>%b: the base of the source name
* <li>%f: the source name (full absolute path)
* <li>%l: the line number of the diagnostic, derived from the character offset
* <li>%c: the column number of the diagnostic, derived from the character offset
* <li>%o: the character offset of the diagnostic if set
* <li>%p: the prefix for the diagnostic, derived from the diagnostic type
* <li>%t: the prefix as it normally appears in standard diagnostics. In this case, no prefix is
* shown if the type is ERROR and if a source name is set
* <li>%m: the text or the diagnostic, including any appropriate arguments
* <li>%_: space delimiter, useful for formatting purposes
* </ul>
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
/**
* Create a basic formatter based on the supplied options.
*
* @param opts list of command-line options
* @param msgs JavacMessages object used for i18n
*/
}
/**
* Create a standard basic formatter
*
* @param msgs JavacMessages object used for i18n
*/
super(msgs, new BasicConfiguration());
}
if (l == null)
l = messages.getCurrentLocale();
boolean meta = false;
meta = true;
}
}
if (depth == 0)
else
}
int currentIndentation = 0;
}
}
}
}
}
}
if (!displaySource(d))
return msg;
else {
return msg + sourceLine;
else
}
}
switch (c) {
case 'b':
return formatSource(d, false, l);
case 'e':
return formatPosition(d, END, l);
case 'f':
return formatSource(d, true, l);
case 'l':
return formatPosition(d, LINE, l);
case 'c':
return formatPosition(d, COLUMN, l);
case 'o':
return formatPosition(d, OFFSET, l);
case 'p':
return formatKind(d, l);
case 's':
return formatPosition(d, START, l);
case 't': {
boolean usePrefix;
switch (d.getType()) {
case FRAGMENT:
usePrefix = false;
break;
case ERROR:
break;
default:
usePrefix = true;
}
if (usePrefix)
return formatKind(d, l);
else
return "";
}
case 'm':
return formatMessage(d, l);
case 'L':
return formatLintCategory(d, l);
case '_':
return " ";
case '%':
return "%";
default:
}
}
}
}
return format;
}
//the following cast is always safe - see init
return (BasicConfiguration)super.getConfiguration();
}
@SuppressWarnings("fallthrough")
initFormat();
else
}
else
try {
case 5:
case 4:
case 3:
case 2:
default:
}
}
catch (NumberFormatException ex) {
}
}
}
public BasicConfiguration() {
initFormat();
}
private void initFormat() {
}
private void initOldFormat() {
}
}
@SuppressWarnings("fallthrough")
case 3:
case 2:
default:
}
}
private void initIndentation() {
}
/**
* Get the amount of spaces for a given indentation kind
* @param diagPart the diagnostic part for which the indentation is
* to be retrieved
* @return the amount of spaces used for the specified indentation kind
*/
}
/**
* Set the indentation level for various element of a given diagnostic -
* this might lead to more readable diagnostics
*
* @param indentationKind kind of indentation to be set
* @param nSpaces amount of spaces for the specified diagnostic part
*/
}
/**
* Set the source line positioning used by this formatter
*
* @param sourcePos a positioning value for source line
*/
}
/**
* Get the source line positioning used by this formatter
*
* @return the positioning value used by this formatter
*/
return sourcePosition;
}
//where
/**
* A source positioning value controls the position (within a given
* diagnostic message) in which the source line the diagnostic refers to
* should be displayed (if applicable)
*/
public enum SourcePosition {
/**
* Source line is displayed after the diagnostic message
*/
/**
* Source line is displayed after the first line of the diagnostic
* message
*/
}
/**
* Set a metachar string for a specific format
*
* @param kind the format kind to be set
* @param s the metachar string specifying the format
*/
}
/**
* Get a metachar string for a specific format
*
* @param sourcePos a positioning value for source line
*/
}
//where
/**
* This enum contains all the kinds of formatting patterns supported
* by a basic diagnostic formatter.
*/
public enum BasicFormatKind {
/**
* A format string to be used for diagnostics with a given position.
*/
/**
* A format string to be used for diagnostics without a given position.
*/
/**
* A format string to be used for diagnostics regarding classfiles
*/
}
}
}