On Tue, 17 May 2022 20:25:22 GMT, Phil Race <p...@openjdk.org> wrote:

>> Alisen Chung has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   renamed test, renamed some methods, updated error messages, updated test
>
> src/java.desktop/share/classes/javax/swing/border/EtchedBorder.java line 159:
> 
>> 157:         int stkWidth = 1;
>> 158:         if (g instanceof Graphics2D) {
>> 159:             at = ((Graphics2D) g).getTransform();
> 
> We more usually write
> Graphics2D g2d = (Graphics2D)g
> 
> then just use g2d instead of repeated casting.

This could even use pattern matching:

        if (g instanceof Graphics2D g2d) {
            at = g2d.getTransform();

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

PR: https://git.openjdk.java.net/jdk/pull/7449

Reply via email to