On Fri, 4 Sep 2026 07:56:17 GMT, John Hendrikx <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/image/WritableImage.java
>> line 175:
>>
>>> 173: if (context == null) {
>>> 174: if (!(getWritablePlatformImage() instanceof
>>> com.sun.prism.Image img)) {
>>> 175: throw new IllegalStateException("platformImage must be
>>> a prism image");
>>
>> 1. this exception must be documented
>> 2. what is a "prism image" from the user perspective? could the message be
>> rephrased to give the user a better understanding?
>
> This exception can't happen, we only have prism images (`PlatformImage` is an
> interface with 1 implementation) -- so I've removed it and just did a hard
> cast.
This has been modified a bit; Toolkit now provides the DrawingContext. No risk
of failure as the toolkit is responsible for providing images as well so it can
match types. This also allows the StubToolkit to provide stub images and
matching drawing context for tests.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1969#discussion_r3940478118