It would be nice if 'trailing white space will be removed' diagnostics for text blocks had a more precise diagnostic position, and also suggested what the fix was (to either remove the whitespace, or use an explicit \s if is deliberate and should be preserved).
Consider the following example where the line with 'hello' in the text block has trailing whitespace:
class T {
String s =
"""
hello
world
""";
}
$ javac -Xlint:all T.java
T.java:3: warning: [text-blocks] trailing white space will be removed
"""
^
1 warning
The suggested diagnostic would be something like:
$ javac -Xlint:all T.java
T.java:4: warning: [text-blocks] trailing white space will be removed. Either remove the trailing whitespace, or use \s if it is deliberate and should be preserved.
hello
^
1 warning
Consider the following example where the line with 'hello' in the text block has trailing whitespace:
class T {
String s =
"""
hello
world
""";
}
$ javac -Xlint:all T.java
T.java:3: warning: [text-blocks] trailing white space will be removed
"""
^
1 warning
The suggested diagnostic would be something like:
$ javac -Xlint:all T.java
T.java:4: warning: [text-blocks] trailing white space will be removed. Either remove the trailing whitespace, or use \s if it is deliberate and should be preserved.
hello
^
1 warning