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.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | JavadocTokenizer.
An extension of BasicComment used to extract the relevant portion of a Javadoc comment. |
| pack-priv static class | JavadocTokenizer.
Build an int table to mapping positions in extracted Javadoc comment to positions in the JavaTokenizer source buffer. |
| pack-priv static class | JavadocTokenizer.
A Comment derived from a JavadocComment with leading whitespace removed from all lines. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ScannerFactory | fac
The factory that created this Scanner.
|
| Access | Constructor and Description |
|---|---|
| protected | JavadocTokenizer(ScannerFactory
the factory which created this Scanner. fac, CharBuffer the input character buffer. cb)Create a tokenizer from the input character buffer. |
| protected | JavadocTokenizer(ScannerFactory
factory which created this Scanner fac, char[] input character array. array, int length of the meaningful content in the array. length)Create a tokenizer from the input array. |
| Modifier and Type | Method and Description |
|---|---|
| public Position. | Returns: a LineMapOverrides com. Build a map for translating between line numbers and positions in the input. |
| protected Tokens. | processComment(int pos, int endPos, Tokens.
Overrides com. Called when a complete comment has been scanned. |
| fac | back to summary |
|---|---|
| pack-priv final ScannerFactory fac Hides com. The factory that created this Scanner. | |
| JavadocTokenizer | back to summary |
|---|---|
| protected JavadocTokenizer(ScannerFactory fac, CharBuffer cb) Create a tokenizer from the input character buffer. The input buffer content would typically be a Javadoc comment extracted by JavaTokenizer.
| |
| JavadocTokenizer | back to summary |
|---|---|
| protected JavadocTokenizer(ScannerFactory fac, char[] array, int length) Create a tokenizer from the input array. The input buffer content would typically be a Javadoc comment extracted by JavaTokenizer.
| |
| getLineMap | back to summary |
|---|---|
| public Position. Overrides com. Build a map for translating between line numbers and positions in the input. Overridden to expand tabs. | |
| processComment | back to summary |
|---|---|
| protected Tokens. Overrides com. Doc from com. Called when a complete comment has been scanned. pos and endPos will mark the comment boundary.
| |
| Modifier and Type | Field and Description |
|---|---|
| private String | docComment
The relevant portion of the comment that is of interest to Javadoc. |
| private boolean | firstLine
Indicates if newline is required. |
| pack-priv JavadocTokenizer. | offsetMap
Map used to map the extracted Javadoc comment's character positions back to the original source. |
| private StringBuilder | sb
StringBuilder used to extract the relevant portion of the Javadoc comment. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | getSourcePos(int pos)
Overrides com. Implements com. Return buffer position in original buffer mapped from buffer position in comment. |
| public String | getText()
Overrides com. Implements com. Return comment body text minus comment adornments or null if not scanned. |
| protected void | putLine(UnicodeReader
line reader line)Overrides com. Add current character or code point from line to the extraction buffer. |
| protected void | scanDocComment()
Overrides com. Scan document comment for content. |
| public Tokens. | stripIndent()
Overrides com. Implements com. Return a version of this comment with incidental whitespace removed, or this comment if the operation is not supported. |
| docComment | back to summary |
|---|---|
| private String docComment The relevant portion of the comment that is of interest to Javadoc. Produced by invoking scanDocComment. | |
| firstLine | back to summary |
|---|---|
| private boolean firstLine Indicates if newline is required. | |
| offsetMap | back to summary |
|---|---|
| pack-priv JavadocTokenizer. Map used to map the extracted Javadoc comment's character positions back to the original source. | |
| sb | back to summary |
|---|---|
| private StringBuilder sb StringBuilder used to extract the relevant portion of the Javadoc comment. | |
| JavadocComment | back to summary |
|---|---|
| pack-priv JavadocComment(Tokens. | |
| getSourcePos | back to summary |
|---|---|
| public int getSourcePos(int pos) Overrides com. Implements com. Doc from com. Return buffer position in original buffer mapped from buffer position in comment.
| |
| getText | back to summary |
|---|---|
| public String getText() Overrides com. Implements com. Doc from com. Return comment body text minus comment adornments or null if not scanned.
| |
| putLine | back to summary |
|---|---|
| protected void putLine(UnicodeReader line) Overrides com. Add current character or code point from line to the extraction buffer.
| |
| scanDocComment | back to summary |
|---|---|
| protected void scanDocComment() Overrides com. Doc from com. Scan document comment for content.
| |
| stripIndent | back to summary |
|---|---|
| public Tokens. Overrides com. Implements com. Doc from com. Return a version of this comment with incidental whitespace removed, or this comment if the operation is not supported.
| |
map[i * NOFFSETS + SB_OFFSET] ) is closest to but not greater
than p. Then, sourcePos(p) = map[i * NOFFSETS + POS_OFFSET] +
(p - map[i * NOFFSETS + SB_OFFSET]) .
| Modifier and Type | Field and Description |
|---|---|
| private int[] | map
Array storing entries in map. |
| private static final int | NOFFSETS
Number of elements in each entry. |
| private static final int | POS_OFFSET
map entry offset of input offset member of pair. |
| private static final int | SB_OFFSET
map entry offset for comment offset member of pair. |
| private int | size
Logical size of map. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | add(int
comment offset member of pair. sbOffset, int input offset member of pair. posOffset)Adds entry pair if worthwhile. |
| private void | |
| pack-priv int | |
| private int | |
| private int | |
| pack-priv boolean | Returns: true if it is worthwhile adding the entry pair.comment offset member of pair. sbOffset, int input offset member of pair. posOffset)Returns true if it is worthwhile adding the entry pair to the map. |
| pack-priv void |
| map | back to summary |
|---|---|
| private int[] map Array storing entries in map. | |
| NOFFSETS | back to summary |
|---|---|
| private static final int NOFFSETS Number of elements in each entry. | |
| POS_OFFSET | back to summary |
|---|---|
| private static final int POS_OFFSET map entry offset of input offset member of pair. | |
| SB_OFFSET | back to summary |
|---|---|
| private static final int SB_OFFSET map entry offset for comment offset member of pair. | |
| size | back to summary |
|---|---|
| private int size Logical size of map.
This is the number of occupied positions in | |
| OffsetMap | back to summary |
|---|---|
| pack-priv OffsetMap() Constructor. | |
| add | back to summary |
|---|---|
| pack-priv void add(int sbOffset, int posOffset) Adds entry pair if worthwhile.
| |
| ensure | back to summary |
|---|---|
| private void ensure(int need) Ensures there is enough space for a new entry.
| |
| getSourcePos | back to summary |
|---|---|
| pack-priv int getSourcePos(int pos) Binary search to find the entry for which the string index is less than pos. Since the map is a list of pairs of integers we must make sure the index is always NOFFSETS scaled. If we find an exact match for pos, the other item in the pair gives the source pos; otherwise, compute the source position relative to the best match found in the array. | |
| lastPosOffset | back to summary |
|---|---|
| private int lastPosOffset() Returns the previous input offset.
| |
| lastSBOffset | back to summary |
|---|---|
| private int lastSBOffset() Returns the previous comment offset.
| |
| shouldAdd | back to summary |
|---|---|
| pack-priv boolean shouldAdd(int sbOffset, int posOffset) Returns true if it is worthwhile adding the entry pair to the map. That is if there is a change in relative offset.
| |
| trim | back to summary |
|---|---|
| pack-priv void trim() Reduce map to minimum size. | |
Note
This class assumes new lines are encoded as '\n', which is the case
for comments created by JavadocTokenizer.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean | |
| pack-priv final JCDiagnostic. | |
| pack-priv final JavadocTokenizer. | |
| pack-priv final JavadocTokenizer. | |
| pack-priv final Tokens. | |
| pack-priv String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static int | |
| public JCDiagnostic. | |
| public int | |
| public Tokens. | |
| public String | |
| public boolean | |
| pack-priv static Tokens. | Returns: stripped or original commentthe original comment commentReturns a stripped version of the comment, or the comment itself if there is no whitespace that can be stripped. |
| private void | stripComment(JavadocTokenizer.
the original comment comment,number of whitespace characters to remove from each non-blank line indent)Strips |
| public Tokens. |
| deprecated | back to summary |
|---|---|
| pack-priv final boolean deprecated | |
| diagPos | back to summary |
|---|---|
| pack-priv final JCDiagnostic. | |
| sourceMap | back to summary |
|---|---|
| pack-priv final JavadocTokenizer. | |
| strippedMap | back to summary |
|---|---|
| pack-priv final JavadocTokenizer. | |
| style | back to summary |
|---|---|
| pack-priv final Tokens. | |
| text | back to summary |
|---|---|
| pack-priv String text | |
| StrippedComment | back to summary |
|---|---|
| private StrippedComment(JavadocTokenizer. | |
| getIndent | back to summary |
|---|---|
| pack-priv static int getIndent(Tokens. Determines the number of leading whitespace characters that can be removed from all non-blank lines of the original comment. | |
| getPos | back to summary |
|---|---|
| public JCDiagnostic. Implements com.
| |
| getSourcePos | back to summary |
|---|---|
| public int getSourcePos(int pos) Implements com.
| |
| getStyle | back to summary |
|---|---|
| public Tokens. Implements com.
| |
| getText | back to summary |
|---|---|
| public String getText() Implements com.
| |
| isDeprecated | back to summary |
|---|---|
| public boolean isDeprecated() Implements com.
| |
| of | back to summary |
|---|---|
| pack-priv static Tokens. Returns a stripped version of the comment, or the comment itself if there is no whitespace that can be stripped.
| |
| stripComment | back to summary |
|---|---|
| private void stripComment(JavadocTokenizer. Strips
| |
| stripIndent | back to summary |
|---|---|
| public Tokens. Implements com.
| |