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

Chen Liang liach at openjdk.org
Sun Mar 9 18:13:53 UTC 2025


On Sat, 8 Mar 2025 00:28:15 GMT, Henry Jen <henryjen at openjdk.org> wrote:

> JDK-8349989: jlink can use String.replace instead of String.replaceAll

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageResourcesTree.java line 303:

> 301:             }
> 302:             String pkg = removeRadical(path, module + "/");
> 303:             return pkg.replace("/", ".");

With the conversion to `replace`, we can use the char literals `'/'` and `'.'` instead of the string literals, which gives better performance as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23954#discussion_r1986384292


More information about the core-libs-dev mailing list