RFR: 6434110: Color constructor parameter name is misleading [v2]

Sergey Bylokhov serb at openjdk.org
Tue Feb 17 19:10:31 UTC 2026


On Tue, 17 Feb 2026 15:50:16 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> 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 404:
> 
>> 402:      * the green component in bits 8-15, and the blue component in bits 0-7. If
>> 403:      * the {@code hasAlpha} argument is {@code false}, alpha is defaulted to
>> 404:      * 255.
> 
> Suggestion:
> 
>      * Creates an sRGB color with the specified combined ARGB value consisting of
>      * <ul>
>      *    <li>the alpha component in bits 24-31,</li>
>      *    <li>the red component in bits 16-23,</li>
>      *    <li>the green component in bits 8-15, and</li>
>      *    <li>the blue component in bits 0-7.</li>
>      * </ul>
>      * If the {@code hasAlpha} argument is {@code false}, alpha is defaulted to 255.
> 
> 
> What do you think about such formatting? Each color component stands out this way.
> 
> I'd also change the last sentence to _“alpha defaults to 255.”_
> 
> However, changing the formatting for this constructor will require changing the formatting for `Color(int rgb)`. And it will break the first sentence summary displayed in the table of contructors methods.

I'll experiment with this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29734#discussion_r2818620545


More information about the client-libs-dev mailing list