git cl format indents calls on anonymous classes in Java |
||||
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/)
,
Apr 11 2017
,
Apr 11 2017
Filed https://bugs.llvm.org/show_bug.cgi?id=32627 upstream.
,
May 9 2017
,
Jan 4 2018
,
Jul 11
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
,
Oct 10
Issue 894056 has been merged into this issue.
,
Nov 21
,
Nov 26
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 |
||||
Comment 1 by nyquist@chromium.org
, Apr 11 2017Owner: thakis@chromium.org