Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoenig10 committed Aug 3, 2022
1 parent 36b55d0 commit e0526ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.fixes.SuggestedFix;
import com.google.errorprone.fixes.SuggestedFixes;
import com.google.errorprone.matchers.Description;
import com.google.errorprone.matchers.Matcher;
import com.google.errorprone.matchers.method.MethodMatchers;
Expand All @@ -34,7 +35,7 @@
linkType = BugPattern.LinkType.CUSTOM,
summary = "Implicit use of the platform default locale, which can result in differing behaviour between JVM"
+ " executions.",
severity = SeverityLevel.WARNING)
severity = SeverityLevel.SUGGESTION)
public final class DefaultLocale extends BugChecker implements BugChecker.MethodInvocationTreeMatcher {

private static final long serialVersionUID = 1L;
Expand All @@ -47,13 +48,13 @@ public final class DefaultLocale extends BugChecker implements BugChecker.Method
@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (MATCHER.matches(tree, state)) {
SuggestedFix.Builder fix = SuggestedFix.builder();
return buildDescription(tree)
.addFix(SuggestedFix.builder()
.addImport("java.util.Locale")
.replace(
.addFix(fix.replace(
state.getEndPosition(tree.getMethodSelect()),
state.getEndPosition(tree),
"(Locale.ROOT)")
String.format(
"(%s.ROOT)", SuggestedFixes.qualifyType(state, fix, "java.util.Locale")))
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class BaselineErrorProneExtension {
"CompileTimeConstantViolatesLiskovSubstitution",
"ConsistentLoggerName",
"ConsistentOverrides",
"DefaultLocale",
"DeprecatedGuavaObjects",
"ExecutorSubmitRunnableFutureIgnored",
"ExtendsErrorOrThrowable",
Expand Down

0 comments on commit e0526ce

Please sign in to comment.