Java Formatting (Google Java Format)

Elide comes with a built-in Java formatter. It is Google Java Format, but with native image technology it starts up faster and saves time, especially with smaller projects. You can use it via elide javaformat -- .... It is fully compatible and drop-in ready.

Note

There are no Elide-specific options before -- at this time. The -- separator is still required.

Examples

Fix an incorrectly formatted Java file:

java
// Hello.java
public class Hello {
public static void main(String[ ] args) 
{
    System.out.println("Hello!");}
}
bash
 elide javaformat -- -replace Hello.java && cat Hello.java
terminaloutput
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello!");
  }
}