Note that it uses the jdk.compiler module to parse the Java source code. The java binary version used must therefore be from a JDK (not JRE) with a version equal to or newer than the Java language ...
if you don't like how the formatter laid out your code, you may need to introduce new functions/variables the formatter is not as clever as humans are, so it can sometimes produce less readable code ...