error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

`MisleadingEscapedSpace` false positive with `CRLF` line separator in sources

Open spadou opened this issue 6 months ago • 0 comments

Using errorprone 2.39.0, with the following code:

String test = """
  test\s
  test
  """;

If the java source file have LF line separators nothing is detected, but if the source file contains CRLF line separators instead errorprone detect a MisleadingEscapedSpace error.

Looks like the detection is working on sources and only checking for \n, so it will detect a false positive if sources have CRLF endings like so \s\r\n.

Not sure of the case where the sources would have LF endings, but with explicit \r\n in the string/text block. I guess it would also detect an issue in this case but it is probably ok as a simple space could be used in this case.

spadou avatar Jul 08 '25 17:07 spadou