RFR: 8365379: SU3.applyInsets may produce wrong results [v6]

Alexey Ivanov aivanov at openjdk.org
Fri Sep 12 18:56:18 UTC 2025


On Fri, 12 Sep 2025 02:57:27 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Renjith Kannath Pariyangad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Updated summary
>
> src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java line 558:
> 
>> 556:     static void applyInsets(Rectangle rect, Insets insets, boolean leftToRight) {
>> 557:         if (insets != null) {
>> 558:             Insets newInsets = new Insets(insets.top, (leftToRight ? insets.left : insets.right),
> 
> Maybe we can eliminate the creation of a new object on each paint event? Since neither method is part of the public API, how about changing the signature of SwingUtilities3.applyInsets and removing the corresponding method in SynthGraphicsUtils?"

Agreed. `SwingUtilities3` can easily have two methods: `applyInsets(Rectangle rect, Insets insets)` as well as `applyInsets(Rectangle rect, Insets insets, boolean leftToRight)` where the former calls the latter with `leftToRight = true`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27157#discussion_r2345136670


More information about the client-libs-dev mailing list