8349984: (jdeps) jdeps can use String.repeat instead of String.replaceAll

Reviewed-by: alanb
This commit is contained in:
Henry Jen 2025-03-13 16:44:06 +00:00
parent 37ec796255
commit 0ff1c0832e
3 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -790,8 +790,8 @@ class JdepsTask {
String replacementApiTitle = getMessage("public.api.replacement.column.header");
log.format("%-40s %s%n", internalApiTitle, replacementApiTitle);
log.format("%-40s %s%n",
internalApiTitle.replaceAll(".", "-"),
replacementApiTitle.replaceAll(".", "-"));
"-".repeat(internalApiTitle.codePointCount(0, internalApiTitle.length())),
"-".repeat(replacementApiTitle.codePointCount(0, replacementApiTitle.length())));
jdkInternals.entrySet()
.forEach(e -> {
String key = e.getKey();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -300,7 +300,7 @@ public final class ImageResourcesTree {
return null;
}
String pkg = removeRadical(path, module + "/");
return pkg.replaceAll("/", ".");
return pkg.replace('/', '.');
}
public String removeRadical(Node node) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -217,7 +217,7 @@ public final class IncludeLocalesPlugin extends AbstractPlugin implements Resour
available = Stream.concat(module.entries()
.map(md -> p.matcher(md.path()))
.filter(Matcher::matches)
.map(m -> m.group("tag").replaceAll("_", "-")),
.map(m -> m.group("tag").replace('_', '-')),
Stream.of(jaJPJPTag, thTHTHTag, "und"))
.distinct()
.sorted()
@ -250,7 +250,7 @@ public final class IncludeLocalesPlugin extends AbstractPlugin implements Resour
return List.of();
}
List<String> files = new ArrayList<>(includeLocaleFiles(tag.replaceAll("-", "_")));
List<String> files = new ArrayList<>(includeLocaleFiles(tag.replace('-', '_')));
// Add Thai BreakIterator related data files
if (tag.equals("th")) {