Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -292,71 +292,71 @@ private void parseSeverity(String arg) {
severityMap.put(checkName, severity);
}

public void parseFlag(String flag) {
void parseFlag(String flag) {
flagsBuilder.parseFlag(flag);
}

public void setIgnoreSuppressionAnnotations(boolean ignoreSuppressionAnnotations) {
void setIgnoreSuppressionAnnotations(boolean ignoreSuppressionAnnotations) {
this.ignoreSuppressionAnnotations = ignoreSuppressionAnnotations;
}

public void setIgnoreUnknownChecks(boolean ignoreUnknownChecks) {
void setIgnoreUnknownChecks(boolean ignoreUnknownChecks) {
this.ignoreUnknownChecks = ignoreUnknownChecks;
}

public void setDisableWarningsInGeneratedCode(boolean disableWarningsInGeneratedCode) {
void setDisableWarningsInGeneratedCode(boolean disableWarningsInGeneratedCode) {
this.disableWarningsInGeneratedCode = disableWarningsInGeneratedCode;
}

public void setDropErrorsToWarnings(boolean dropErrorsToWarnings) {
void setDropErrorsToWarnings(boolean dropErrorsToWarnings) {
severityMap.entrySet().stream()
.filter(e -> e.getValue() == Severity.ERROR)
.forEach(e -> e.setValue(Severity.WARN));
this.dropErrorsToWarnings = dropErrorsToWarnings;
}

public void setSuggestionsAsWarnings(boolean suggestionsAsWarnings) {
void setSuggestionsAsWarnings(boolean suggestionsAsWarnings) {
this.suggestionsAsWarnings = suggestionsAsWarnings;
}

public void setDisableAllWarnings(boolean disableAllWarnings) {
void setDisableAllWarnings(boolean disableAllWarnings) {
severityMap.entrySet().stream()
.filter(e -> e.getValue() == Severity.WARN)
.forEach(e -> e.setValue(Severity.OFF));
this.disableAllWarnings = disableAllWarnings;
}

public void setEnableAllChecksAsWarnings(boolean enableAllChecksAsWarnings) {
void setEnableAllChecksAsWarnings(boolean enableAllChecksAsWarnings) {
// Checks manually disabled before this flag are reset to warning-level
severityMap.entrySet().stream()
.filter(e -> e.getValue() == Severity.OFF)
.forEach(e -> e.setValue(Severity.WARN));
this.enableAllChecksAsWarnings = enableAllChecksAsWarnings;
}

public void setIgnoreLargeCodeGenerators(boolean ignoreLargeCodeGenerators) {
void setIgnoreLargeCodeGenerators(boolean ignoreLargeCodeGenerators) {
this.ignoreLargeCodeGenerators = ignoreLargeCodeGenerators;
}

public void setDisableAllChecks(boolean disableAllChecks) {
void setDisableAllChecks(boolean disableAllChecks) {
// Discard previously set severities so that the DisableAllChecks flag is position sensitive.
severityMap.clear();
this.disableAllChecks = disableAllChecks;
}

public void setTestOnlyTarget(boolean isTestOnlyTarget) {
void setTestOnlyTarget(boolean isTestOnlyTarget) {
this.isTestOnlyTarget = isTestOnlyTarget;
}

public void setPubliclyVisibleTarget(boolean isPubliclyVisibleTarget) {
void setPubliclyVisibleTarget(boolean isPubliclyVisibleTarget) {
this.isPubliclyVisibleTarget = isPubliclyVisibleTarget;
}

public PatchingOptions.Builder patchingOptionsBuilder() {
PatchingOptions.Builder patchingOptionsBuilder() {
return patchingOptionsBuilder;
}

public ErrorProneOptions build(ImmutableList<String> remainingArgs) {
ErrorProneOptions build(ImmutableList<String> remainingArgs) {
return new ErrorProneOptions(
ImmutableMap.copyOf(severityMap),
remainingArgs,
Expand All @@ -376,7 +376,7 @@ public ErrorProneOptions build(ImmutableList<String> remainingArgs) {
ignoreLargeCodeGenerators);
}

public void setExcludedPattern(Pattern excludedPattern) {
void setExcludedPattern(Pattern excludedPattern) {
this.excludedPattern = excludedPattern;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private class FirstMatchingScanner extends TreeScanner<Boolean, Boolean> {

private final VisitorState state;

public FirstMatchingScanner(VisitorState state) {
FirstMatchingScanner(VisitorState state) {
this.state = state;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ private Enclosing() {}

private abstract static class EnclosingMatcher<T extends Tree, U extends Tree>
implements Matcher<U> {
protected final Matcher<T> matcher;
protected final java.lang.Class<T> clazz;
final Matcher<T> matcher;
final java.lang.Class<T> clazz;

protected EnclosingMatcher(Matcher<T> matcher, java.lang.Class<T> clazz) {
EnclosingMatcher(Matcher<T> matcher, java.lang.Class<T> clazz) {
this.matcher = matcher;
this.clazz = clazz;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static class HasIdentifierScanner extends TreePathScanner<Boolean, Void>
private Matcher<IdentifierTree> idMatcher;
private VisitorState ancestorState;

public HasIdentifierScanner(VisitorState ancestorState, Matcher<IdentifierTree> idMatcher) {
HasIdentifierScanner(VisitorState ancestorState, Matcher<IdentifierTree> idMatcher) {
this.ancestorState = ancestorState;
this.idMatcher = idMatcher;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ public static boolean isThrowingFunctionalInterface(Type clazzType, VisitorState
.collect(toImmutableSet()));

private static class IsDirectImplementationOf extends ChildMultiMatcher<ClassTree, Tree> {
public IsDirectImplementationOf(Matcher<Tree> classMatcher) {
IsDirectImplementationOf(Matcher<Tree> classMatcher) {
super(MatchType.AT_LEAST_ONE, classMatcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public boolean matches(ExpressionTree expressionTree, VisitorState state) {
private static class MethodArgumentMatcher
extends ChildMultiMatcher<MethodInvocationTree, ExpressionTree> {

public MethodArgumentMatcher(MatchType matchType, Matcher<ExpressionTree> nodeMatcher) {
MethodArgumentMatcher(MatchType matchType, Matcher<ExpressionTree> nodeMatcher) {
super(matchType, nodeMatcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private static class CanCompleteNormallyVisitor extends SimpleTreeVisitor<Boolea
/** Trees that are patched to have a specific completion result. */
private final ImmutableMap<Tree, Boolean> patches;

public CanCompleteNormallyVisitor(ImmutableMap<Tree, Boolean> patches) {
CanCompleteNormallyVisitor(ImmutableMap<Tree, Boolean> patches) {
this.patches = patches;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ private static class FindSuperMethodsTestScanner extends Scanner {
// Last state passed to the `Scanner#scan` method.
private VisitorState state;

public FindSuperMethodsTestScanner() {
FindSuperMethodsTestScanner() {
this.methods = HashBasedTable.create();
}

public MethodSymbol getMethod(String className, String methodName) {
MethodSymbol getMethod(String className, String methodName) {
return methods.get(className, methodName);
}

public VisitorState getState() {
VisitorState getState() {
return state;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ private abstract static class TestScanner extends Scanner {
* Subclasses of {@link TestScanner} are expected to call this method within their overridden
* visitXYZ() method in order to verify that the method has run at least once.
*/
protected void setAssertionsComplete() {
void setAssertionsComplete() {
this.assertionsComplete = true;
}

Expand All @@ -1052,7 +1052,7 @@ <T extends Tree> void assertMatch(T node, VisitorState visitorState, Matcher<T>
assertThat(matcher.matches(node, state)).isTrue();
}

public void verifyAssertionsComplete() {
void verifyAssertionsComplete() {
assertWithMessage("Expected the visitor to call setAssertionsComplete().")
.that(assertionsComplete)
.isTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Description matchNewClass(NewClassTree newClassTree, VisitorState state)

private static class ChildOfBlockOrCase<T extends Tree>
extends ChildMultiMatcher<T, StatementTree> {
public ChildOfBlockOrCase(MatchType matchType, Matcher<StatementTree> nodeMatcher) {
ChildOfBlockOrCase(MatchType matchType, Matcher<StatementTree> nodeMatcher) {
super(matchType, nodeMatcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public void consumeLiteral(char literal) {
prev = null;
}

public Set<Character> getDuplicates() {
Set<Character> getDuplicates() {
return duplicates;
}

public static ImmutableSet<Character> getDuplicates(String pattern) {
static ImmutableSet<Character> getDuplicates(String pattern) {
PatternCounter counter = new PatternCounter();
parseDateFormat(pattern, counter);
return ImmutableSet.copyOf(counter.getDuplicates());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static class TreeScannerEquals extends TreeScanner<Void, VarSymbol> {
private boolean hasIllegalEquals = false;
private final MethodTree methodTree;

public TreeScannerEquals(MethodTree currMethodTree) {
TreeScannerEquals(MethodTree currMethodTree) {
methodTree = currMethodTree;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public boolean matches(T tree, VisitorState state) {
}

/** Match a tree in the ancestor chain given the ancestor's immediate descendant. */
protected MatchResult matchAncestor(Tree leaf, Tree prevTree) {
MatchResult matchAncestor(Tree leaf, Tree prevTree) {
if (leaf instanceof TryTree tryTree) {
if (tryTree.getFinallyBlock() != null && tryTree.getFinallyBlock().equals(prevTree)) {
return MatchResult.FOUND_ERROR;
Expand All @@ -157,12 +157,12 @@ private enum JumpType {
CONTINUE
}

public FinallyJumpMatcher(JCContinue jcContinue) {
FinallyJumpMatcher(JCContinue jcContinue) {
this.label = jcContinue.getLabel();
this.jumpType = JumpType.CONTINUE;
}

public FinallyJumpMatcher(JCBreak jcBreak) {
FinallyJumpMatcher(JCBreak jcBreak) {
this.label = jcBreak.getLabel();
this.jumpType = JumpType.BREAK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static class BehaviorPreservingChecker extends SimpleTreeVisitor<Boolean
private boolean inBoxedVoidReturningMethod = false;
private final Symbol methodToCall;

public BehaviorPreservingChecker(Symbol methodToCall) {
BehaviorPreservingChecker(Symbol methodToCall) {
super(false);
this.methodToCall = methodToCall;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private ImmutableSet<Symbol> accessedFields() {
return accessedFields.build();
}

public boolean failed() {
boolean failed() {
return failed;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static ImmutableSet<Symbol.VarSymbol> scan(Tree tree) {

private final ImmutableSet.Builder<Symbol.VarSymbol> conditionVars;

public LoopConditionVisitor(ImmutableSet.Builder<Symbol.VarSymbol> conditionVars) {
LoopConditionVisitor(ImmutableSet.Builder<Symbol.VarSymbol> conditionVars) {
this.conditionVars = conditionVars;
}

Expand Down Expand Up @@ -145,7 +145,7 @@ public Boolean visitBinary(BinaryTree node, Void unused) {
/** Scan for updates to the given variables. */
private static class UpdateScanner extends TreeScanner<Void, Void> {

public static boolean scan(Tree tree, ImmutableSet<Symbol.VarSymbol> variables) {
static boolean scan(Tree tree, ImmutableSet<Symbol.VarSymbol> variables) {
UpdateScanner scanner = new UpdateScanner(variables);
tree.accept(scanner, null);
return scanner.modified;
Expand All @@ -154,7 +154,7 @@ public static boolean scan(Tree tree, ImmutableSet<Symbol.VarSymbol> variables)
private boolean modified = false;
private final ImmutableSet<Symbol.VarSymbol> variables;

public UpdateScanner(ImmutableSet<Symbol.VarSymbol> variables) {
UpdateScanner(ImmutableSet<Symbol.VarSymbol> variables) {
this.variables = variables;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public Description report(
}
};

public abstract Description report(
abstract Description report(
Set<MethodTree> affectedTrees, SuggestedFix fix, VisitorState state, BugChecker checker);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ private static boolean matches(List<? extends ExpressionTree> expressionTrees) {

private static class ChildOfTryMatcher extends ChildMultiMatcher<TryTree, Tree> {

public ChildOfTryMatcher(MatchType matchType, Matcher<Tree> nodeMatcher) {
ChildOfTryMatcher(MatchType matchType, Matcher<Tree> nodeMatcher) {
super(matchType, nodeMatcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ private enum AnnotationType {
this.fullyQualifiedName = fullyQualifiedName;
}

public String fullyQualifiedName() {
String fullyQualifiedName() {
return fullyQualifiedName;
}

public String simpleName() {
String simpleName() {
int index = fullyQualifiedName().lastIndexOf('.');
if (index >= 0) {
return fullyQualifiedName().substring(index + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Description matchIf(IfTree ifTree, VisitorState visitorState) {
private static class AssignmentTreeMatcher implements Matcher<Tree> {
private final ExpressionTree variableExpressionTree;

public AssignmentTreeMatcher(ExpressionTree e) {
AssignmentTreeMatcher(ExpressionTree e) {
variableExpressionTree = e;
}

Expand All @@ -104,7 +104,7 @@ private static class NestedInstanceOfMatcher implements Matcher<Tree> {
private final ExpressionTree expressionTree;
private final Tree typeTree;

public NestedInstanceOfMatcher(ExpressionTree e, Tree t) {
NestedInstanceOfMatcher(ExpressionTree e, Tree t) {
expressionTree = e;
typeTree = t;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private static class CastState {
final String castToType;
final SuggestedFix.Builder fix;

public CastState(Name name, String castToType, SuggestedFix.Builder fix) {
CastState(Name name, String castToType, SuggestedFix.Builder fix) {
this.name = name;
this.castToType = castToType;
this.fix = fix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Void visitClassType(Type.ClassType type, Void unused) {
return null;
}

public void visitIntersectionClassType(Type.IntersectionClassType type) {
void visitIntersectionClassType(Type.IntersectionClassType type) {
for (Type component : type.getComponents()) {
component.accept(this, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private UnicodeScanner(String source, VisitorState state) {
this.currentCharacter = source.charAt(0);
}

public void scan() {
void scan() {
for (; position < source.length(); processCharacter()) {
if (isUnicode && isBanned(currentCharacter)) {
if (currentCharacter == '\\' && peek() == 'u') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public Void visitIdentifier(IdentifierTree node, Void unused) {
}
}

public Optional<SuggestedFix> getFixes() {
Optional<SuggestedFix> getFixes() {
return failed ? Optional.empty() : Optional.of(fix.build());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public String id() {
return '@' + simpleAnnotation;
}

protected abstract ResultUsePolicy autoMethodPolicy(
abstract ResultUsePolicy autoMethodPolicy(
MethodSymbol abstractMethod, ClassSymbol autoClass, VisitorState state);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@ private static class LoggerIsEnabledBinaryIfConditionScanner extends TreeScanner

private final ExpressionTree logInvocation;
private final VisitorState state;
public Optional<SuggestedFix> fix;
Optional<SuggestedFix> fix;

public LoggerIsEnabledBinaryIfConditionScanner(
ExpressionTree logInvocation, VisitorState state) {
LoggerIsEnabledBinaryIfConditionScanner(ExpressionTree logInvocation, VisitorState state) {
this.logInvocation = logInvocation;
this.state = state;
this.fix = Optional.empty();
Expand Down
Loading
Loading