Vineflower / vineflower

Modern Java decompiler aiming to be as accurate as possible, with an emphasis on output quality. Fork of the Fernflower decompiler.
https://vineflower.org/
Apache License 2.0
1.13k stars 83 forks source link

Fix indent on 'simple' switch branches #382

Closed jpenilla closed 2 months ago

jpenilla commented 2 months ago

The test case would previously decompile to

public class TestSwitchSimpleMultiLine {
   public static <T> Predicate<T> predicates() {
      int i = new Random().nextInt();// 8

      return switch (i) {// 9
         case 0 -> object -> true;// 10
         case 1 -> object -> false;// 11
         default -> object -> {
         boolean r1 = new Random().nextBoolean();// 13
         boolean r2 = new Random().nextBoolean();// 14
         return r1 && r2 ? true : new Random().nextBoolean();// 15 16 18
      };
      };
   }
}