RFR: 8310072: JComboBox/DisabledComboBoxFontTestAuto: Enabled and disabled ComboBox does not match in these LAFs: GTK+ [v3]
Tejesh R
tr at openjdk.org
Wed Apr 17 06:24:00 UTC 2024
On Wed, 17 Apr 2024 06:09:32 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:
>> I meant to use `&&` so that comparisons for failure case fails faster than `||`.
>> Similar to this:
>> ` if ((c1.getRed() == c2.getRed())
>> && (c1.getBlue() == c2.getBlue())
>> && (c1.getGreen() == c2.getGreen())) {
>> return true;
>>
>> } else {
>>
>> System.out.println(lafName + " Enabled RGB failure: "
>> + c1.getRed() + ", "
>> + c1.getBlue() + ", "
>> + c1.getGreen() + " vs "
>> + c2.getRed() + ", "
>> + c2.getBlue() + ", "
>> + c2.getGreen());
>> return false;
>> }`
>
> The logical || operator doesn't check second condition if first condition is true. It checks second condition only if first one is false.
> So as per current logic, if RED component is not equal, it doesn't check for GREEN and BLUE component and fails.
Exactly, similar thing applies to && and hence in failure condition || checks for all the colors while && drops off at first failure only. Which is why I suggested it would be better for failure cases.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18644#discussion_r1568282858
More information about the client-libs-dev
mailing list