On Tue, 21 Feb 2023 23:10:44 GMT, SWinxy <d...@openjdk.org> wrote:

>> Damon Nguyen has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Add instanceof check
>
> src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java line 344:
> 
>> 342:         final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
>> 343:         if (v != null && c instanceof AbstractButton
>> 344:                 && ((AbstractButton) c).getIcon() == null) {
> 
> We already know for certain that `c` is an AbstractButton. The first thing in 
> the paint call, the component is casted. Why cast again when we can reuse the 
> variable:
> Suggestion:
> 
>         if (v != null && b.getIcon() == null) {
> 
> 
> (also on ln 309 we could do the same thing)

@SWinxy Looks cleaner. Thanks for the suggestion.

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

PR: https://git.openjdk.org/jdk/pull/12520

Reply via email to