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

Issue 710441 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 26
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocked on:
issue 768586



Sign in to add a comment

git cl format indents calls on anonymous classes in Java

Project Member Reported by awdf@chromium.org, Apr 11 2017

Issue description

It adds a linebreak and indents by 8 which looks odd.

For example - run 'git cl format' on the following:

            new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... params) {
                    // Stuff here
                    return null;
                }
            }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);


It gets 'corrected' to:
            new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... params) {
                    // Stuff here
                    return null;
                }
            }
                    .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);

Maybe this is working as intended but it looks weird to me & my reviewer (https://codereview.chromium.org/2807213002/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/DeferredStartupHandler.java)

Edit: This seems to be caused by clang-format, will re-file this on their bug tracker when I am granted an account (https://bugs.llvm.org/)

 
Cc: awdf@chromium.org
Owner: thakis@chromium.org
thakis: PTAL

awdf: According to https://chromium.googlesource.com/chromium/src/+/master/docs/clang_format.md#Reporting-problems I think you filed this mostly the appropriate way, except not using their pre-filled form (see their bug-link).

Since this is Java though, I think we're also supposed to inform java@chromium.org to ensure that style guide owners agree. Could you send an e-mail there?

Comment 2 by thakis@chromium.org, Apr 11 2017

Labels: clang-format OS-Android
Cc: thakis@chromium.org nick@chromium.org
 Issue 719964  has been merged into this issue.
Components: -Infra>Codereview
Hey, I just ran into this. I am doing an AsyncTask refactor that will touch a lot of callsites and make a bunch of these executeOnExecutor() calls go from the nice old version to the "corrected" newline + indent. I'm fine to leave it, since I don't want to get clang-format building, do research, then work on a CL and try to get it submitted.

I checked it out, and on 4.0.1, it formats as we like, but in all later versions it formats the "new" way.

I have filed an internal bug against ClangFormat to see if they can help us out. b/111363403
 Issue 894056  has been merged into this issue.
Blockedon: 768586
Looks like yesterday's clang-format roll fixed this.
Status: Fixed (was: Assigned)
A clang-format with the fix got deployed on Nov 21 2018.

(I don't know which upstream revision fixed it; it wasn't me.)

Sign in to add a comment