RFR: 8269638: Property methods, setters, and getters in printing API should be final [v4]

Kevin Rushforth kcr at openjdk.java.net
Fri Jul 16 21:29:51 UTC 2021


On Fri, 16 Jul 2021 21:09:45 GMT, Phil Race <prr at openjdk.org> wrote:

> Printer can never be null. Its instaniated by the private PrinterJob constructor.

If `Printer.getDefaultPrinter()` can never return null, then you are right that there is no bug here.

> So perhaps more to the point is are the lines right before that necessary ?
> 
>               if (value == null) {
>                     value = Printer.getDefaultPrinter();
>                 }

Yes, this null check is needed, since we specify that setting the `printer` property to `null` will use the default printer.

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

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


More information about the openjfx-dev mailing list