On Thu, 1 Apr 2021 13:10:40 GMT, Jayathirth D V <[email protected]> wrote:
>> By mapping i mean same indentation for all conditions in if statement
>> without adding additional indentation for each continuation line
>> like(Basically line without your change of indentation)
>> if ((condition1) &&
>> (condition2)) {
>> }
>>
>> or
>>
>> if ((condition1)
>> &&(condition2)) {
>> }
>>
>> I have not come across code in java.desktop where we add indentation at each
>> continuation line of 'if' condition.
>> I understand difficulty to scan without indentation but then in cases where
>> we have multiple lines on continuation line in if statement we will easily
>> hit 80 characters limit.
>>
>> If we want to differentiate between if conditions and actual statement
>> execution to improve readability, we can move the statement block to new
>> line like
>> if ((condition1) &&
>> (condition2))
>> {
>> }
>
> I would prefer if you revert this line or if we want to put emphasis on
> readability moving '{' to new line also seems fine.
> By mapping i mean same indentation for all conditions in if statement…
Okay, it's the first time I've come across to such a use of `map`.
> I have not come across code in java.desktop where we add indentation at each
> continuation line of 'if' condition.
Take a look at
[DefaultTableCellRenderer.getTableCellRendererComponent](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java#L201).
> I understand difficulty to scan without indentation but then in cases where
> we have multiple lines on continuation line in if statement we will easily
> hit 80 characters limit.
What is more important code readability or the strict limit of 80 columns?
All in all, all these styles are used throughout `java.desktop` module.
I chose to opt for readability in this particular case and the line fits into
80 column limit.
Do I revert the change to this line?
Any other suggestions? What is your preference?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3151