Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error formatting long string literal that contains "...\\t" #1186

Open
scch-michael-pfeiffer opened this issue Nov 12, 2024 · 0 comments
Open

Comments

@scch-michael-pfeiffer
Copy link

scch-michael-pfeiffer commented Nov 12, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant