Package com.google.errorprone.scanner
Class ScannerSupplier
java.lang.Object
com.google.errorprone.scanner.ScannerSupplier
public abstract class ScannerSupplier extends Object implements com.google.common.base.Supplier<Scanner>
Supplies
Scanner
s and provides access to the backing sets of all BugChecker
s and
enabled BugChecker
s.-
Constructor Summary
Constructors Constructor Description ScannerSupplier()
-
Method Summary
Modifier and Type Method Description ScannerSupplier
applyOverrides(ErrorProneOptions errorProneOptions)
Applies options to thisScannerSupplier
.protected abstract com.google.common.collect.ImmutableSet<String>
disabled()
protected Set<String>
enabled()
ScannerSupplier
filter(com.google.common.base.Predicate<? super BugCheckerInfo> predicate)
Filters thisScannerSupplier
based on the provided predicate.static ScannerSupplier
fromBugCheckerClasses(Class<? extends BugChecker>... checkerClasses)
Returns aScannerSupplier
with a specific list ofBugChecker
classes.static ScannerSupplier
fromBugCheckerClasses(Iterable<Class<? extends BugChecker>> checkers)
Returns aScannerSupplier
with a specific list ofBugChecker
classes.static ScannerSupplier
fromBugCheckerInfos(Iterable<BugCheckerInfo> checkers)
Returns aScannerSupplier
built from a list ofBugCheckerInfo
s.static ScannerSupplier
fromScanner(Scanner scanner)
Returns aScannerSupplier
that just returns theScanner
that was passed in.abstract com.google.common.collect.ImmutableBiMap<String,BugCheckerInfo>
getAllChecks()
Returns a map of check name toBugCheckerInfo
for allBugCheckerInfo
s in thisScannerSupplier
, including disabled ones.abstract com.google.common.collect.ImmutableSet<BugCheckerInfo>
getEnabledChecks()
Returns the set ofBugCheckerInfo
s that are enabled in thisScannerSupplier
.abstract ErrorProneFlags
getFlags()
ScannerSupplier
plus(ScannerSupplier other)
abstract com.google.common.collect.ImmutableMap<String,BugPattern.SeverityLevel>
severities()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.common.base.Supplier
get
-
Constructor Details
-
ScannerSupplier
public ScannerSupplier()
-
-
Method Details
-
fromBugCheckerClasses
@SafeVarargs public static ScannerSupplier fromBugCheckerClasses(Class<? extends BugChecker>... checkerClasses)Returns aScannerSupplier
with a specific list ofBugChecker
classes. -
fromBugCheckerClasses
public static ScannerSupplier fromBugCheckerClasses(Iterable<Class<? extends BugChecker>> checkers)Returns aScannerSupplier
with a specific list ofBugChecker
classes. -
fromBugCheckerInfos
Returns aScannerSupplier
built from a list ofBugCheckerInfo
s. -
fromScanner
Returns aScannerSupplier
that just returns theScanner
that was passed in. Used mostly for testing. Does not implement any method other thanSupplier.get()
. -
getAllChecks
Returns a map of check name toBugCheckerInfo
for allBugCheckerInfo
s in thisScannerSupplier
, including disabled ones. -
getEnabledChecks
Returns the set ofBugCheckerInfo
s that are enabled in thisScannerSupplier
. -
severities
public abstract com.google.common.collect.ImmutableMap<String,BugPattern.SeverityLevel> severities() -
disabled
-
enabled
-
getFlags
-
applyOverrides
Applies options to thisScannerSupplier
.Command-line options to override check severities may do any of the following:
- Enable a check that is currently off
- Disable a check that is currently on
- Change the severity of a check that is on, promoting a warning to an error or demoting an error to a warning
- Parameters:
errorProneOptions
- anErrorProneOptions
object that encapsulates the overrides for this compilation- Throws:
InvalidCommandLineOptionException
- if the override map attempts to disable a check that may not be disabled
-
plus
Composes thisScannerSupplier
with theother
ScannerSupplier
. The set of checks that are turned on is the intersection of the checks on inthis
andother
. -
filter
@CheckReturnValue public ScannerSupplier filter(com.google.common.base.Predicate<? super BugCheckerInfo> predicate)Filters thisScannerSupplier
based on the provided predicate. Returns aScannerSupplier
with only the checks enabled that satisfy the predicate.
-