RFR: JDK-8297414: Remove easy warnings in javafx.controls [v3]

Andy Goryachev angorya at openjdk.org
Wed Nov 23 23:25:29 UTC 2022


On Wed, 23 Nov 2022 23:14:52 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> I can replace these with an assert:
>> 
>>     assertTrue(Toolkit.getToolkit() instanceof StubToolkit);
>
> I wouldn't recommend that, since it will then obscure the main reason for this call -- to load the toolkit (honestly, the cast was probably an afterthought). So this would be OK:
> 
> 
>         tk = Toolkit.getToolkit();//This step is not needed (Just to make sure StubToolkit is loaded into VM)
>         assertTrue(tk instanceof StubToolkit);

could we just create a method in Util instead of dragging multi-line construct across the tests?

e.g. `Util.loadStubToolkit()` ?

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

PR: https://git.openjdk.org/jfx/pull/959


More information about the openjfx-dev mailing list