google-java-format
google-java-format copied to clipboard
Text blocks should be indented
To reproduce:
- build 2ddcfd392cc5e45eaa5fb30c723b7e024f5caabb with
mvn clean verify - create
Foo.javain core\target, containing 2 identical strings:
class Foo {
private static final String FMT_B = "........ .. . ........ .. .... . .... . .. . ...................\n" +
".. . .. . . .. .. . ......... . .. . .. .. . .. . . .. . . .. ........ ......\n" +
".. . .. . . .. .. . ......... . .. . ........ ....... .. .. . . . .. . ......\n" +
".............. ..... .. . . .. . . . .. . . . . . .. . . . . .. . . .. .. . .\n";
private static final String FMT_C = """
........ .. . ........ .. .... . .... . .. . ...................
.. . .. . . .. .. . ......... . .. . .. .. . .. . . .. . . .. ........ ......
.. . .. . . .. .. . ......... . .. . ........ ....... .. .. . . . .. . ......
.............. ..... .. . . .. . . . .. . . . . . .. . . . . .. . . .. .. . .
""";
}
- in core\target, run
java -jar google-java-format-1.9-SNAPSHOT-all-deps.jar Foo.java - I'd expect 2 things here:
- the text block is indented the same as the multi-line string
- the opening
"""is on the same line as the declaration
Expected output:
class Foo {
private static final String FMT_B =
"........ .. . ........ .. .... . .... . .. . ...................\n"
+ ".. . .. . . .. .. . ......... . .. . .. .. . .. . . .. . . .. ........ ......\n"
+ ".. . .. . . .. .. . ......... . .. . ........ ....... .. .. . . . .. . ......\n"
+ ".............. ..... .. . . .. . . . .. . . . . . .. . . . . .. . . .. .. . .\n";
private static final String FMT_C = """
........ .. . ........ .. .... . .... . .. . ...................
.. . .. . . .. .. . ......... . .. . .. .. . .. . . .. . . .. ........ ......
.. . .. . . .. .. . ......... . .. . ........ ....... .. .. . . . .. . ......
.............. ..... .. . . .. . . . .. . . . . . .. . . . . .. . . .. .. . .
""";
}
Actual output:
class Foo {
private static final String FMT_B =
"........ .. . ........ .. .... . .... . .. . ...................\n"
+ ".. . .. . . .. .. . ......... . .. . .. .. . .. . . .. . . .. ........ ......\n"
+ ".. . .. . . .. .. . ......... . .. . ........ ....... .. .. . . . .. . ......\n"
+ ".............. ..... .. . . .. . . . .. . . . . . .. . . . . .. . . .. .. . .\n";
private static final String FMT_C =
"""
........ .. . ........ .. .... . .... . .. . ...................
.. . .. . . .. .. . ......... . .. . .. .. . .. . . .. . . .. ........ ......
.. . .. . . .. .. . ......... . .. . ........ ....... .. .. . . . .. . ......
.............. ..... .. . . .. . . . .. . . . . . .. . . . . .. . . .. .. . .
""";
}