New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 866014 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[java] clang-format mishandles lambdas in methods with multiple arguments

Project Member Reported by bsheedy@chromium.org, Jul 20

Issue description

Example: pollInstrumentationThread() calls in https://cs.chromium.org/chromium/src/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserControllerInputTest.java or attached screenshot.

If a lambda is passed as an argument to a method with multiple other arguments, clang-format adds unnecessary indentation and line breaks, reducing readability.

This issue doesn't seem to happen if the method only takes one additional argument besides the lambda, for example the pollUiThread call in https://cs.chromium.org/chromium/src/chrome/android/javatests/src/org/chromium/chrome/browser/vr/VrBrowserCompositorViewHolderTest.java
 
clang_format_lambda.png
14.8 KB View Download
Summary: [java] clang-format mishandles lambdas in methods with multiple arguments (was: clang-format mishandles lambdas in methods with multiple arguments)
Blockedon: 768586
Status: Fixed (was: Untriaged)
This appears to be fixed with the newest clang-format roll
Owner: smaier@chromium.org
Status: Assigned (was: Fixed)
Doesn't look like this is fixed :( Tried changing one of the affected lines in VrBrowserControllerInputTest then ran "git cl format". Still formats incorrectly.
Blockedon: -768586
Yep, I didn't test it with the right input. Copy-pastable test case:

CriteriaHelper.pollInstrumentationThread(() -> {
    return coord.getScrollYPixInt() > endScrollPoint.get();
}, "CompositorViewHolder width did not match the requested layout width", POLL_TIMEOUT_SHORT_MS, POLL_CHECK_INTERVAL_LONG_MS);


Currently gives:
CriteriaHelper.pollInstrumentationThread(
        ()
                -> { return coord.getScrollYPixInt() > endScrollPoint.get(); },
        "CompositorViewHolder width did not match the requested layout width",
        POLL_TIMEOUT_SHORT_MS, POLL_CHECK_INTERVAL_LONG_MS);


Cc: nick@chromium.org
 Issue 764582  has been merged into this issue.

Sign in to add a comment