I have class below and I would like to avoid constants reformatting inside of it. I've tried to use formatter:off
, but there is no luck
public class Test {
// @formatter:off
private static final String TEST_FIRST_NAME = "firstname";
private static final String TEST_SECOND_NAME = "secondname";
public static final Test1 TEST1 = new Test1(TEST_FIRST_NAME);
public static final Test2 TEST2 = new Test2(TEST_SECOND_NAME);
// @formatter:on
@Data
@AllArgsConstructor
static class Test1 {
private String name;
}
@Data
@AllArgsConstructor
static class Test2 {
private String name;
}
}
After reformatting constant change the order to:
// @formatter:off
private static final String TEST_FIRST_NAME = "firstname";
public static final Test1 TEST1 = new Test1(TEST_FIRST_NAME);
private static final String TEST_SECOND_NAME = "secondname";
public static final Test2 TEST2 = new Test2(TEST_SECOND_NAME);
// @formatter:on
Please advice how to avoid this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.