Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4268

Switch statement formatting: do not force newlines

    XMLWordPrintableJSON

Details

    Description

      When running autoformat, concise code like

      String s(int i) {
          return switch (i) {
              case 1 -> "one";
              case 2 -> "two";
              default -> throw new UnsupportedOperationException();
          };
      }
      

      is replaced with

      String s(int i) {
          return switch (i) {
              case 1 ->
                  "one";
              case 2 ->
                  "two";
              default ->
                  throw new UnsupportedOperationException();
          };
      }
      

      which I find harder to read. I have not found a setting to disable this behaviour.

      Attachments

        Activity

          People

            Unassigned Unassigned
            striderapache dennis lucero
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: