RFR: JDK-8302355: Public API for Toolkit.canStartNestedEventLoop() [v2]

Phil Race prr at openjdk.org
Thu Feb 16 21:48:16 UTC 2023


On Wed, 15 Feb 2023 21:39:02 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Should I also adjust the `Toolkit` javadoc or only the `Platform` one?
>
> It might be a good idea to also adjust the Toolkit docs; it doesn't get generated as javadoc, but could be useful for someone looking at the code. If you do, it wouldn't be part of the CSR, since Toolkit isn't API.

So someone is asking a question when they call this.
Throwing an Exception could be considered an unfriendly way of answering it.
It only makes sense if you think the programmer will have enough information to be sure that if S/HE does things correctly, it will always be the FxUserThread that is being used .. ie if we are in an event handler .. as is supposed to be the case .. and anything else is a blatant programming error that should be rewarded with an upfront response to that effect.

So
1) programming error -> Exception
2) Can't be sure -> return false.

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

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


More information about the openjfx-dev mailing list