Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ public class Processor extends AbstractProcessor {

private static final String JSON_MAPPERS_PROPERTIES_PATH = "META-INF/vertx/json-mappers.properties";

/**
* Converts the line endings of generated files to the local OS' line endings, so regenerated
* files don't show up as modified in Git diffs and IDEs. No-op when the separator is LF.
*/
private static final UnaryOperator<String> CONVERT_TO_LOCAL_LINE_SEPARATOR = localLineSeparatorConverter();
// Converts the line endings of generated files to the local OS' line endings
// so regenerated files don't show up as modified in Git diffs and IDEs
private static final Pattern LINE_BREAK_PATTERN = Pattern.compile("\\r\\n|\\r|\\n");
private static final UnaryOperator<String> CONVERT_TO_LOCAL_LINE_SEPARATOR = content -> LINE_BREAK_PATTERN.matcher(content).replaceAll(System.lineSeparator());

private File outputDirectory;
private List<? extends Generator<?>> codeGenerators;
Expand Down Expand Up @@ -349,13 +348,6 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
return true;
}

private static UnaryOperator<String> localLineSeparatorConverter() {
if ("\n".equals(System.lineSeparator())) {
return UnaryOperator.identity();
}
return content -> content.replaceAll("\n", System.lineSeparator());
}

private void reportGenException(GenException e) {
String name = e.element.toString();
if (e.element.getKind() == ElementKind.METHOD) {
Expand Down