Class SourcePathMatcher
java.lang.Object
com.google.errorprone.util.SourcePathMatcher
Matcher for canonical source file paths supporting exact source file paths and directory prefixes.
Matches are evaluated against canonical repository/workspace-relative paths as returned by
ASTHelpers.getSourcePath(CompilationUnitTree).
Supported Pattern Syntax
- Exact file paths: Matches the exact relative path for a
.javasource file (e.g.,java/com/google/foo/Bar.java). - Directory prefixes: Trailing
/matches any file in the directory hierarchy (e.g.,java/com/google/foo/).
Patterns must be repository-relative and must not start with a leading /. Wildcards (*, ?)
are not supported.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SourcePathMatcherCreates aSourcePathMatcherfrom the given path patterns (exact file paths or directory prefixes ending with/).static SourcePathMatcherCreates aSourcePathMatcherfrom the given path patterns (exact file paths or directory prefixes ending with/).static SourcePathMatcherempty()Returns an emptySourcePathMatcher.booleanmatches(VisitorState state) Returnstrueif the compilation unit instatematches any of the patterns in this matcher.booleanReturnstrueif the given canonical path matches any of the patterns in this matcher.
-
Method Details
-
empty
Returns an emptySourcePathMatcher. -
create
Creates aSourcePathMatcherfrom the given path patterns (exact file paths or directory prefixes ending with/). -
create
Creates aSourcePathMatcherfrom the given path patterns (exact file paths or directory prefixes ending with/). -
matches
Returnstrueif the given canonical path matches any of the patterns in this matcher. -
matches
Returnstrueif the compilation unit instatematches any of the patterns in this matcher.
-