prettier-java icon indicating copy to clipboard operation
prettier-java copied to clipboard

fix: align with JDK 22 spec

Open jtkiesel opened this issue 10 months ago • 0 comments

What changed with this PR:

Aligns the parser more closely with the JDK 22 spec, most notably fixing some rules that weren't properly supporting unnamed variables.

Example

Input

public sealed interface SadPanda {

  default String cry() {
    return switch(this) {
      case A _, B _, C _ -> "A lot";
    };
  }

  record A() implements SadPanda {}
  record B() implements SadPanda {}
  record C() implements SadPanda {}
}

Output

public sealed interface SadPanda {
  default String cry() {
    return switch (this) {
      case A _, B _, C _ -> "A lot";
    };
  }

  record A() implements SadPanda {}

  record B() implements SadPanda {}

  record C() implements SadPanda {}
}

Relative issues or prs:

Closes #665

jtkiesel avatar May 01 '24 07:05 jtkiesel