Path: blob/master/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/internals.md
41161 views
JDeprScan Internals
EXPERIMENTAL OPTIONS
CSV FILE SYNTAX
The -Xprint-csv
option causes jdeprscan to emit the loaded deprecation data in CSV (comma-separated value) format. The general syntax of CSV is documented in RFC 4180 with supplemental information in a Wikipedia article.
The file is encoded in UTF-8.
The file consists of a series of lines. Any of the standard line separators CR (U+000D), LF (U+000A), or a CR immediately followed by LF, are supported. Newlines are only supported between records and are not supported within field values.
Comment lines start with a #
(U+0023) character in the first column. The entire line is ignored up until the next line separator sequence.
Each line is divided into fields separated by the comma ,
(U+002C) character. Horizontal whitespace is not treated specially; that is, it is considered part of a field's value. An empty line is considered to have one field which is the empty string.
A field value that contains a comma or a quote quotation mark "
(U+0022) must be surrounded by quotation marks. The surrounding quotation marks are not considered part of the field value. Any quotation marks that are part of a field value must be repeated in addition to being surrounded by quotation marks.
It is a syntax error if a quotation mark appears within an unquoted field; if a quoted field isn't immediately followed by a comma or line separator; or if a quoted field is left unclosed at the end of the line.
For example, a record with the following four fields:
abcd
ef,gh
ij"kl
mnop
would be encoded as follows:
CSV FILE DATA
The first line of output must be the following:
This is strictly a comment line, but it serves as a file identifier. The "1" indicates version 1 of this file.
Zero or more comment lines follow, containing text that is specified by the -Xcsv-comment
options.
Subsequent non-comment lines must have the following five fields:
Fields are defined as follows:
kind - one of CONSTRUCTOR, FIELD, METHOD, ENUM_CONSTANT, CLASS, INTERFACE, ENUM, or ANNOTATION_TYPE. These correspond to enumeration constants from the
javax.lang.model.element.ElementKind
enum.typeName - the fully qualified name of the type (if kind is CLASS, INTERFACE, ENUM, or ANNOTATION_TYPE) or of the enclosing type (if kind is CONSTRUCTOR, FIELD, METHOD, or ENUM_CONSTANT). This value is a binary name JLS 13.1 using a slash character
/
(U+002F) to separate package and top-level name components, and a dollar sign$
(U+0024) to separate nested name components. For example, theThread.State
enum that appears in Java SE would have the following typeName:descOrName - if kind is METHOD or CONSTRUCTOR, this is the method's or constructor's descriptor JVMS 4.3.3; if kind is FIELD or ENUM_CONSTANT, this is its name; otherwise this field is empty. A method's descriptor includes its name, parameter types, and return type. For example, the method
has the descriptor
since - the value of the
since
element of the@Deprecated
annotation, or empty if this element is not present.forRemoval - the value of the
forRemoval
element of the@Deprecated
annotation, a boolean, either "true" or "false".
Note that the since field can have arbitrary text (excluding line separators) and is thus subject to quoting.
EXAMPLE OUTPUT
Given the following method declaration and annotation from the java.lang.Character
class,
the following line will be emitted from jdeprscan -Xprint-csv: