Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Daniel Fuchs
On Fri, 29 Apr 2022 18:28:45 GMT, Weijun Wang wrote: >> Shouldn't the comparison be better implemented by the caller then, who will >> know whether spaces are important or not? That's why I had suggested taking >> a `Predicate` that could be called with each line removed, and the >> caller

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Weijun Wang
On Fri, 29 Apr 2022 14:19:40 GMT, Daniel Fuchs wrote: >> The comparison is intentionally made lax so the caller does not need to >> provide the exact indentation or even new line characters. We think along >> with `fromLine` and `toLine` this is enough to make sure we are not >> modifying the

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Lance Andersen
On Fri, 29 Apr 2022 12:29:35 GMT, Sibabrata Sahoo wrote: >> A new API to support replacing selective lines with desired content. > > Sibabrata Sahoo has updated the pull request incrementally with one > additional commit since the last revision: > > 8285452: updated to use lines()

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Daniel Fuchs
On Fri, 29 Apr 2022 13:02:06 GMT, Weijun Wang wrote: >> Also calling trim() assumes that white spaces are not significant. This >> might not be the case in the general case (for instance - think of markdown >> files were leading spaces are significant). > > The comparison is intentionally made

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Weijun Wang
On Fri, 29 Apr 2022 12:44:26 GMT, Daniel Fuchs wrote: >> test/lib/jdk/test/lib/util/FileUtils.java line 394: >> >>> 392: var removed = ""; >>> 393: for (int i = fromLine; i <= toLine; i++) { >>> 394: removed += lines.remove(fromLine - 1).trim(); >> >>

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Daniel Fuchs
On Fri, 29 Apr 2022 12:35:59 GMT, Daniel Fuchs wrote: >> Sibabrata Sahoo has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8285452: updated to use lines() > > test/lib/jdk/test/lib/util/FileUtils.java line 394: > >> 392: var

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Daniel Fuchs
On Fri, 29 Apr 2022 12:29:35 GMT, Sibabrata Sahoo wrote: >> A new API to support replacing selective lines with desired content. > > Sibabrata Sahoo has updated the pull request incrementally with one > additional commit since the last revision: > > 8285452: updated to use lines()

Re: RFR: 8285452: Add a new test library API to replace a file content using FileUtils.java [v7]

2022-04-29 Thread Sibabrata Sahoo
> A new API to support replacing selective lines with desired content. Sibabrata Sahoo has updated the pull request incrementally with one additional commit since the last revision: 8285452: updated to use lines() - Changes: - all: