On Fri, 29 Apr 2022 13:02:06 GMT, Weijun Wang <wei...@openjdk.org> 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 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 wrong lines.

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<String>` that could be called with each line removed, and the caller 
could interrupt the parsing by returning false when it detects a mismatch with 
what they expect.


PR: https://git.openjdk.java.net/jdk/pull/8360

Reply via email to