[OpenJDK 2D-Dev] RFR: 8263984: Invalidate printServices when there are no printers [v2]
Sergey Bylokhov
serb at openjdk.java.net
Thu Apr 1 17:32:25 UTC 2021
On Thu, 1 Apr 2021 13:28:50 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>>> 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?
>
>> I would prefer if you revert this line or if we want to put emphasis on readability moving '{' to new line also seems fine.
>
> Done.
I do not suggest that the change should be moved forth and back, but I think that the second conditions should always be shifted, and if this causes 80 chars overflow then some other line split/rename/etc should be done to prevent that.
Recent example of such style...:
if ((getColorSpaceType (p) == ColorSpace.TYPE_RGB) &&
(getData (p, icSigMediaWhitePointTag) != null) &&
(getData (p, icSigRedColorantTag) != null) &&
(getData (p, icSigGreenColorantTag) != null) &&
(getData (p, icSigBlueColorantTag) != null) &&
(getData (p, icSigRedTRCTag) != null) &&
(getData (p, icSigGreenTRCTag) != null) &&
(getData (p, icSigBlueTRCTag) != null)) {
thisProfile = new ICC_ProfileRGB (p);
Is that really looks fine?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3151
More information about the 2d-dev
mailing list