Skip to content

Conversation

@jtkiesel
Copy link
Contributor

@jtkiesel jtkiesel commented Sep 8, 2025

What changed with this PR:

Certain method invocations containing lambda arguments with bodies no longer have their arguments double-indented.

This includes a minor change to templates as well, but those were a preview feature and are no longer supported by Java, plus the change makes the formatting of them more consistent.

Example

Input

class Example {

  void example() {
    A.b().c(() -> {
      return d;
    });

    this.a(
      aaaaaaaaaaaaaaaaaaaaaaaaaa,
      bbbbbbbbbbbbbbbbbbbbbbbbbb,
      cccccccccccccccccccccccccc,
      dddddddddddddddddddddddddd,
      e -> {
        return f;
      }
    );
  }
}

Output

class Example {

  void example() {
    A.b().c(() -> {
      return d;
    });

    this.a(
      aaaaaaaaaaaaaaaaaaaaaaaaaa,
      bbbbbbbbbbbbbbbbbbbbbbbbbb,
      cccccccccccccccccccccccccc,
      dddddddddddddddddddddddddd,
      e -> {
        return f;
      }
    );
  }
}

Relative issues or prs:

Closes #760
Closes #764

@jtkiesel jtkiesel force-pushed the fix/method-chain-lambda-argument-indentation branch from 805def9 to 14f4c58 Compare September 8, 2025 08:08
@jtkiesel jtkiesel changed the title fix: correct indentation of lambda argument bodies in method chains fix: correct indentation of some method argument lists containing lambda bodies Sep 8, 2025
@jtkiesel jtkiesel merged commit 171f611 into jhipster:main Sep 8, 2025
6 checks passed
@jtkiesel jtkiesel deleted the fix/method-chain-lambda-argument-indentation branch September 8, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Double-indentation of method arguments Double-indentation in lambda

1 participant