Skip to content

Commit 6190b6e

Browse files
JessicaJHeergrunber
authored andcommitted
Add setting for string concatenations to text block conversion
Signed-off-by: Jessica He <[email protected]>
1 parent f2ab6ea commit 6190b6e

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

document/_java.learnMoreAboutCleanUps.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,30 @@ becomes:
121121
public boolean isAGoat() {
122122
return false;
123123
}
124+
```
125+
126+
### `stringConcatToTextBlock`
127+
128+
Appropriate String concatenations will be converted into Java `Text Blocks`. Appropriate String concatenations must have at least 3 non-empty substrings with one per line and the Java level must be 15 or higher. Line comments for all substrings but the last line will be lost after conversion. Spaces at the end of substrings preceding the newline will result in `\s` being substituted while substrings that do not end with newlines will have a `\` added at the end of the line to preserve concatenation.
129+
130+
For example:
131+
132+
```java
133+
String x = "" +
134+
"public class A {\n" +
135+
" public void m() {\n" +
136+
" System.out.println(\"abc\");\n" +
137+
" }\n" +
138+
"}";
139+
```
140+
141+
becomes:
142+
143+
```java
144+
String x = """
145+
public class A {
146+
public void m() {
147+
System.out.println("abc");
148+
}
149+
}""";
124150
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,8 @@
10071007
"qualifyMembers",
10081008
"qualifyStaticMembers",
10091009
"addOverride",
1010-
"addDeprecated"
1010+
"addDeprecated",
1011+
"stringConcatToTextBlock"
10111012
]
10121013
},
10131014
"default": [],

0 commit comments

Comments
 (0)