RFR: 8344063: Remove doPrivileged calls from swing classes in the java.desktop module
Phil Race
prr at openjdk.org
Thu Nov 14 18:44:48 UTC 2024
On Wed, 13 Nov 2024 23:28:42 GMT, Phil Race <prr at openjdk.org> wrote:
>> This is the first of a number of PRs to remove doPrivileged uses in client libraries.
>> These calls are obsolete dead code after JEP 486.
>>
>> I have run all our automated tests, including JCK tests, and manually tested SwingSet.
>>
>> One thing I might have missed in a couple of cases is that it seems that javac doesn't seem to notice if you leave an un-needed SuppressWarnings("removal") annotation.
>>
>> As per the bug report I am limiting (as much as I can) what I touch here to be just the immediate consequences of removing doPrivileged calls. These changes are plenty enough as it is.
>
> test/jdk/java/awt/im/memoryleak/InputContextMemoryLeakTest.java line 92:
>
>> 90: Util.waitForIdle(null);
>> 91: //After the next caret blink it automatically TextField references
>> 92: JTextField tf = text.get();
>
> You might ask why did this test need to be updated for this change ?
> I saw it fail twice - both on Windows, nowhere else - in my various test runs for this PR and so I am being cautious.
> Perhaps "timing" is subtly altered, but this test looks buggy to me.
> The failure was that the old line 88 got a null referent from text.get() causing an NPE.
> After it removes the panel at line 86 above, the text field has no strong ref and could be collected at any time, which would cause the NPE.
>
> I've updated the test to check.
FYI to others. I've now seen this test fail in a test of a change that has zero intersection with the changes here.
And another person reported the same for yet another change.
So it seems likely the SM removal is tickling this and I'm surprised it wasn't seen before.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842729440
More information about the client-libs-dev
mailing list