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:45:26 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 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

(separately, I'm also curious of when such a change makes a real impact -- `toDot()` is mostly used when debugging... but I'm ok with replacing complex methods with simpler forms -- where possible)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23658#discussion_r1967488241


More information about the compiler-dev mailing list