Migrate from `Strings#repeat(String, int)` to `String#repeat(int)`.
PiperOrigin-RevId: 405674545
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java
index 35f5cd2..fc6747b 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildOptions.java
@@ -19,7 +19,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMap;
@@ -152,7 +151,7 @@
synchronized (this) {
if (checksum == null) {
if (fragmentOptionsMap.isEmpty() && starlarkOptionsMap.isEmpty()) {
- checksum = Strings.repeat("0", 64); // Make empty build options easy to distinguish.
+ checksum = "0".repeat(64); // Make empty build options easy to distinguish.
} else {
Fingerprint fingerprint = new Fingerprint();
for (FragmentOptions options : fragmentOptionsMap.values()) {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedModule.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedModule.java
index ac797b4..9f38b3c 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedModule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedModule.java
@@ -133,12 +133,12 @@
} else {
this.append(sep);
}
- this.append("\n").append(Strings.repeat(" ", indent)).repr(o);
+ this.append("\n").append(" ".repeat(5 * indent)).repr(o);
}
indent--;
// Final indent, if nonempty.
if (sep != null) {
- this.append("\n").append(Strings.repeat(" ", indent));
+ this.append("\n").append(" ".repeat(5 * indent));
}
return this.append(after);
}
diff --git a/src/main/java/com/google/devtools/build/lib/remote/merkletree/DirectoryTree.java b/src/main/java/com/google/devtools/build/lib/remote/merkletree/DirectoryTree.java
index ed05554..48005f1 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/merkletree/DirectoryTree.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/merkletree/DirectoryTree.java
@@ -15,7 +15,6 @@
import build.bazel.remote.execution.v2.Digest;
import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -228,13 +227,13 @@
StringBuilder sb = new StringBuilder();
if (!dirname.equals(PathFragment.EMPTY_FRAGMENT)) {
- sb.append(Strings.repeat(" ", depth));
+ sb.append(" ".repeat(2 * depth));
sb.append(dirname.getBaseName());
sb.append("\n");
}
if (!files.isEmpty()) {
for (FileNode file : files) {
- sb.append(Strings.repeat(" ", depth + 1));
+ sb.append(" ".repeat(2 * (depth + 1)));
sb.append(formatFile(file));
sb.append("\n");
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModuleMapAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModuleMapAction.java
index 14b4e8b..c8da47d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModuleMapAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModuleMapAction.java
@@ -15,7 +15,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
@@ -115,7 +114,7 @@
PathFragment fragment = cppModuleMap.getArtifact().getExecPath();
int segmentsToExecPath = fragment.segmentCount() - 1;
Optional<Artifact> umbrellaHeader = cppModuleMap.getUmbrellaHeader();
- String leadingPeriods = moduleMapHomeIsCwd ? "" : Strings.repeat("../", segmentsToExecPath);
+ String leadingPeriods = moduleMapHomeIsCwd ? "" : "../".repeat(segmentsToExecPath);
Iterable<Artifact> separateModuleHdrs =
expandedHeaders(artifactExpander, separateModuleHeaders);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
index 9a9136a..b5e4d5a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.rules.cpp;
import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@@ -107,7 +106,7 @@
rpathRoot = ccToolchainProvider.getSolibDirectory() + "/";
} else {
rpathRoot =
- Strings.repeat("../", outputArtifact.getRootRelativePath().segmentCount() - 1)
+ "../".repeat(outputArtifact.getRootRelativePath().segmentCount() - 1)
+ ccToolchainProvider.getSolibDirectory()
+ "/";
}
@@ -185,7 +184,7 @@
// "../../_solib_[arch]".
if (needToolchainLibrariesRpath) {
runtimeLibrarySearchDirectories.add(
- Strings.repeat("../", outputArtifact.getRootRelativePath().segmentCount() - 1)
+ "../".repeat(outputArtifact.getRootRelativePath().segmentCount() - 1)
+ toolchainLibrariesSolibName
+ "/");
}
diff --git a/src/main/java/com/google/devtools/build/skydoc/rendering/MarkdownUtil.java b/src/main/java/com/google/devtools/build/skydoc/rendering/MarkdownUtil.java
index decfb46..331c80d 100644
--- a/src/main/java/com/google/devtools/build/skydoc/rendering/MarkdownUtil.java
+++ b/src/main/java/com/google/devtools/build/skydoc/rendering/MarkdownUtil.java
@@ -15,7 +15,6 @@
package com.google.devtools.build.skydoc.rendering;
import com.google.common.base.Joiner;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.AspectInfo;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.AttributeInfo;
@@ -95,7 +94,7 @@
public String ruleSummary(String ruleName, RuleInfo ruleInfo) {
List<String> attributeNames =
ruleInfo.getAttributeList().stream()
- .map(attr -> attr.getName())
+ .map(AttributeInfo::getName)
.collect(Collectors.toList());
return summary(ruleName, attributeNames);
}
@@ -124,7 +123,7 @@
public String aspectSummary(String aspectName, AspectInfo aspectInfo) {
List<String> attributeNames =
aspectInfo.getAttributeList().stream()
- .map(attr -> attr.getName())
+ .map(AttributeInfo::getName)
.collect(Collectors.toList());
return summary(aspectName, attributeNames);
}
@@ -138,7 +137,7 @@
public String funcSummary(StarlarkFunctionInfo funcInfo) {
List<String> paramNames =
funcInfo.getParameterList().stream()
- .map(param -> param.getName())
+ .map(FunctionParamInfo::getName)
.collect(Collectors.toList());
return summary(funcInfo.getFunctionName(), paramNames);
}
@@ -154,8 +153,7 @@
paramLinksLines.add(paramLinksLine);
}
String paramList =
- Joiner.on(String.format(",\n%s", Strings.repeat(" ", functionName.length() + 1)))
- .join(paramLinksLines);
+ Joiner.on(",\n" + " ".repeat(functionName.length() + 1)).join(paramLinksLines);
return String.format("%s(%s)", functionName, paramList);
}
@@ -240,9 +238,9 @@
List<String> finalProviderNames = new ArrayList<>();
for (ProviderNameGroup providerNameList : providerNames) {
List<String> providers = providerNameList.getProviderNameList();
- finalProviderNames.add(String.format(Joiner.on(", ").join(providers)));
+ finalProviderNames.add(Joiner.on(", ").join(providers));
}
- return String.format(Joiner.on("; or ").join(finalProviderNames));
+ return Joiner.on("; or ").join(finalProviderNames);
}
private static String attributeTypeDescription(AttributeType attributeType) {
@@ -251,16 +249,12 @@
return "Name";
case INT:
return "Integer";
- case LABEL:
- return "Label";
case STRING:
return "String";
case STRING_LIST:
return "List of strings";
case INT_LIST:
return "List of integers";
- case LABEL_LIST:
- return "List of labels";
case BOOLEAN:
return "Boolean";
case LABEL_STRING_DICT:
@@ -269,8 +263,10 @@
return "Dictionary: String -> String";
case STRING_LIST_DICT:
return "Dictionary: String -> List of strings";
+ case LABEL:
case OUTPUT:
return "Label";
+ case LABEL_LIST:
case OUTPUT_LIST:
return "List of labels";
case UNKNOWN:
diff --git a/src/main/java/com/google/devtools/common/options/OptionsUsage.java b/src/main/java/com/google/devtools/common/options/OptionsUsage.java
index 722baead..d036db4 100644
--- a/src/main/java/com/google/devtools/common/options/OptionsUsage.java
+++ b/src/main/java/com/google/devtools/common/options/OptionsUsage.java
@@ -17,7 +17,6 @@
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.escape.Escaper;
@@ -57,7 +56,7 @@
* wrapping lines at 'width'. Returns the formatted result.
*/
static String paragraphFill(String in, int indent, int width) {
- String indentString = Strings.repeat(" ", indent);
+ String indentString = " ".repeat(indent);
StringBuilder out = new StringBuilder();
String sep = "";
for (String paragraph : NEWLINE_SPLITTER.split(in)) {
diff --git a/src/main/java/net/starlark/java/eval/EvalUtils.java b/src/main/java/net/starlark/java/eval/EvalUtils.java
index e5c3cb2..e1487fb 100644
--- a/src/main/java/net/starlark/java/eval/EvalUtils.java
+++ b/src/main/java/net/starlark/java/eval/EvalUtils.java
@@ -13,7 +13,6 @@
// limitations under the License.
package net.starlark.java.eval;
-import com.google.common.base.Strings;
import java.util.IllegalFormatException;
import net.starlark.java.syntax.TokenKind;
@@ -394,11 +393,10 @@
if (n <= 0) {
return "";
} else if ((long) s.length() * (long) n > Integer.MAX_VALUE) {
- // Would exceed max length of a java String (and would cause an undocumented
- // ArrayIndexOutOfBoundsException to be thrown in Strings.repeat()).
+ // Would exceed max length of a java String.
throw Starlark.errorf("excessive repeat (%d * %d characters)", s.length(), n);
} else {
- return Strings.repeat(s, n);
+ return s.repeat(n);
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheTest.java b/src/test/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheTest.java
index 3d0fe4d..9e2a381 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheTest.java
@@ -16,7 +16,6 @@
import static com.google.common.truth.Truth.assertThat;
-import com.google.common.base.Strings;
import com.google.devtools.build.lib.bazel.repository.cache.RepositoryCache.KeyType;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
@@ -65,7 +64,7 @@
@Test
public void testNonExistentCacheValue() {
- String fakeSha256 = Strings.repeat("a", 64);
+ String fakeSha256 = "a".repeat(64);
assertThat(repositoryCache.exists(fakeSha256, KeyType.SHA256)).isFalse();
}
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/DeclarationAssemblerTest.java b/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/DeclarationAssemblerTest.java
index d241ba5..855ea97 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/DeclarationAssemblerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/DeclarationAssemblerTest.java
@@ -18,7 +18,6 @@
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.devtools.build.lib.bazel.rules.ninja.file.DeclarationAssembler;
@@ -76,7 +75,7 @@
@Test
public void testMergeTwoDifferentBuffers() throws Exception {
List<Pair<Long, String>> offsetStringPairList = Lists.newArrayList();
- String unrelatedFirstBuffer = Strings.repeat(" ", 100);
+ String unrelatedFirstBuffer = " ".repeat(100);
String s1 = "hello";
String s2 = "goodbye";
byte[] chars1 = (unrelatedFirstBuffer + s1).getBytes(ISO_8859_1);
diff --git a/src/test/java/com/google/devtools/build/lib/exec/StreamedTestOutputTest.java b/src/test/java/com/google/devtools/build/lib/exec/StreamedTestOutputTest.java
index 78eccec..6dfca03 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/StreamedTestOutputTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/StreamedTestOutputTest.java
@@ -16,7 +16,6 @@
import static com.google.common.truth.Truth.assertThat;
-import com.google.common.base.Strings;
import com.google.common.io.ByteStreams;
import com.google.devtools.build.lib.util.io.OutErr;
import com.google.devtools.build.lib.vfs.DigestHashFunction;
@@ -90,10 +89,7 @@
public void testWatcherDoneAfterClose() throws IOException {
Path watchedPath = fileSystem.getPath("/myfile");
FileSystemUtils.writeLinesAs(
- watchedPath,
- StandardCharsets.UTF_8,
- TestLogHelper.HEADER_DELIMITER,
- Strings.repeat("x", 10 << 20));
+ watchedPath, StandardCharsets.UTF_8, TestLogHelper.HEADER_DELIMITER, "x".repeat(10 << 20));
StreamedTestOutput underTest =
new StreamedTestOutput(
OutErr.create(ByteStreams.nullOutputStream(), ByteStreams.nullOutputStream()),
@@ -106,10 +102,7 @@
public void testInterruptWaitsForWatcherToClose() throws IOException {
Path watchedPath = fileSystem.getPath("/myfile");
FileSystemUtils.writeLinesAs(
- watchedPath,
- StandardCharsets.UTF_8,
- TestLogHelper.HEADER_DELIMITER,
- Strings.repeat("x", 10 << 20));
+ watchedPath, StandardCharsets.UTF_8, TestLogHelper.HEADER_DELIMITER, "x".repeat(10 << 20));
StreamedTestOutput underTest =
new StreamedTestOutput(
diff --git a/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java b/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java
index 23a8192..99e4d78 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/RuleClassTest.java
@@ -33,7 +33,6 @@
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -1150,7 +1149,7 @@
new RuleClass.Builder("myclass", RuleClassType.NORMAL, /*starlark=*/ false)
.factory(DUMMY_CONFIGURED_TARGET_FACTORY)
.add(attr("tags", STRING_LIST))
- .add(attr(Strings.repeat("x", 150), STRING))
+ .add(attr("x".repeat(150), STRING))
.build());
assertThat(expected)
diff --git a/src/test/java/com/google/devtools/build/lib/rules/genquery/GenQueryOutputStreamTest.java b/src/test/java/com/google/devtools/build/lib/rules/genquery/GenQueryOutputStreamTest.java
index e69d5393..049fad2 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/genquery/GenQueryOutputStreamTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/genquery/GenQueryOutputStreamTest.java
@@ -16,7 +16,6 @@
import static com.google.common.truth.Truth.assertThat;
-import com.google.common.base.Strings;
import com.google.devtools.build.lib.rules.genquery.GenQueryOutputStream.GenQueryResult;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.protobuf.ByteString;
@@ -34,7 +33,7 @@
@Test
public void testSmallOutputMultibyteWriteWithCompressionEnabled() throws IOException {
runMultibyteWriteTest(
- Strings.repeat("xyz", 10_000),
+ "xyz".repeat(10_000),
/*compressionEnabled=*/ true,
GenQueryOutputStream.RegularResult.class);
}
@@ -42,7 +41,7 @@
@Test
public void testSmallOutputMultibyteWriteWithCompressionDisabled() throws IOException {
runMultibyteWriteTest(
- Strings.repeat("xyz", 10_000),
+ "xyz".repeat(10_000),
/*compressionEnabled=*/ false,
GenQueryOutputStream.RegularResult.class);
}
@@ -50,7 +49,7 @@
@Test
public void testBigOutputMultibyteWriteWithCompressionEnabled() throws IOException {
runMultibyteWriteTest(
- Strings.repeat("xyz", 1_000_000),
+ "xyz".repeat(1_000_000),
/*compressionEnabled=*/ true,
GenQueryOutputStream.CompressedResult.class);
}
@@ -58,7 +57,7 @@
@Test
public void testBigOutputMultibyteWriteWithCompressionDisabled() throws IOException {
runMultibyteWriteTest(
- Strings.repeat("xyz", 1_000_000),
+ "xyz".repeat(1_000_000),
/*compressionEnabled=*/ false,
GenQueryOutputStream.RegularResult.class);
}
@@ -66,7 +65,7 @@
@Test
public void testSmallOutputSingleByteWritesWithCompressionEnabled() throws IOException {
runSingleByteWriteTest(
- Strings.repeat("xyz", 10_000),
+ "xyz".repeat(10_000),
/*compressionEnabled=*/ true,
GenQueryOutputStream.RegularResult.class);
}
@@ -74,7 +73,7 @@
@Test
public void testSmallOutputSingleByteWritesWithCompressionDisabled() throws IOException {
runSingleByteWriteTest(
- Strings.repeat("xyz", 10_000),
+ "xyz".repeat(10_000),
/*compressionEnabled=*/ false,
GenQueryOutputStream.RegularResult.class);
}
@@ -82,7 +81,7 @@
@Test
public void testBigOutputSingleByteWritesWithCompressionEnabled() throws IOException {
runSingleByteWriteTest(
- Strings.repeat("xyz", 1_000_000),
+ "xyz".repeat(1_000_000),
/*compressionEnabled=*/ true,
GenQueryOutputStream.CompressedResult.class);
}
@@ -90,7 +89,7 @@
@Test
public void testBigOutputSingleByteWritesWithCompressionDisabled() throws IOException {
runSingleByteWriteTest(
- Strings.repeat("xyz", 1_000_000),
+ "xyz".repeat(1_000_000),
/*compressionEnabled=*/ false,
GenQueryOutputStream.RegularResult.class);
}
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/LineBufferedOutputStreamTest.java b/src/test/java/com/google/devtools/build/lib/runtime/LineBufferedOutputStreamTest.java
index b81a6dc..2c540c0 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/LineBufferedOutputStreamTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/LineBufferedOutputStreamTest.java
@@ -16,7 +16,6 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
-import com.google.common.base.Strings;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
@@ -64,7 +63,7 @@
@Test
public void testLineBuffering() throws Exception {
- String large = Strings.repeat("a", 100);
+ String large = "a".repeat(100);
assertThat(lineBuffer("foo\nbar")).containsExactly("foo\n", "bar");
assertThat(lineBuffer("foobarfoobar")).containsExactly("foobar", "foobar");
@@ -81,11 +80,11 @@
@Test
public void testIOErrorOnWrappedStream() throws Exception {
MockOutputStream mos = new MockOutputStream();
- LineBufferedOutputStream cut = new LineBufferedOutputStream(mos, 4);
- mos.throwException = true;
- assertThrows(IOException.class, () -> cut.write("aaaa".getBytes(StandardCharsets.UTF_8)));
- cut.write("a".getBytes(StandardCharsets.UTF_8));
- cut.close();
+ try (LineBufferedOutputStream cut = new LineBufferedOutputStream(mos, 4)) {
+ mos.throwException = true;
+ assertThrows(IOException.class, () -> cut.write("aaaa".getBytes(StandardCharsets.UTF_8)));
+ cut.write("a".getBytes(StandardCharsets.UTF_8));
+ }
assertThat(mos.writes).containsExactly("aaaa", "a");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/UiStateTrackerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/UiStateTrackerTest.java
index d8354cc..9edde7a 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/UiStateTrackerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/UiStateTrackerTest.java
@@ -21,7 +21,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -1295,7 +1294,7 @@
// Verify that the progress bar contains useful information on a 60-character terminal.
// - Too long names should be shortened to reasonably long prefixes of the name.
ManualClock clock = new ManualClock();
- BuildEventTransport transport1 = newBepTransport(Strings.repeat("A", 61));
+ BuildEventTransport transport1 = newBepTransport("A".repeat(61));
BuildEventTransport transport2 = newBepTransport("BuildEventTransport");
BuildResult buildResult = new BuildResult(clock.currentTimeMillis());
buildResult.setDetailedExitCode(DetailedExitCode.success());
@@ -1310,7 +1309,7 @@
String output = terminalWriter.getTranscript();
assertThat(longestLine(output)).isAtMost(60);
assertThat(output, containsString("1s"));
- assertThat(output, containsString(Strings.repeat("A", 30) + "..."));
+ assertThat(output, containsString("A".repeat(30) + "..."));
assertThat(output, containsString("BuildEventTransport"));
assertThat(output, containsString("success"));
assertThat(output, containsString("complete"));
@@ -1322,7 +1321,7 @@
output = terminalWriter.getTranscript();
assertThat(longestLine(output)).isAtMost(60);
assertThat(output, containsString("2s"));
- assertThat(output, containsString(Strings.repeat("A", 30) + "..."));
+ assertThat(output, containsString("A".repeat(30) + "..."));
assertThat(output, not(containsString("BuildEventTransport")));
assertThat(output, containsString("success"));
assertThat(output, containsString("complete"));
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java
index 21047ad..dc3f06a 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java
@@ -21,7 +21,6 @@
import static org.junit.Assert.fail;
import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -860,7 +859,7 @@
public void testSize() throws Exception {
Path file = file("file");
int fileSize = 20;
- FileSystemUtils.writeContentAsLatin1(file, Strings.repeat("a", fileSize));
+ FileSystemUtils.writeContentAsLatin1(file, "a".repeat(fileSize));
assertThat(valueForPath(file).getSize()).isEqualTo(fileSize);
Path dir = directory("directory");
file(dir.getChild("child").getPathString());
@@ -894,7 +893,7 @@
};
pkgRoot = Root.fromPath(fs.getPath("/root"));
Path file = file("file");
- FileSystemUtils.writeContentAsLatin1(file, Strings.repeat("a", 20));
+ FileSystemUtils.writeContentAsLatin1(file, "a".repeat(20));
byte[] digest = file.getDigest();
expectedCalls++;
assertThat(digestCalls.get()).isEqualTo(expectedCalls);
diff --git a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
index 482ebb9..fbecb94 100644
--- a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
@@ -18,7 +18,6 @@
import static org.junit.Assert.assertThrows;
import com.google.common.base.Joiner;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
@@ -278,7 +277,7 @@
evalAndExport(
ev,
"def impl(ctx): return;",
- "r = rule(impl, attrs = { '" + Strings.repeat("x", 150) + "': attr.int() })");
+ "r = rule(impl, attrs = { '" + "x".repeat(150) + "': attr.int() })");
assertThat(ev.getEventCollector()).hasSize(1);
Event event = ev.getEventCollector().iterator().next();
diff --git a/src/test/java/com/google/devtools/build/lib/util/CrashFailureDetailsTest.java b/src/test/java/com/google/devtools/build/lib/util/CrashFailureDetailsTest.java
index 3aac0da..101e5ca 100644
--- a/src/test/java/com/google/devtools/build/lib/util/CrashFailureDetailsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/util/CrashFailureDetailsTest.java
@@ -17,7 +17,6 @@
import static com.google.common.truth.Truth.assertThat;
import static java.util.stream.Collectors.toList;
-import com.google.common.base.Strings;
import com.google.devtools.build.lib.server.FailureDetails;
import com.google.devtools.build.lib.server.FailureDetails.Crash;
import com.google.devtools.build.lib.server.FailureDetails.Crash.Code;
@@ -93,7 +92,7 @@
@Test
public void testMessageLimit() {
- TestException exception = new TestException(Strings.repeat("x", 5000));
+ TestException exception = new TestException("x".repeat(5000));
String crashMessage =
CrashFailureDetails.forThrowable(exception).getCrash().getCauses(0).getMessage();
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/DigestUtilsTest.java b/src/test/java/com/google/devtools/build/lib/vfs/DigestUtilsTest.java
index 7e2d536..5f4f89e 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/DigestUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/DigestUtilsTest.java
@@ -15,7 +15,6 @@
import static com.google.common.truth.Truth.assertThat;
-import com.google.common.base.Strings;
import com.google.devtools.build.lib.testutil.TestThread;
import com.google.devtools.build.lib.testutil.TestUtils;
import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
@@ -72,8 +71,8 @@
Path myFile1 = myfs.getPath("/f1.dat");
Path myFile2 = myfs.getPath("/f2.dat");
- FileSystemUtils.writeContentAsLatin1(myFile1, Strings.repeat("a", fileSize1));
- FileSystemUtils.writeContentAsLatin1(myFile2, Strings.repeat("b", fileSize2));
+ FileSystemUtils.writeContentAsLatin1(myFile1, "a".repeat(fileSize1));
+ FileSystemUtils.writeContentAsLatin1(myFile2, "b".repeat(fileSize2));
TestThread thread1 =
new TestThread(() -> DigestUtils.getDigestWithManualFallback(myFile1, fileSize1));