Skip to content

Commit

Permalink
refactor(SniperJavaPrettyPrinter): fully specify options in the const…
Browse files Browse the repository at this point in the history
…ructor of SniperPrettyPrinter (#3197)
  • Loading branch information
monperrus authored and nharrand committed Jan 9, 2020
1 parent e45e082 commit 23456ec
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public SniperJavaPrettyPrinter(Environment env) {
mutableTokenWriter = new MutableTokenWriter(env);
//wrap that TokenWriter to listen on all incoming events and set wrapped version to DJPP
setPrinterTokenWriter(createTokenWriterListener(mutableTokenWriter));

// newly added elements are not fully qualified
this.setIgnoreImplicit(false);
}

/**
Expand Down Expand Up @@ -193,12 +196,11 @@ private static boolean hasImplicitAncestor(CtElement el) {
}

/**
* SniperPrettyPrinter does not apply preprocessor to a CtElement when calling toString()
* @param element
* @return
* Prints an element in sniper mode
*/
@Override
public String printElement(CtElement element) {
applyPreProcessors(element);
if (element != null && !hasImplicitAncestor(element)) {
CompilationUnit compilationUnit = element.getPosition().getCompilationUnit();
if (compilationUnit != null
Expand Down

0 comments on commit 23456ec

Please sign in to comment.