RFR: 6434110: Color constructor parameter name is misleading [v2]
Alexey Ivanov
aivanov at openjdk.org
Tue Feb 17 19:46:32 UTC 2026
On Tue, 17 Feb 2026 19:10:29 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> Small cleanup: the parameter names in the Color(int, boolean) constructor have been renamed:
>> - rgba -> argb, since this is the format described in the spec
>> - hasalpha -> hasAlpha, to follow common naming conventions
>>
>> Also adds a basic test for the constructor.
>
> Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision:
>
> review feedback
src/java.desktop/share/classes/java/awt/Color.java line 337:
> 335: * on finding the best match given the color space
> 336: * available for a given output device.
> 337: * Alpha defaults to 255.
I think it's better this way, but I'll leave it to Phil.
test/jdk/java/awt/ColorClass/ColorARGBConstructorTest.java line 49:
> 47: int expA = hasAlpha ? (argb >>> 24) : 0xFF;
> 48: int expR = (argb >> 16) & 0xFF;
> 49: int expG = (argb >> 8) & 0xFF;
This was not what I meant:
Suggestion:
int expA = hasAlpha ? (argb >>> 24) : 0xFF;
int expR = (argb >>> 16);
int expG = (argb >>> 8);
or
Suggestion:
int expA = hasAlpha ? ((argb >> 24) & 0xFF) : 0xFF;
int expR = (argb >> 16) & 0xFF;
int expG = (argb >> 8) & 0xFF;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29734#discussion_r2818761015
PR Review Comment: https://git.openjdk.org/jdk/pull/29734#discussion_r2818758144
More information about the client-libs-dev
mailing list