Skip to content

Commit 0c5d1b6

Browse files
committed
Don't use Java 11 APIs
1 parent 6d76fc9 commit 0c5d1b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/src/main/java/com/diffplug/spotless/java/TypeAnnotationsStep.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ String fixupTypeAnnotations(String unixStr) {
421421
continue;
422422
}
423423
lines[i] = "";
424-
lines[i + 1] = line.stripTrailing() + " " + nextLine.stripLeading();
424+
lines[i + 1] = line.replaceAll("\\s+$", "") + " " + nextLine.replaceAll("^\\s+", "");
425425
}
426426
}
427427
return String.join("", lines);
@@ -432,7 +432,7 @@ String fixupTypeAnnotations(String unixStr) {
432432
*/
433433
boolean endsWithTypeAnnotation(String unixLine) {
434434
// Remove trailing newline.
435-
String line = unixLine.stripTrailing();
435+
String line = unixLine.replaceAll("\\s+$", "");
436436
Matcher m = trailingAnnoPattern.matcher(line);
437437
if (!m.find()) {
438438
return false;

0 commit comments

Comments
 (0)