Thanks to visit codestin.com
Credit goes to github.com

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions