RFR: 8320676 : Manual printer tests have no Pass/Fail buttons, instructions close [v2]
Alexey Ivanov
aivanov at openjdk.org
Wed Feb 7 19:20:07 UTC 2024
On Thu, 1 Feb 2024 00:39:16 GMT, Alisen Chung <achung at openjdk.org> wrote:
>> Renjith Kannath Pariyangad has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Suggestions integrated
>
> test/jdk/java/awt/print/PageFormat/PageSetupDialog.java line 225:
>
>> 223: }
>> 224: g2d.drawRect(1, 1, (int) pageFormat.getImageableWidth() - 2,
>> 225: (int) pageFormat.getImageableHeight() - 2);
>
> dispose g2D object
One must not dispose of an object that one does not own!
A `Graphics` instances is passed as a parameter to this method. You must not dispose of parameters, unless instructed to do so by the specification. You do not dispose of `Graphics` in `paint`, nor do you dispose of it in `print`. These objects are managed by the AWT.
> test/jdk/java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java line 126:
>
>> 124: g2d.setColor(Color.black);
>> 125:
>> 126: g2d.drawString(("This is page" + (pidx + 1)), 60, 80);
>
> dispose g2D object
You *must not* dispose of the `Graphics` which was passed to you as a parameter.
> test/jdk/java/awt/print/PrinterJob/raster/RasterTest.java line 156:
>
>> 154: new GradientPaint(10.0f, 10.0f, alphablue, 210.0f, 210.0f, alphared, true);
>> 155: g2.setPaint(gp);
>> 156: g2.fillRect(10, 240, 200, 200);
>
> dispose g2D object (and graphics object)
Do not dispose of the `Graphics` object you didn't create.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17607#discussion_r1481811288
PR Review Comment: https://git.openjdk.org/jdk/pull/17607#discussion_r1481841520
PR Review Comment: https://git.openjdk.org/jdk/pull/17607#discussion_r1481954693
More information about the client-libs-dev
mailing list