Skip to content

Commit

Permalink
refactor(prettyprinter): restore DJPP#writeHeaders that clients can o…
Browse files Browse the repository at this point in the history
…verride (#1866)
  • Loading branch information
monperrus authored and surli committed Feb 21, 2018
1 parent f15f058 commit dec66d3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,15 @@ private void reset() {
}
}


/**
* Write the compilation unit header.
*/
public DefaultJavaPrettyPrinter writeHeader(List<CtType<?>> types, Collection<CtImport> imports) {
elementPrinterHelper.writeHeader(types, imports);
return this;
}

@Override
public void calculate(CompilationUnit sourceCompilationUnit, List<CtType<?>> types) {
// reset the importsContext to avoid errors with multiple CU
Expand All @@ -1975,7 +1984,7 @@ public void calculate(CompilationUnit sourceCompilationUnit, List<CtType<?>> typ
for (CtType<?> t : types) {
imports.addAll(computeImports(t));
}
elementPrinterHelper.writeHeader(types, imports);
this.writeHeader(types, imports);
for (CtType<?> t : types) {
scan(t);
if (!env.isPreserveLineNumbers()) {
Expand Down

0 comments on commit dec66d3

Please sign in to comment.