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 fd93165
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 @@ -16,6 +16,8 @@

package com.palantir.baseline.errorprone;

import static com.google.errorprone.fixes.SuggestedFixes.qualifyType;

import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.BugPattern.SeverityLevel;
Expand All @@ -34,7 +36,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 +49,12 @@ 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)", 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 fd93165

Please sign in to comment.