Package net.sourceforge.pmd.lang.ast
Class AstInfo<T extends RootNode>
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AstInfo<T>
-
- Type Parameters:
T- Type of root nodes
public final class AstInfo<T extends RootNode> extends Object
The output ofParser.parse(ParserTask).
-
-
Constructor Summary
Constructors Constructor Description AstInfo(Parser.ParserTask task, T rootNode)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Collection<ViolationSuppressor.SuppressionCommentWrapper>getAllSuppressionComments()Return all suppression comments in the file.LanguageProcessorgetLanguageProcessor()Returns the language processor that parsed the tree.TgetRootNode()@Nullable ViolationSuppressor.SuppressionCommentWrappergetSuppressionComment(int lineNumber)Return the suppresson comment at the given line, or null if there is none.Map<Integer,String>getSuppressionComments()Deprecated.Since 7.14.0.@NonNull TextDocumentgetTextDocument()Returns the text document that was parsed.DataMap<DataMap.DataKey<?,?>>getUserMap()Returns a data map used to store additional information on this ast info.AstInfo<T>withSuppressionComments(Collection<? extends ViolationSuppressor.SuppressionCommentWrapper> suppressionComments)AstInfo<T>withSuppressMap(Map<Integer,String> map)Deprecated.Since 7.14.0.
-
-
-
Constructor Detail
-
AstInfo
public AstInfo(Parser.ParserTask task, T rootNode)
-
-
Method Detail
-
getRootNode
public T getRootNode()
-
getTextDocument
public @NonNull TextDocument getTextDocument()
Returns the text document that was parsed. This has info like language version, etc.
-
getLanguageProcessor
public LanguageProcessor getLanguageProcessor()
Returns the language processor that parsed the tree.
-
getSuppressionComments
@Deprecated public Map<Integer,String> getSuppressionComments()
Deprecated.Since 7.14.0. UsegetAllSuppressionComments()orgetSuppressionComment(int)Returns the map of line numbers to suppression / review comments. Only single line comments are considered, that start with the configured "suppressMarker", which by default is "PMD". The text after the suppressMarker is used as a "review comment" and included in this map.This map is later used to determine, if a violation is being suppressed. It is suppressed, if the line of the violation is contained in this suppress map.
- Returns:
- map of the suppressed lines with the corresponding review comments.
-
getSuppressionComment
public @Nullable ViolationSuppressor.SuppressionCommentWrapper getSuppressionComment(int lineNumber)
Return the suppresson comment at the given line, or null if there is none.- Since:
- 7.14.0
-
getAllSuppressionComments
public Collection<ViolationSuppressor.SuppressionCommentWrapper> getAllSuppressionComments()
Return all suppression comments in the file. Only single line comments are considered, that start with the configured "suppress marker", which by default isPMDConfiguration.DEFAULT_SUPPRESS_MARKER. The text after the suppress marker is used as a "review comment" and included in this map.- Since:
- 7.14.0
-
getUserMap
public DataMap<DataMap.DataKey<?,?>> getUserMap()
Returns a data map used to store additional information on this ast info.- Returns:
- The user data map of this node
- Since:
- 7.14.0
-
withSuppressMap
@Deprecated public AstInfo<T> withSuppressMap(Map<Integer,String> map)
Deprecated.Since 7.14.0. UsewithSuppressionComments(Collection)
-
withSuppressionComments
public AstInfo<T> withSuppressionComments(Collection<? extends ViolationSuppressor.SuppressionCommentWrapper> suppressionComments)
- Since:
- 7.14.0
-
-