RFR: 8368576: PrintJob.getGraphics() does not specify behavior after PrintJob.end()

Phil Race prr at openjdk.org
Wed Sep 24 22:17:07 UTC 2025


On Wed, 24 Sep 2025 20:45:47 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> Does this new statement in the spec covered by any tests? 

The test pushed in the previous PR covers it.


> How will it behave if getGraphics is called before end, but the Graphics object is used after end has been called?

Same as before - this is just a spec. change, no implementation.
The implementation closes  the graphics when end() is called so any rendering to it is a no-op.
The spec for PrintJob.end() has the same text as shown below.

    /**  
     * Ends the print job and does any necessary cleanup.
     */     
    public synchronized void end() {
        
        /* Prevent the PrinterJob thread from appending any more
         * graphics to the to-be-drawn queue
         */
        graphicsToBeDrawn.close();

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

PR Comment: https://git.openjdk.org/jdk/pull/27474#issuecomment-3330880622


More information about the client-libs-dev mailing list