Package io.codemodder
Interface RegionNodeMatcher
public interface RegionNodeMatcher
A type that can match a
Region
to a Range
for determining if we should change the
node at this location.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RegionNodeMatcher
Return true if theNode
andRegion
start and end at the same location.static final RegionNodeMatcher
static final RegionNodeMatcher
Return true if theNode
isRegion
start at the same location.static final RegionNodeMatcher
Return true when the givenRegion
is inside the givenRange
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
matches
(SourceCodeRegion region, com.github.javaparser.Range range) Return true if the givenRegion
matches the givenRange
.
-
Field Details
-
EXACT_MATCH
Return true if theNode
andRegion
start and end at the same location. Some SARIF providers seem report an end column that is +1 more than you think -- the spec probably says the value is exclusive or something. -
MATCHES_START
Return true if theNode
isRegion
start at the same location. -
MATCHES_LINE
-
REGION_INSIDE_RANGE
Return true when the givenRegion
is inside the givenRange
.This may be used when the SARIF provider reports a region that is smaller than expected (e.g. only the method name instead of the whole method expression). In these cases, the codemod developer should take extra care to make sure the method expression matches expectations, because this matcher may match multiple nodes erroneously.
-
-
Method Details
-
matches
Return true if the givenRegion
matches the givenRange
.
-