[jOOQ/jOOQ#9276] Consistently use same line terminators in generator

Also for the import list the Java / Scala generators now use the
configured line terminator rather than a hardcoded  terminator.
This commit is contained in:
Lukas Eder 2019-09-26 10:42:28 +02:00
parent b2fa9936b8
commit f1568d475a
2 changed files with 10 additions and 2 deletions

View File

@ -105,10 +105,18 @@ public abstract class GeneratorWriter<W extends GeneratorWriter<W>> {
this.files.mkdirs(file.getParentFile());
}
public String tabString() {
return tabString;
}
public void tabString(String string) {
this.tabString = string.replace("\\t", "\t");
}
public String newlineString() {
return newlineString;
}
public void newlineString(String string) {
this.newlineString = string.replace("\\n", "\n").replace("\\r", "\r");
}

View File

@ -207,11 +207,11 @@ public class JavaWriter extends GeneratorWriter<JavaWriter> {
String topLevelPackage = imp.split("\\.")[0];
if (!topLevelPackage.equals(previous))
importString.append("\n");
importString.append(newlineString());
importString.append("import ")
.append(imp)
.append(isScala ? "\n" : ";\n");
.append(isScala ? "" : ";").append(newlineString());
previous = topLevelPackage;
}