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
Cleanup pass: remove parentheses around a single untyped lambda parameter #216
google-java-format#1505 (merged 2026-10-29, copybara export) teaches the --cleanup pass to rewrite (x) -> x as x -> x. Comments inside the parentheses are preserved, and a space is added when the opening parenthesis follows an identifier (return(x) -> x). It answers the old request google-java-format#762, which was closed on 2026-10-29.
Why it matters: a common style nit that our formatter leaves alone. Like the other cleanup tickets it only makes sense if we add an AST cleanup pass.
Before (upstream behaviour before the change; I believe ours keeps the parentheses but did not run it):
classT {
Function<Integer, Integer> f = (x) -> x + 1;
Runnabler = () -> {};
}
After (with the change, from the upstream description):
classT {
Function<Integer, Integer> f = x -> x + 1;
Runnabler = () -> {};
}
Affected files in our repo:
open-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java (where a cleanup pass would be wired in)
Suggested action: watch together with the other cleanup tickets; only typed or multi-parameter lambdas must keep their parentheses.
Filed from an upstream-watch ticket after manual review.
Activity