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>
SuppliesScanner
s and provides access to the backing sets of allBugChecker
s and enabledBugChecker
s.
-
-
Constructor Summary
Constructors Constructor Description ScannerSupplier()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 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()
-
-
-
Method Detail
-
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
public static ScannerSupplier fromBugCheckerInfos(Iterable<BugCheckerInfo> checkers)
Returns aScannerSupplier
built from a list ofBugCheckerInfo
s.
-
fromScanner
public static ScannerSupplier fromScanner(Scanner scanner)
Returns aScannerSupplier
that just returns theScanner
that was passed in. Used mostly for testing. Does not implement any method other thanSupplier.get()
.
-
getAllChecks
public abstract com.google.common.collect.ImmutableBiMap<String,BugCheckerInfo> getAllChecks()
Returns a map of check name toBugCheckerInfo
for allBugCheckerInfo
s in thisScannerSupplier
, including disabled ones.
-
getEnabledChecks
public abstract com.google.common.collect.ImmutableSet<BugCheckerInfo> getEnabledChecks()
Returns the set ofBugCheckerInfo
s that are enabled in thisScannerSupplier
.
-
severities
public abstract com.google.common.collect.ImmutableMap<String,BugPattern.SeverityLevel> severities()
-
disabled
protected abstract com.google.common.collect.ImmutableSet<String> disabled()
-
getFlags
public abstract ErrorProneFlags getFlags()
-
applyOverrides
@CheckReturnValue public ScannerSupplier applyOverrides(ErrorProneOptions errorProneOptions)
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
@CheckReturnValue public ScannerSupplier plus(ScannerSupplier other)
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.
-
-