google / google/error-prone

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

Open
#5,142 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.