Uses of Interface
net.sourceforge.pmd.lang.ast.Node
-
Packages that use Node Package Description net.sourceforge.pmd This is the PMD programming mistake detector.net.sourceforge.pmd.lang net.sourceforge.pmd.lang.ast net.sourceforge.pmd.lang.ast.impl net.sourceforge.pmd.lang.ast.impl.antlr4 net.sourceforge.pmd.lang.ast.impl.javacc Support classes for language implementations based on JavaCC.net.sourceforge.pmd.lang.metrics Language-independent framework to represent code metrics.net.sourceforge.pmd.lang.rule net.sourceforge.pmd.lang.rule.xpath net.sourceforge.pmd.lang.rule.xpath.impl net.sourceforge.pmd.lang.symboltable net.sourceforge.pmd.reporting Logic about reporting: violations, suppression etc.net.sourceforge.pmd.util.designerbindings net.sourceforge.pmd.util.treeexport -
-
Uses of Node in net.sourceforge.pmd
Methods in net.sourceforge.pmd with parameters of type Node Modifier and Type Method Description void
RuleContext. addViolation(Node location)
Record a new violation of the contextual rule, at the given node.void
RuleContext. addViolation(Node location, Object... formatArgs)
Record a new violation of the contextual rule, at the given node.void
RuleContext. addViolationWithMessage(Node location, String message)
Record a new violation of the contextual rule, at the given node.void
RuleContext. addViolationWithMessage(Node location, String message, Object... formatArgs)
Record a new violation of the contextual rule, at the given node.void
RuleContext. addViolationWithPosition(Node node, int beginLine, int endLine, String message, Object... formatArgs)
Record a new violation of the contextual rule, at the given node.void
Rule. apply(Node target, RuleContext ctx)
Process the given node.static @Nullable Report.SuppressedViolation
ViolationSuppressor. suppressOrNull(List<ViolationSuppressor> suppressorList, RuleViolation rv, Node node)
Apply a list of suppressors on the violation.@Nullable Report.SuppressedViolation
ViolationSuppressor. suppressOrNull(RuleViolation rv, @NonNull Node node)
Returns aReport.SuppressedViolation
if the given violation is suppressed by this object. -
Uses of Node in net.sourceforge.pmd.lang
Classes in net.sourceforge.pmd.lang that implement Node Modifier and Type Class Description static class
PlainTextLanguage.PlainTextFile
The only node produced by the parser ofPlainTextLanguage
. -
Uses of Node in net.sourceforge.pmd.lang.ast
Classes in net.sourceforge.pmd.lang.ast with type parameters of type Node Modifier and Type Interface Description interface
NodeStream<T extends Node>
A sequence of AST nodes.static interface
NodeStream.DescendantNodeStream<T extends Node>
A specialization ofNodeStream
that allows configuring tree traversal behaviour when traversing the descendants of a node.Subinterfaces of Node in net.sourceforge.pmd.lang.ast Modifier and Type Interface Description interface
RootNode
This interface identifies the root node of an AST.interface
TextAvailableNode
Refinement ofNode
for nodes that can provide the underlying source text.Fields in net.sourceforge.pmd.lang.ast with type parameters of type Node Modifier and Type Field Description static Comparator<Node>
Node. COORDS_COMPARATOR
Compares nodes according to their location in the file.Methods in net.sourceforge.pmd.lang.ast with type parameters of type Node Modifier and Type Method Description default <R extends Node>
NodeStream<R>Node. ancestors(Class<? extends R> rClass)
Returns the ancestor stream of this node filtered by the given node type.default <R extends Node>
NodeStream<R>NodeStream. ancestors(Class<? extends R> rClass)
Returns the ancestor stream of each node in this stream, filtered by the given node type.default <R extends Node>
NodeStream<R>Node. children(Class<? extends R> rClass)
Returns a node stream of the children of this node that are of the given type.default <R extends Node>
NodeStream<R>NodeStream. children(Class<? extends R> rClass)
Returns the children stream of each node in this stream, filtered by the given node type.default <R extends Node>
NodeStream.DescendantNodeStream<R>Node. descendants(Class<? extends R> rClass)
Returns a node stream of the descendants of this node that are of the given type.<R extends Node>
NodeStream.DescendantNodeStream<R>NodeStream. descendants(Class<? extends R> rClass)
Returns the descendant stream of each node in this stream, filtered by the given node type.static <T extends Node>
NodeStream<T>NodeStream. empty()
Returns an empty node stream.default <R extends Node>
NodeStream<R>NodeStream. filterIs(Class<? extends R> rClass)
Filters the nodes of this stream that are a subtype of the given class.default <T extends Node>
List<T>Node. findChildrenOfType(Class<? extends T> childType)
Deprecated.Use node stream methods:node.children(childType).toList()
.default <T extends Node>
List<T>Node. findDescendantsOfType(Class<? extends T> targetType)
Deprecated.Use node stream methods:node.descendants(targetType).toList()
.default <T extends Node>
List<T>Node. findDescendantsOfType(Class<? extends T> targetType, boolean crossFindBoundaries)
Deprecated.Use node stream methods:node.descendants(targetType).crossFindBoundaries(b).toList()
.default <R extends Node>
@Nullable RNodeStream. first(Class<? extends R> rClass)
Returns the first element of this stream of the given type, ornull
if there is none.default <R extends Node>
@Nullable RNode. firstChild(Class<? extends R> rClass)
Returns the first child of this node that has the given type.default <R extends Node>
NodeStream<R>NodeStream. firstChild(Class<? extends R> rClass)
Returns a stream containing the first child of each of the nodes in this stream that has the given type.default <R extends Node>
@Nullable RNodeStream. firstNonNull(Function<? super @NonNull T,? extends @Nullable R> nullableFun)
Returns the first element of this stream for which the mapping function returns a non-null result.<R extends Node>
NodeStream<R>NodeStream. flatMap(Function<? super @NonNull T,? extends @Nullable NodeStream<? extends R>> mapper)
Returns a node stream consisting of the results of replacing each node of this stream with the contents of a stream produced by the given mapping function.static <T extends Node,R extends Node>
NodeStream<R>NodeStream. forkJoin(NodeStream<? extends T> upstream, Function<? super @NonNull T,? extends NodeStream<? extends R>> fst, Function<? super @NonNull T,? extends NodeStream<? extends R>> snd, Function<? super @NonNull T,? extends NodeStream<? extends R>>... rest)
Applies the given mapping functions to the given upstream in order and merges the results into a new node stream.static <T extends Node,R extends Node>
NodeStream<R>NodeStream. forkJoin(NodeStream<? extends T> upstream, Function<? super @NonNull T,? extends NodeStream<? extends R>> fst, Function<? super @NonNull T,? extends NodeStream<? extends R>> snd, Function<? super @NonNull T,? extends NodeStream<? extends R>>... rest)
Applies the given mapping functions to the given upstream in order and merges the results into a new node stream.static <T extends Node>
NodeStream<T>NodeStream. fromIterable(Iterable<? extends @Nullable T> iterable)
Returns a new node stream that contains the same elements as the given iterable.default <T extends Node>
TNode. getFirstChildOfType(Class<? extends T> childType)
Deprecated.default <T extends Node>
TNode. getFirstDescendantOfType(Class<? extends T> descendantType)
Deprecated.Use node stream methods:node.descendants(targetType).first()
.default <T extends Node>
TNode. getFirstParentOfType(Class<? extends T> parentType)
Deprecated.Use node stream methods:node.ancestors(parentType).first()
default <T extends Node>
List<T>Node. getParentsOfType(Class<? extends T> parentType)
Deprecated.Use node stream methods:node.ancestors(parentType).toList()
.default <T extends Node>
booleanNode. hasDescendantOfType(Class<? extends T> type)
Deprecated.Use node stream methods:node.descendants(targetType).nonEmpty()
.default <R extends Node>
@Nullable RNodeStream. last(Class<? extends R> rClass)
Returns the last element of this stream of the given type, ornull
if there is none.<R extends Node>
NodeStream<R>NodeStream. map(Function<? super @NonNull T,? extends @Nullable R> mapper)
Returns a node stream consisting of the results of applying the given mapping function to the node of this stream.static <T extends Node>
NodeStream<T>NodeStream. of(@Nullable T node)
Returns a node stream containing zero or one node, depending on whether the argument is null or not.static <T extends Node>
NodeStream<T>NodeStream. of(T... nodes)
Returns a node stream whose elements are the given nodes in order.static <T extends Node>
NodeStream<T>NodeStream. ofOptional(Optional<? extends T> optNode)
Returns a node stream containing zero or one node, depending on whether the optional is empty or not.static <T extends Node>
NodeStream<T>NodeStream. union(Iterable<? extends NodeStream<? extends T>> streams)
Returns a node stream containing all the elements of the given streams, one after the other.static <T extends Node>
NodeStream<T>NodeStream. union(NodeStream<? extends T>... streams)
Returns a node stream containing all the elements of the given streams, one after the other.Methods in net.sourceforge.pmd.lang.ast that return Node Modifier and Type Method Description Node
Node. getChild(int index)
Returns the child of this node at the given index.default @Nullable Node
Node. getFirstChild()
Returns the first child of this node, or null if it doesn't exist.default @Nullable Node
Node. getLastChild()
Returns the first last of this node, or null if it doesn't exist.default @Nullable Node
Node. getNextSibling()
Returns the next sibling of this node, or null if it does not exist.default Node
Node. getNthParent(int n)
Deprecated.Use node stream methods:node.ancestors().get(n-1)
Node
Node. getParent()
Returns the parent of this node, or null if this is the root of the tree.default @Nullable Node
Node. getPreviousSibling()
Returns the previous sibling of this node, or null if it does not exist.Methods in net.sourceforge.pmd.lang.ast that return types with arguments of type Node Modifier and Type Method Description default NodeStream<? extends Node>
Node. ancestors()
Returns a node stream containing all the strict ancestors of this node, in innermost to outermost order.default NodeStream<Node>
NodeStream. ancestors()
Returns a node stream containing all the ancestors of the nodes contained in this stream.default NodeStream<? extends Node>
Node. ancestorsOrSelf()
Returns a node stream containing this node and its ancestors.default NodeStream<Node>
NodeStream. ancestorsOrSelf()
Returns a node stream containing the nodes contained in this stream and their ancestors.default NodeStream<? extends Node>
Node. asStream()
Returns a node stream containing only this node.default NodeStream<? extends Node>
Node. children()
Returns a node stream containing all the children of this node.default NodeStream<Node>
NodeStream. children()
Returns a node stream containing all the children of the nodes contained in this stream.default NodeStream.DescendantNodeStream<? extends Node>
Node. descendants()
Returns a node stream containing all the descendants of this node.NodeStream.DescendantNodeStream<Node>
NodeStream. descendants()
Returns a node stream containing all the strict descendants of the nodes contained in this stream.default NodeStream.DescendantNodeStream<? extends Node>
Node. descendantsOrSelf()
Returns a node stream containing this node, then all its descendants.NodeStream.DescendantNodeStream<Node>
NodeStream. descendantsOrSelf()
Returns a node stream containing the nodes contained in this stream and their descendants.default List<Node>
Node. findChildNodesWithXPath(String xpathString)
Deprecated.This is very inefficient and should not be used in new code.default NodeStream<Node>
NodeStream. followingSiblings()
Returns a node stream containing all the following siblings of the nodes contained in this stream.default NodeStream<Node>
NodeStream. parents()
Returns a node stream containing all the (first-degree) parents of the nodes contained in this stream.default NodeStream<Node>
NodeStream. precedingSiblings()
Returns a node stream containing all the preceding siblings of the nodes contained in this stream.Methods in net.sourceforge.pmd.lang.ast with parameters of type Node Modifier and Type Method Description default R
AstVisitor. cannotVisit(Node node, P param)
Called by a node when it detects that the visitor is not of the language it is used to visiting.default int
Node. compareLocation(Node other)
Compare the coordinates of this node with the other one as if withCOORDS_COMPARATOR
.SemanticException
SemanticErrorReporter. error(Node location, String message, Object... formatArgs)
Report an error at the given location.static <T extends Node>
NodeStream<T>NodeStream. of(T... nodes)
Returns a node stream whose elements are the given nodes in order.protected R
AstVisitorBase. visitChildren(Node node, P data)
Visit the children.R
AstVisitor. visitNode(Node node, P param)
Visit a node.R
AstVisitorBase. visitNode(Node node, P param)
void
SemanticErrorReporter. warning(Node location, String message, Object... formatArgs)
Report a warning at the given location. -
Uses of Node in net.sourceforge.pmd.lang.ast.impl
Classes in net.sourceforge.pmd.lang.ast.impl with type parameters of type Node Modifier and Type Class Description class
AbstractNode<B extends AbstractNode<B,N>,N extends Node & GenericNode<N>>
Base class for implementations of the Node interface whose children are stored in an array.Subinterfaces of Node in net.sourceforge.pmd.lang.ast.impl Modifier and Type Interface Description interface
GenericNode<N extends GenericNode<N>>
Interface that binds the return type of some node methods to a type parameter.Classes in net.sourceforge.pmd.lang.ast.impl that implement Node Modifier and Type Class Description class
AbstractNode<B extends AbstractNode<B,N>,N extends Node & GenericNode<N>>
Base class for implementations of the Node interface whose children are stored in an array.Methods in net.sourceforge.pmd.lang.ast.impl with type parameters of type Node Modifier and Type Method Description <R extends Node>
@Nullable RAbstractNode. firstChild(Class<? extends R> rClass)
-
Uses of Node in net.sourceforge.pmd.lang.ast.impl.antlr4
Subinterfaces of Node in net.sourceforge.pmd.lang.ast.impl.antlr4 Modifier and Type Interface Description interface
AntlrNode<N extends AntlrNode<N>>
Base interface for all Antlr-based implementation of the Node interface.Classes in net.sourceforge.pmd.lang.ast.impl.antlr4 that implement Node Modifier and Type Class Description class
BaseAntlrErrorNode<N extends AntlrNode<N>>
class
BaseAntlrInnerNode<N extends AntlrNode<N>>
Base class for the inner nodes (corresponds toParserRuleContext
).class
BaseAntlrNode<A extends BaseAntlrNode.AntlrToPmdParseTreeAdapter<N>,N extends AntlrNode<N>>
Base class for an antlr node.class
BaseAntlrTerminalNode<N extends AntlrNode<N>>
Base class for terminal nodes (they wrap aTerminalNode
).Methods in net.sourceforge.pmd.lang.ast.impl.antlr4 that return Node Modifier and Type Method Description protected Node
AntlrGeneratedParserBase. asPmdNode(org.antlr.v4.runtime.RuleContext ctx)
-
Uses of Node in net.sourceforge.pmd.lang.ast.impl.javacc
Subinterfaces of Node in net.sourceforge.pmd.lang.ast.impl.javacc Modifier and Type Interface Description interface
JjtreeNode<N extends JjtreeNode<N>>
Base interface for nodes that are produced by a JJTree parser.Classes in net.sourceforge.pmd.lang.ast.impl.javacc that implement Node Modifier and Type Class Description class
AbstractJjtreeNode<B extends AbstractJjtreeNode<B,N>,N extends JjtreeNode<N>>
Base class for node produced by JJTree.Methods in net.sourceforge.pmd.lang.ast.impl.javacc with parameters of type Node Modifier and Type Method Description int
AbstractJjtreeNode. compareLocation(Node other)
-
Uses of Node in net.sourceforge.pmd.lang.metrics
Classes in net.sourceforge.pmd.lang.metrics with type parameters of type Node Modifier and Type Interface Description interface
Metric<N extends Node,R extends Number>
A named computation that can be carried out on some nodes.Methods in net.sourceforge.pmd.lang.metrics with type parameters of type Node Modifier and Type Method Description static <N extends Node,R extends Number>
@Nullable RMetric. compute(Metric<N,R> metric, Node node, MetricOptions options)
Compute a metric on an arbitrary node, if possible.static <N extends Node,R extends Number>
RMetricsUtil. computeMetric(Metric<? super N,R> key, N node)
Computes a metric identified by its code on a node, with the default options.static <N extends Node,R extends Number>
RMetricsUtil. computeMetric(Metric<? super N,R> key, N node, MetricOptions options)
Computes a metric identified by its code on a node, possibly selecting a variant with theoptions
parameter.static <N extends Node,R extends Number>
RMetricsUtil. computeMetric(Metric<? super N,R> key, N node, MetricOptions options, boolean forceRecompute)
Computes a metric identified by its code on a node, possibly selecting a variant with theoptions
parameter.static <O extends Node>
DoubleSummaryStatisticsMetricsUtil. computeStatistics(Metric<? super O,?> key, Iterable<? extends O> ops)
Computes statistics for the results of a metric over a sequence of nodes.static <O extends Node>
DoubleSummaryStatisticsMetricsUtil. computeStatistics(Metric<? super O,?> key, Iterable<? extends O> ops, MetricOptions options)
Computes statistics for the results of a metric over a sequence of nodes.static <T extends Node,R extends Number>
Metric<T,R>Metric. of(BiFunction<? super T,MetricOptions,? extends R> compute, Function<Node,? extends @Nullable T> cast, @NonNull String fullName, String... aliases)
Factory method for a metric.Methods in net.sourceforge.pmd.lang.metrics with parameters of type Node Modifier and Type Method Description @Nullable N
Metric. castIfSupported(@NonNull Node node)
Casts the node to the more specific type<N>
if this metric can be computed on it.static <N extends Node,R extends Number>
@Nullable RMetric. compute(Metric<N,R> metric, Node node, MetricOptions options)
Compute a metric on an arbitrary node, if possible.default Map<Metric<?,?>,Number>
LanguageMetricsProvider. computeAllMetricsFor(Node node)
Computes all metrics available on the given node.default boolean
Metric. supports(Node node)
Checks if the metric can be computed on the node.static boolean
MetricsUtil. supportsAll(Node node, Metric<?,?>... metrics)
Method parameters in net.sourceforge.pmd.lang.metrics with type arguments of type Node Modifier and Type Method Description static <T extends Node,R extends Number>
Metric<T,R>Metric. of(BiFunction<? super T,MetricOptions,? extends R> compute, Function<Node,? extends @Nullable T> cast, @NonNull String fullName, String... aliases)
Factory method for a metric. -
Uses of Node in net.sourceforge.pmd.lang.rule
Methods in net.sourceforge.pmd.lang.rule with parameters of type Node Modifier and Type Method Description void
AbstractRule. addViolation(Object data, Node node)
Deprecated.Replace withasCtx(data).addViolation(node)
.void
AbstractRule. addViolation(Object data, Node node, Object... args)
Deprecated.Replace withasCtx(data).addViolation(node, arg1, arg2)
.void
AbstractRule. addViolation(Object data, Node node, String arg)
Deprecated.Replace withasCtx(data).addViolation(node, arg)
.void
AbstractRule. addViolationWithMessage(Object data, Node node, String message)
Deprecated.Replace withasCtx(data).addViolationWithMessage(node, message)
.void
AbstractRule. addViolationWithMessage(Object data, Node node, String message, int beginLine, int endLine)
Deprecated.Replace withasCtx(data).addViolationWithPosition(node, beginLine, endLine, message)
.void
AbstractRule. addViolationWithMessage(Object data, Node node, String message, Object[] args)
Deprecated.Replace withasCtx(data).addViolationWithMessage(node, message, args)
.void
AbstractDelegateRule. apply(Node target, RuleContext ctx)
Deprecated.void
AbstractVisitorRule. apply(Node target, RuleContext ctx)
void
XPathRule. apply(Node target, RuleContext ctx)
Method parameters in net.sourceforge.pmd.lang.rule with type arguments of type Node Modifier and Type Method Description protected void
AbstractRule. addRuleChainVisit(Class<? extends Node> nodeClass)
Deprecated.OverrideAbstractRule.buildTargetSelector()
, this is provided for legacy compatibilitystatic RuleTargetSelector
RuleTargetSelector. forTypes(Class<? extends Node> first, Class<? extends Node>... types)
Target nodes that are subtypes of any of the given classes.static RuleTargetSelector
RuleTargetSelector. forTypes(Collection<Class<? extends Node>> types)
Target nodes that are subtypes of any of the given classes. -
Uses of Node in net.sourceforge.pmd.lang.rule.xpath
Methods in net.sourceforge.pmd.lang.rule.xpath that return Node Modifier and Type Method Description Node
Attribute. getParent()
Constructors in net.sourceforge.pmd.lang.rule.xpath with parameters of type Node Constructor Description Attribute(Node parent, String name, MethodHandle handle, Method m)
Creates a new attribute belonging to the given node using its accessor.Attribute(Node parent, String name, String value)
Creates a new attribute belonging to the given node using its string value. -
Uses of Node in net.sourceforge.pmd.lang.rule.xpath.impl
Constructors in net.sourceforge.pmd.lang.rule.xpath.impl with parameters of type Node Constructor Description AttributeAxisIterator(Node contextNode)
Creates a new iterator that enumerates the attributes of the given node. -
Uses of Node in net.sourceforge.pmd.lang.symboltable
Subinterfaces of Node in net.sourceforge.pmd.lang.symboltable Modifier and Type Interface Description interface
ScopedNode
ANode
which knows about the scope within it has been declared. -
Uses of Node in net.sourceforge.pmd.reporting
Methods in net.sourceforge.pmd.reporting with parameters of type Node Modifier and Type Method Description static Map<String,String>
ViolationDecorator. apply(ViolationDecorator decorator, Node violationNode)
void
ViolationDecorator. decorate(Node violationNode, Map<String,String> additionalInfo)
Compute additional key/value pairs about the violation that should be reflected inRuleViolation.getAdditionalInfo()
. -
Uses of Node in net.sourceforge.pmd.util.designerbindings
Methods in net.sourceforge.pmd.util.designerbindings that return types with arguments of type Node Modifier and Type Method Description List<Node>
RelatedNodesSelector. getHighlightedNodesWhenSelecting(Node node)
Returns a list of nodes that should be highlighted when selecting the given node.Methods in net.sourceforge.pmd.util.designerbindings with parameters of type Node Modifier and Type Method Description Collection<DesignerBindings.AdditionalInfo>
DesignerBindings.DefaultDesignerBindings. getAdditionalInfo(Node node)
Collection<DesignerBindings.AdditionalInfo>
DesignerBindings. getAdditionalInfo(Node node)
Returns a collection of "additional information" entries pertaining to the given node.List<Node>
RelatedNodesSelector. getHighlightedNodesWhenSelecting(Node node)
Returns a list of nodes that should be highlighted when selecting the given node.DesignerBindings.TreeIconId
DesignerBindings.DefaultDesignerBindings. getIcon(Node node)
DesignerBindings.TreeIconId
DesignerBindings. getIcon(Node node)
Returns a constant describing an icon that the node should bear in the treeview and other relevant places.Attribute
DesignerBindings.DefaultDesignerBindings. getMainAttribute(Node node)
Attribute
DesignerBindings. getMainAttribute(Node node)
Returns the "main" attribute of the given node.boolean
DesignerBindings.DefaultDesignerBindings. isExpandedByDefaultInTree(Node node)
boolean
DesignerBindings. isExpandedByDefaultInTree(Node node)
Returns true if the children of this node should be displayed in the treeview by default. -
Uses of Node in net.sourceforge.pmd.util.treeexport
Methods in net.sourceforge.pmd.util.treeexport with parameters of type Node Modifier and Type Method Description protected void
TextTreeRenderer. appendBoundaryForNodeLn(Node node, Appendable out, String indentStr)
protected void
TextTreeRenderer. appendNodeInfoLn(Appendable out, Node node)
Append info about the node.void
TextTreeRenderer. renderSubtree(Node node, Appendable out)
void
TreeRenderer. renderSubtree(Node node, Appendable out)
Appends the subtree rooted at the given node on the provided output writer.void
XmlTreeRenderer. renderSubtree(Node node, Appendable out)
Appends the subtree rooted at the given node on the provided output writer.protected boolean
XmlTreeRenderer.XmlRenderingConfig. takeAttribute(Node node, Attribute attribute)
Returns true if the attribute should be included in the element corresponding to the given node.
-