From 042d63c71f5530523d83b4a8d8b51550f4b92100 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Fri, 28 Mar 2025 21:37:59 +0100 Subject: [PATCH] Clarify that class Ascii is from Guava. This avoids initial confusion for stupid users (like me!) who when working outside of Google internal codebase and when first encountering this error go look for class Ascii in the JDK. --- .../google/errorprone/bugpatterns/StringCaseLocaleUsage.java | 2 +- docs/bugpattern/StringCaseLocaleUsage.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/StringCaseLocaleUsage.java b/core/src/main/java/com/google/errorprone/bugpatterns/StringCaseLocaleUsage.java index 079454f8b73..8ab9dfa6921 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/StringCaseLocaleUsage.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/StringCaseLocaleUsage.java @@ -86,7 +86,7 @@ private static SuggestedFix suggestAscii(MethodInvocationTree tree, VisitorState var fix = SuggestedFix.builder() .setShortDescription( - "Replace with Ascii.toLower/UpperCase; this changes behaviour for non-ASCII" + "Replace with Guava's Ascii.toLower/UpperCase; this changes behaviour for non-ASCII" + " Strings"); String ascii = SuggestedFixes.qualifyType(state, fix, "com.google.common.base.Ascii"); fix.replace( diff --git a/docs/bugpattern/StringCaseLocaleUsage.md b/docs/bugpattern/StringCaseLocaleUsage.md index 2d8c4d0fc30..6d37f242afc 100644 --- a/docs/bugpattern/StringCaseLocaleUsage.md +++ b/docs/bugpattern/StringCaseLocaleUsage.md @@ -10,4 +10,5 @@ If this kind of regionalisation is desired, use `.toLowerCase(Locale.getDefault())` to make that explicit. If not, `.toLowerCase(Locale.ROOT)` or `.toLowerCase(Locale.ENGLISH)` will give you casing independent of the user's current `Locale`. If you know that you're -operating on ASCII, prefer `Ascii.toLower/UpperCase` to make that explicit. +operating on ASCII, prefer `Ascii.toLower/UpperCase` (from Guava, if available) +to make that explicit.