RFR: 8201567: QuantumRenderer modifies buffer in use by JavaFX Application Thread

John Neffenger github.com+1413266+jgneff at openjdk.java.net
Sun Jun 28 02:37:27 UTC 2020

The message from this sender included one or more files
which could not be scanned for virus detection; do not
open these files unless you are certain of the sender's intent.

On Sat, 27 Jun 2020 15:36:01 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Fixes [JDK-8201567](https://bugs.openjdk.java.net/browse/JDK-8201567).
> modules/javafx.graphics/src/main/java/com/sun/glass/ui/Pixels.java line 194:
>> 193:     public final Buffer getBuffer() {
>> 194:         assert this.bytes != null || this.ints != null;
>> 195:         return this.bytes != null ? this.bytes : this.ints;
> We should not use `assert` statements in the JavaFX runtime. If this is a condition that needs to be checked, then use
> an `if` test and throw an appropriate `RuntimeException` or an `InternalError`.

Thanks, Kevin. I saw `assert` used elsewhere (`EventLoop` in the same package, for example), and thought it was
okay—even preferable—for these "should never occur" checks. Is that a general policy not to use `asserts` anywhere in
JavaFX? Should I also remove the asserts I added to `HeadlessScreen` and `EPDScreen` in lieu of a unit test case?


PR: https://git.openjdk.java.net/jfx/pull/255

More information about the openjfx-dev mailing list