RFR: 8349991: GraphUtils.java can use String.replace() instead of String.replaceAll()
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Feb 24 11:48:54 UTC 2025
On Mon, 24 Feb 2025 11:41:00 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This is a tiny performance improvement that replaces a few invocations of `String.replaceAll()` with equivalent invocations of `String.replace(char, char)` and avoids the unnecessary use of regular expressions.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/util/GraphUtils.java line 254:
>
>> 252:
>> 253: protected String formatProperties(Properties p) {
>> 254: return p.toString().replace(',', ' ')
>
> can't there be more than one `,` in the `toString` of `Properties` object?
I know that javac only ever uses two properties at most... but this class is rather general, and the proposed change would introduce subtle bugs if a third property is ever added to inference nodes -- or any other node using in javac implementation
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23658#discussion_r1967486886
More information about the compiler-dev
mailing list