Error formatting long string literal that contains "...\\t"
In version n1.24.0 of google-java-format_windows-x86-64.exe a long string literal that contains two backslashes followed by 't' results in an error.
Negative example:
String t =
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\\t";
Tool invocation and error message:
$ google-java-format_windows-x86-64.exe -r --skip-removing-unused-imports test\Test.java
Test.java:29:7: error: unclosed string literal
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\\t";
Positive example. This can be formatted.
String s = "01234567890123456789012345678901234567890123456789\\t";
Update: Using parameter --skip-reflowing-long-strings avoids this error!
I'm also hitting this issue on v1.22. Notably the error also goes away if you manually reflow the string so that it complies with line length limitations.
Issue is still happening in 1.25.2
Seems to have something to do with the length, the backslashes, and case of the characters. Here are some positive and negative cases.
// This one works
String test = "AB\\ABCDEFGH\\ABCDEFGHIJKLMNO\\ABCEFGHIJLMNPQRSTUV\\TRUNK\\SRC\\MAIN\\WEBAPP\\WEB-INF\\ABC";
// This one does NOT
String test = "ab\\abcdefgh\\abcdefghijklmno\\abcefghijlmnpqrstuv\\trunk\\src\\main\\webapp\\web-inf\\abc";
// This one works
String test = "ab\\abcdefgh\\abcdefghijklmno\\abcefghijlmnpqrstuv\\trunk\\src\\main\\webapp\\web-inf\\ab";
// This one works
String test = "12\\12345678\\123456789012345\\1234567890123456789\\12345\\123\\1234\\123456\\1234567\\123";