Package org.openrewrite.java.service
Class AutoFormatService
java.lang.Object
org.openrewrite.java.service.AutoFormatService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<P> JavaVisitor<P> autoFormatVisitor(@Nullable org.openrewrite.Tree stopAfter) <P> JavaVisitor<P> blankLinesVisitor(org.openrewrite.SourceFile sourceFile, @Nullable org.openrewrite.Tree stopAfter) Returns the language-appropriateBlankLinesVisitor.<P> JavaVisitor<P> normalizeFormatVisitor(@Nullable org.openrewrite.Tree stopAfter) Returns the language-appropriateNormalizeFormatVisitor.
-
Constructor Details
-
AutoFormatService
public AutoFormatService()
-
-
Method Details
-
autoFormatVisitor
-
normalizeFormatVisitor
Returns the language-appropriateNormalizeFormatVisitor. Edit recipes that mutate an LST node — e.g. by removing a leading annotation — can leave whitespace stranded on inner elements (modifier/kind prefixes), violating the "whitespace lives on the outermost element" convention. Running this visitor on the result moves the whitespace back to the outermost element so downstream passes (BlankLinesVisitorin particular) can normalize it. -
blankLinesVisitor
public <P> JavaVisitor<P> blankLinesVisitor(org.openrewrite.SourceFile sourceFile, @Nullable org.openrewrite.Tree stopAfter) Returns the language-appropriateBlankLinesVisitor.
-