RFR: 8254861: reformat code in vmTestbase/nsk/jdb [v2]

Chris Plummer cjplummer at openjdk.java.net
Wed Oct 21 21:56:11 UTC 2020


On Wed, 21 Oct 2020 21:10:54 GMT, Igor Ignatyev <iignatyev at openjdk.org> wrote:

>> Do you plan on leaving these indented 8 instead of 4 because that's what IDEA defaults to? Other editors, like emacs, will want to indent them 4, and will do so often do so automatically just by editing the line, depending on whether you type any character that forces reformatting of indentation.
>> 
>> Do we have coding  guidelines that say to indent them 8?
>
>> Do we have coding guidelines that say to indent them 8?
> 
> old "official" guidelines don't tell much about it,  @aioobe's guidelines don't special-case array initiation, so it is covered by:
>> A continuation line should be indented in one of the following four ways
>> Variant 1: With 8 extra spaces relative to the indentation of the previous line.
>> Variant 2: With 8 extra spaces relative to the starting column of the wrapped expression.
>> Variant 3: Aligned with previous sibling expression (as long as it is clear that it’s a continuation line)
>> Variant 4: Aligned with previous method call in a chained expression. 
> 
> which will suggest that 8 is the right indent here. 
> 
> google's code-style says that "array initializer may _optionally_ be formatted as if it were a "block-like construct.", which would mean 4, but note "may" and "_optionally_". personally I'd prefer consistency here, but if you think it will make the lives of emacs-lovers miserable, although I'm sure you can configure emacs to treat array-init as line continuation, and not as a block, I can revert that.

I don't consider this to be a continuation line. It just looks too much like a statement block.

My other concern is too much seemingly arbitrary reformatting. I really don't like the idea of reformatting an entire file based on some formatter's notion of what is best or correct, leading to unnecessary reformatting like this one. It muddles the history. The exception would be for a file that is hopelessly formatted incorrectly, like using 2-char indentation instead of 4 in java, or 4 char instead of 2 in C.

-------------

PR: https://git.openjdk.java.net/jdk/pull/689


More information about the serviceability-dev mailing list