Skip to content

Commit 0ff1c08

Browse files
committed
8349984: (jdeps) jdeps can use String.repeat instead of String.replaceAll
Reviewed-by: alanb
1 parent 37ec796 commit 0ff1c08

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -790,8 +790,8 @@ boolean run(JdepsConfiguration config, JdepsWriter writer, Type type)
790790
String replacementApiTitle = getMessage("public.api.replacement.column.header");
791791
log.format("%-40s %s%n", internalApiTitle, replacementApiTitle);
792792
log.format("%-40s %s%n",
793-
internalApiTitle.replaceAll(".", "-"),
794-
replacementApiTitle.replaceAll(".", "-"));
793+
"-".repeat(internalApiTitle.codePointCount(0, internalApiTitle.length())),
794+
"-".repeat(replacementApiTitle.codePointCount(0, replacementApiTitle.length())));
795795
jdkInternals.entrySet()
796796
.forEach(e -> {
797797
String key = e.getKey();

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageResourcesTree.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -300,7 +300,7 @@ public String toPackageName(Node node) {
300300
return null;
301301
}
302302
String pkg = removeRadical(path, module + "/");
303-
return pkg.replaceAll("/", ".");
303+
return pkg.replace('/', '.');
304304
}
305305

306306
public String removeRadical(Node node) {

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -217,7 +217,7 @@ public void previsit(ResourcePool resources, StringTable strings) {
217217
available = Stream.concat(module.entries()
218218
.map(md -> p.matcher(md.path()))
219219
.filter(Matcher::matches)
220-
.map(m -> m.group("tag").replaceAll("_", "-")),
220+
.map(m -> m.group("tag").replace('_', '-')),
221221
Stream.of(jaJPJPTag, thTHTHTag, "und"))
222222
.distinct()
223223
.sorted()
@@ -250,7 +250,7 @@ private List<String> includeLocaleFilePatterns(String tag) {
250250
return List.of();
251251
}
252252

253-
List<String> files = new ArrayList<>(includeLocaleFiles(tag.replaceAll("-", "_")));
253+
List<String> files = new ArrayList<>(includeLocaleFiles(tag.replace('-', '_')));
254254

255255
// Add Thai BreakIterator related data files
256256
if (tag.equals("th")) {

0 commit comments

Comments
 (0)