Skip to content

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

Open
@scch-michael-pfeiffer

Description

@scch-michael-pfeiffer

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions