1
1
/*
2
- * Copyright 2023 DiffPlug
2
+ * Copyright 2023-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
21
21
22
22
import com .diffplug .spotless .FormatterFunc ;
23
23
import com .diffplug .spotless .FormatterStep ;
24
+ import com .diffplug .spotless .RoundedStep ;
24
25
25
26
/**
26
27
* Removes all semicolons from the end of lines.
27
28
*
28
29
* @author Jose Luis Badano
29
30
*/
30
- public final class RemoveSemicolonsStep {
31
+ public final class RemoveSemicolonsStep implements RoundedStep {
32
+ private static final long serialVersionUID = 1L ;
31
33
private static final String NAME = "Remove unnecessary semicolons" ;
32
34
33
35
private RemoveSemicolonsStep () {
34
36
// do not instantiate
35
37
}
36
38
37
39
public static FormatterStep create () {
38
- return FormatterStep .createLazy (NAME ,
39
- State :: new ,
40
- RemoveSemicolonsStep . State ::toFormatter );
40
+ return FormatterStep .create (NAME ,
41
+ new State () ,
42
+ State ::toFormatter );
41
43
}
42
44
43
45
private static final class State implements Serializable {
@@ -64,7 +66,7 @@ FormatterFunc toFormatter() {
64
66
* @return the line without the last semicolon
65
67
*/
66
68
private String removeSemicolon (String line ) {
67
- // find last semicolon in a string a remove it
69
+ // Find the last semicolon in a string and remove it.
68
70
int lastSemicolon = line .lastIndexOf (";" );
69
71
if (lastSemicolon != -1 && lastSemicolon == line .length () - 1 ) {
70
72
return line .substring (0 , lastSemicolon );
0 commit comments