Lint instance.
Because @SuppressWarnings is a Java symbol, in general this mapping can't be
calculated until after attribution. As each top-level declaration (class, package, or module)
is attributed, this singleton is notified and the Lints that apply to every source
position within that top-level declaration are calculated.
The method lintAt returns the Lint instance applicable to source position;
if it can't be determined yet, an empty Optional is returned.
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 |
|---|---|
| private static class | LintMapper.
Holds |
| private static record | LintMapper.
A tree of nested lexical ranges and the |
| private static record | LintMapper.
A lexical range. |
| Modifier and Type | Field and Description |
|---|---|
| private final Context | |
| private static final Context. | |
| private final Map | |
| private Lint |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | calculateLints(JavaFileObject
source file sourceFile, JCTree top-level declaration (class, package, or module) tree)Calculate {@lint Lint} configurations for all positions within the given top-level declaration. |
| public void | |
| public void | finishParsingFile(JCTree.
Invoked when file parsing completes to put in place a corresponding |
| private void | |
| public static LintMapper | |
| public boolean | Returns: true if file is recognizedsource file sourceFile)Determine if the given file is known to this instance. |
| public Optional | Returns: the applicableLint, if known, otherwise emptysource file sourceFile, JCDiagnostic.source position posObtain the |
| public void | startParsingFile(JavaFileObject sourceFile)
Invoked when file parsing starts to create an entry for the new file (but with a null value). |
| context | back to summary |
|---|---|
| private final Context context | |
| CONTEXT_KEY | back to summary |
|---|---|
| private static final Context. | |
| fileInfoMap | back to summary |
|---|---|
| private final Map<JavaFileObject, LintMapper. | |
| rootLint | back to summary |
|---|---|
| private Lint rootLint | |
| LintMapper | back to summary |
|---|---|
| protected LintMapper(Context context) Constructor.
| |
| calculateLints | back to summary |
|---|---|
| public void calculateLints(JavaFileObject sourceFile, JCTree tree) Calculate {@lint Lint} configurations for all positions within the given top-level declaration.
| |
| clear | back to summary |
|---|---|
| public void clear() Reset this instance. | |
| finishParsingFile | back to summary |
|---|---|
| public void finishParsingFile(JCTree. Invoked when file parsing completes to put in place a corresponding | |
| initializeIfNeeded | back to summary |
|---|---|
| private void initializeIfNeeded() | |
| instance | back to summary |
|---|---|
| public static LintMapper instance(Context context) Obtain the | |
| isKnown | back to summary |
|---|---|
| public boolean isKnown(JavaFileObject sourceFile) Determine if the given file is known to this instance.
| |
| lintAt | back to summary |
|---|---|
| public Optional Obtain the
| |
| startParsingFile | back to summary |
|---|---|
| public void startParsingFile(JavaFileObject sourceFile) Invoked when file parsing starts to create an entry for the new file (but with a null value). | |
Lint information for a fully parsed source file.
Initially (immediately after parsing), "unmappedDecls" contains a Span corresponding to each
top-level declaration in the source file. As each top-level declaration is attributed, the corresponding
Span is removed and the corresponding LintRange subtree is populated under "rootRange".
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final LintMapper. | |
| pack-priv final List |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv boolean | |
| pack-priv Optional |
| rootRange | back to summary |
|---|---|
| pack-priv final LintMapper. | |
| unmappedDecls | back to summary |
|---|---|
| pack-priv final List<LintMapper. | |
| FileInfo | back to summary |
|---|---|
| pack-priv FileInfo(Lint rootLint, JCTree. | |
| afterAttr | back to summary |
|---|---|
| pack-priv void afterAttr(JCTree tree) | |
| isTopLevelDecl | back to summary |
|---|---|
| pack-priv boolean isTopLevelDecl(JCTree tree) | |
| lintAt | back to summary |
|---|---|
| pack-priv Optional | |
Lint configurations that apply therein.
| Modifier and Type | Field and Description |
|---|---|
| private final List | children
Record Component accessed by children(). |
| private final Lint | |
| private final LintMapper. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv LintMapper. | |
| public List | |
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public Lint | |
| pack-priv void | |
| public LintMapper. | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| children | back to summary |
|---|---|
| private final List<LintMapper. Record Component accessed by children(). | |
| lint | back to summary |
|---|---|
| private final Lint lint Record Component accessed by lint(). | |
| span | back to summary |
|---|---|
| private final LintMapper. Record Component accessed by span(). | |
| LintRange | back to summary |
|---|---|
| pack-priv LintRange(Lint rootLint) | |
| LintRange | back to summary |
|---|---|
| pack-priv LintRange(JCTree tree, Lint lint) | |
| LintRange | back to summary |
|---|---|
| private LintRange(LintMapper. | |
| bestMatch | back to summary |
|---|---|
| pack-priv LintMapper. | |
| children | back to summary |
|---|---|
| public List Record Component getter of children. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| lint | back to summary |
|---|---|
| public Lint lint() Record Component getter of lint. | |
| populateSubtree | back to summary |
|---|---|
| pack-priv void populateSubtree(JCTree tree) | |
| span | back to summary |
|---|---|
| public LintMapper. Record Component getter of span. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| pack-priv static final LintMapper. | |
| private final int | startPos
Record Component accessed by startPos(). |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv boolean | |
| public int | |
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public int | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| endPos | back to summary |
|---|---|
| private final int endPos Record Component accessed by endPos(). | |
| MAXIMAL | back to summary |
|---|---|
| pack-priv static final LintMapper. | |
| startPos | back to summary |
|---|---|
| private final int startPos Record Component accessed by startPos(). | |
| Span | back to summary |
|---|---|
| pack-priv Span(JCTree tree) | |
| Span | back to summary |
|---|---|
| private Span(int startPos, int endPos) | |
| contains | back to summary |
|---|---|
| pack-priv boolean contains(JCDiagnostic. | |
| contains | back to summary |
|---|---|
| pack-priv boolean contains(LintMapper. | |
| endPos | back to summary |
|---|---|
| public int endPos() Record Component getter of endPos. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| startPos | back to summary |
|---|---|
| public int startPos() Record Component getter of startPos. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |