Skip to content

Regression in 2.8.0+ with ternaries in a lambda #805

@boris-petrov

Description

@boris-petrov

Prettier-Java 2.8.1

Playground link

--print-width 50

Input:

public abstract class Foo {
  public String foo() {
	foo(() -> aaaaaaaaaaa &&
		bbbbbbbbbb &&
		cccccccccccccc
			? 1
			: 2);
  }
}

Output:

public abstract class Foo {

	public String foo() {
		foo(() ->
			aaaaaaaaaaa &&
			bbbbbbbbbb &&
			cccccccccccccc
				? 1
				: 2
		);
	}
}

Expected behavior:

public abstract class Foo {

	public String foo() {
		foo(() ->
			aaaaaaaaaaa &&
				bbbbbbbbbb &&
				cccccccccccccc
				? 1
				: 2
		);
	}
}

Similar to #802.

cc @jtkiesel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions