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

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


On Thu, 11 Sep 2025 03:55:25 GMT, Renjith Kannath Pariyangad <rkannathpari at openjdk.org> wrote:

>> test/jdk/javax/swing/SwingUtilities/8365379/bug8365379.java line 33:
>> 
>>> 31:  * @bug 8365379
>>> 32:  * @summary Verify LineBorder edges have the same width
>>> 33:  * @modules java.desktop/com.sun.java.swing
>> 
>> Can we verify it w/o using internals?
>
> As you are aware existing calculation will go wrong only for non zero X & Y. As far as my understanding existing calls passing 0,0 as X,Y. so I did not find any other way w/o using internals. 
> 
> FYI : summary was wrong that I have corrected.
> 
> Let me know if you have any suggestions.

> Can we verify it w/o using internals?

This method is used menu rendering. All the current usages pass rectangles where `x` and `y` are zeros, so the existing code works correctly.

Yet the code in the method will produce wrong result if the `x` and `y` aren't equal to zero.

Since there are no other usages, it's impossible to reproduce the bug. Now that the method resides in `SwingUtilities3`, it's not localised its current usages, and if anyone uses the method, the result may be wrong.

This test is like a unit test that ensures the `applyInsets` method returns the correct and expected result with any parameters.

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

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


More information about the client-libs-dev mailing list