[java] clang-format mishandles lambdas in methods with multiple arguments |
||||
Issue descriptionExample: 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
,
Nov 26
This appears to be fixed with the newest clang-format roll
,
Nov 27
Doesn't look like this is fixed :( Tried changing one of the affected lines in VrBrowserControllerInputTest then ran "git cl format". Still formats incorrectly.
,
Nov 27
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);
,
Nov 27
|
||||
►
Sign in to add a comment |
||||
Comment 1 by thakis@chromium.org
, Jul 20