Skip to content

Different formatting for switch comments depending on JDK version #1127

Description

@msridhar

Input:

class TestSwitch {
  enum TestEnum {
    ONE,
    TWO
  }

  void test(TestEnum e) {
    switch (e) {
      case ONE:
        System.out.println("one");
        break;
        // test comment
      default:
        System.out.println("default");
    }
  }
}

If I run GJF 1.23.0 on JDK 11 for this input, the formatting is unchanged. But, if I run it on JDK 17 or higher, the indentation of the // test comment line is changed to match that of default:. Is this expected behavior? Seems related to f7543b2.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions