Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Dec 28, 2024
1 parent caff523 commit 3af3cf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
import tech.picnic.errorprone.utils.SourceCode;

/**
* A {@link BugChecker} that flags {@link String#format(String, Object...)}, {@link
* String#format(Locale, String, Object...)} and {@link String#formatted(Object...)} invocations
* A {@link BugChecker} that flags {@link String#format} and {@link String#formatted} invocations
* that can be omitted by delegating to another format method.
*/
// XXX: The special-casing of Throwable applies only to SLF4J 1.6.0+; see
Expand All @@ -53,6 +52,9 @@
// `RedundantStringConversion` checks. Look into deduplicating them.
// XXX: Should we also simplify e.g. `LOG.error(String.join("sep", arg1, arg2), throwable)`? Perhaps
// that's too obscure.
// XXX: This check currently only flags string format expressions that are a direct argument to
// another format-capable method invocation. Indirect cases, such as where the result is assigned to
// a variable, are currently not covered.
@AutoService(BugChecker.class)
@BugPattern(
summary = "String formatting can be deferred",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ public static String treeToString(Tree tree, VisitorState state) {
* found.
* @return A non-{@code null} string.
* @apiNote This method differs from {@link com.sun.tools.javac.util.Constants#format(Object)} in
* that it does not superfluously escape single quote characters. It is different from {@link
* that it does not superfluously escape single quote characters (the latter only does the
* "clean thing" starting from JDK 23). It is different from {@link
* VisitorState#getConstantExpression(Object)} in that it is more performant and accepts any
* {@link CharSequence} instance.
* @see <a href="https://bugs.openjdk.org/browse/JDK-8325078">JDK-8325078</a>
*/
// XXX: Drop this method if https://github.com/google/error-prone/pull/4586 is merged and released
// with the proposed `CharSequence` compatibility change.
Expand Down

0 comments on commit 3af3cf2

Please sign in to comment.