Prettier-Java 2.7.3
# Options (if any):
(no options)
Input:
public static void formatTest() throws IOException {
try (var object = new ByteArrayOutputStream()) {
var test = 1;
}
try (
var objectWithALongerNameThatCausesABreak = new ByteArrayOutputStream()
) {
var test = 1;
}
}
Output:
public static void formatTest() throws IOException {
try (var object = new ByteArrayOutputStream()) {
var test = 1;
}
try (
var objectWithALongerNameThatCausesABreak = new ByteArrayOutputStream();
) {
var test = 1;
}
}
Expected behavior:
The semicolon at the end of the resource declaration statement is unnecessary. The "Unnecessary semicolon" inspection in IDEA reports it as a Weak Warning, with no option to disable the inspection for just this particular case. The formatter should, at minimum, probably not add a semicolon in this context. Whether it ought to remove an existing one is more debatable.
Prettier-Java 2.7.3
# Options (if any): (no options)Input:
Output:
Expected behavior:
The semicolon at the end of the resource declaration statement is unnecessary. The "Unnecessary semicolon" inspection in IDEA reports it as a Weak Warning, with no option to disable the inspection for just this particular case. The formatter should, at minimum, probably not add a semicolon in this context. Whether it ought to remove an existing one is more debatable.