From 5fc04fbdef9148d5fc81c9c014d7e2ba8f238873 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Mon, 23 Dec 2024 18:23:22 +0100 Subject: [PATCH] Document possible follow-up work --- .../picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java | 2 ++ .../java/tech/picnic/errorprone/bugpatterns/StringJoin.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java index 24fbfa3992..9415efb68e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java @@ -101,6 +101,8 @@ private void reportMethodRenameBlocker(MethodTree tree, String reason, VisitorSt .build()); } + // XXX: Consider dropping leading underscores that otherwise result when canonicalizing + // `test_some_method_name`. private static Optional tryCanonicalizeMethodName(MethodSymbol symbol) { return Optional.of(symbol.getQualifiedName().toString()) .filter(name -> name.startsWith(TEST_PREFIX)) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java index 99b3380df3..9061a82c9d 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java @@ -36,7 +36,9 @@ */ // XXX: What about `v1 + "sep" + v2` and similar expressions? Do we want to rewrite those to // `String.join`, or should some `String.join` invocations be rewritten to use the `+` operator? -// (The latter suggestion would conflict with the `FormatStringConcatenation` check.) +// (The latter suggestion would conflict with the `FormatStringConcatenation` check, but does make +// more sense when `"sep"` is a long string. Similarly for `String.format("%s some long text %s", +// arg1, arg2)`.) @AutoService(BugChecker.class) @BugPattern( summary = "Prefer `String#join` over `String#format`",