aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Alfred Kluever <kak@google.com>2021-09-17 13:44:52 -0700
committerGoogle Java Core Libraries <java-core-libraries-team+copybara@google.com>2021-09-17 13:47:03 -0700
commitdaa2d52bf1c0d867faee911da424696c01b217a0 (patch)
tree1bd4392850c6cdca7310d214314c995765660ccd
parentc937dd7bad321dae1b838f5156611d2b8c954a30 (diff)
downloadguava-daa2d52bf1c0d867faee911da424696c01b217a0.tar.gz
Add `@InlineMe` to `Strings.repeat(String, int)`.
RELNOTES=n/a PiperOrigin-RevId: 397391544
-rw-r--r--guava/src/com/google/common/base/Strings.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/guava/src/com/google/common/base/Strings.java b/guava/src/com/google/common/base/Strings.java
index fa3626648..e56bf1c48 100644
--- a/guava/src/com/google/common/base/Strings.java
+++ b/guava/src/com/google/common/base/Strings.java
@@ -20,6 +20,8 @@ import static java.util.logging.Level.WARNING;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.VisibleForTesting;
+import com.google.errorprone.annotations.InlineMe;
+import com.google.errorprone.annotations.InlineMeValidationDisabled;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -137,12 +139,16 @@ public final class Strings {
* Returns a string consisting of a specific number of concatenated copies of an input string. For
* example, {@code repeat("hey", 3)} returns the string {@code "heyheyhey"}.
*
+ * <p><b>Java 11+ users:</b> use {@code string.repeat(count)} instead.
+ *
* @param string any non-null string
* @param count the number of times to repeat it; a nonnegative integer
* @return a string containing {@code string} repeated {@code count} times (the empty string if
* {@code count} is zero)
* @throws IllegalArgumentException if {@code count} is negative
*/
+ @InlineMe(replacement = "string.repeat(count)")
+ @InlineMeValidationDisabled("Java 11+ API only")
public static String repeat(String string, int count) {
checkNotNull(string); // eager for GWT.