diff --git a/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java b/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java index 394d396d9..89c944c5b 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java +++ b/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java @@ -1250,7 +1250,10 @@ public Void visitLambdaExpression(LambdaExpressionTree node, Void unused) { token(","); builder.breakOp(" "); } - scan(parameter, null); + visitVariables( + ImmutableList.of(parameter), + DeclarationKind.NONE, + fieldAnnotationDirection(parameter.getModifiers())); first = false; } if (parens) { diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input new file mode 100644 index 000000000..0660079d7 --- /dev/null +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input @@ -0,0 +1,5 @@ +class I959 { + public void test() { + new File(".").listFiles((final var dir, final var name) -> true); + } +} \ No newline at end of file diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output new file mode 100644 index 000000000..76a07f48b --- /dev/null +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output @@ -0,0 +1,5 @@ +class I959 { + public void test() { + new File(".").listFiles((final var dir, final var name) -> true); + } +}