RFR: 6434110: Color constructor parameter name is misleading [v3]
Sergey Bylokhov
serb at openjdk.org
Tue Feb 17 20:32:56 UTC 2026
On Tue, 17 Feb 2026 19:06:05 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> 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.
It actually handled by javadoc properly -> correct summary is generated, I tried to unify the text in the constructors and getRGB method.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29734#discussion_r2818940601
More information about the client-libs-dev
mailing list