You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-idempotent and non-convergent formatting of parentheses placement near line-level comments #914
publicclassFoo {
publicstaticvoidtestMethod() {
varsomething1 =
something2 + // comment line 1// comment line 2
(something3);
}
}
Output 1:
publicclassFoo {
publicstaticvoidtestMethod() {
varsomething1 =
something2 + // comment line 1
(// comment line 2something3);
}
}
Input 2 is identical to Output 1.
Output 2 is identical to Input 1.
This especially becomes noticeable when paired with googleJavaFormat().reflowLongStrings() in the Spotless Gradle plugin, which often breaks single-line comments into multiple lines.
Example 2:
This example cannot be reproduced in https://www.jhipster.tech/prettier-java/playground with its default settings, but it occurs when running prettier --plugin prettier-plugin-java --write test.java on a file directly. In the Playground, setting --arrow-parens to avoid also causes it to be reproducible, but according to prettier --plugin prettier-plugin-java --help | grep arrow -A1, the default for this setting is always, as the Playground shows as its default.
Input 1:
publicclassFoo {
publicstaticvoidtestMethod() {
varsomething1 = Optional.ofNullable(null).map(
(something2) -> // Allocate the jaguar to the treestump.
(Set<String>) Sets.union(ImmutableSet.of(something), SOME_SET_OF_THINGS)
);
}
}
Output 1:
publicclassFoo {
publicstaticvoidtestMethod() {
varsomething1 = Optional.ofNullable(null).map(
something2 -> // Allocate the jaguar to the treestump.
(Set<String>) Sets.union(ImmutableSet.of(something), SOME_SET_OF_THINGS)
);
}
}
Activity