On Tue, 17 May 2022 20:38:07 GMT, Alexey Ivanov <[email protected]> wrote:
>> 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();
I thought about that but (1) couldn't remember off-hand if it was still
preview, (2) I was sure it would impede a backport ...
-------------
PR: https://git.openjdk.java.net/jdk/pull/7449