Skip to content

Commit

Permalink
Remove static init block for newline pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbosch committed Sep 20, 2017
1 parent 5b6aa3c commit 37029d8
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -29,6 +29,9 @@
import com.github.javaparser.Position;

public class SourcePrinter {

private static final Pattern NEWLINE_PATTERN = Pattern.compile("\r\n|\r|\n");

private final String indentation;
private final String endOfLineCharacter;
private int level = 0;
Expand Down Expand Up @@ -85,13 +88,8 @@ private StringBuilder bufAppend(final String arg) {
return buf.append(arg);
}

private static final Pattern SPLIT_NEWLINE_PATTERN;
static {
SPLIT_NEWLINE_PATTERN = Pattern.compile("\r\n|\r|\n");
}

private void updateCursor(String arg) {
String[] lines = SPLIT_NEWLINE_PATTERN.split(arg);
String[] lines = NEWLINE_PATTERN.split(arg);
if ( lines.length == 0 ) {
cursor = Position.pos(cursor.line + 1, 0);
} else if ( lines.length == 1 ) {
Expand Down

0 comments on commit 37029d8

Please sign in to comment.