RFR: 8363889: Update sun.print.PrintJob2D to use Disposer [v2]
Andrey Turbanov
aturbanov at openjdk.org
Tue Jul 29 12:14:03 UTC 2025
On Tue, 22 Jul 2025 22:10:37 GMT, Phil Race <prr at openjdk.org> wrote:
>> As laid out in the JBS issue, this updates the java.awt.PrintJob implementation to use a delegate which can be disposed instead of relying on finalize().
>>
>> PrintJob.finalize() is not being removed, and won't be removed until there is a more definite plan for completely removing the finalize() mechanism.
>
> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>
> 8363889
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 123:
> 121: MediaSizeName.ISO_A10, MediaSizeName.ISO_B0, MediaSizeName.ISO_B1,
> 122: MediaSizeName.ISO_B2, MediaSizeName.ISO_B3, MediaSizeName.ISO_B4,
> 123: MediaSizeName.ISO_B5, MediaSizeName.ISO_B6, MediaSizeName.ISO_B7,
Suggestion:
MediaSizeName.ISO_B5, MediaSizeName.ISO_B6, MediaSizeName.ISO_B7,
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 293:
> 291: private Thread printerJobThread;
> 292:
> 293: public PrintJobDelegate(Frame frame, String doctitle,
Suggestion:
public PrintJobDelegate(Frame frame, String doctitle,
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 303:
> 301: }
> 302:
> 303: public PrintJobDelegate(Frame frame, String doctitle,
Suggestion:
public PrintJobDelegate(Frame frame, String doctitle,
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 309:
> 307: }
> 308:
> 309: private void initPrintJob2D(Frame frame, String doctitle,
Suggestion:
private void initPrintJob2D(Frame frame, String doctitle,
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 387:
> 385: DialogType d = this.jobAttributes.getDialog();
> 386: PrintService pServ = printerJob.getPrintService();
> 387: if ((pServ == null) && (d == DialogType.NONE)){
Suggestion:
if ((pServ == null) && (d == DialogType.NONE)){
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 411:
> 409: if (d == DialogType.NATIVE) {
> 410: attributes.add(DialogTypeSelection.NATIVE);
> 411: } else { // (d == DialogType.COMMON)
Suggestion:
} else { // (d == DialogType.COMMON)
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 439:
> 437:
> 438: Media media = (Media)attributes.get(Media.class);
> 439: MediaSize mediaSize = null;
Suggestion:
MediaSize mediaSize = null;
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 824:
> 822: */
> 823: //printGraphics = new ProxyPrintGraphics(currentGraphics.create(), this);
> 824: printGraphics = currentGraphics.create();
Suggestion:
printGraphics = currentGraphics.create();
src/java.desktop/share/classes/sun/print/PrintJobDelegate.java line 906:
> 904: * are released, files closed etc.
> 905: */
> 906: if( printerJobThread != null && printerJobThread.isAlive() ){
Suggestion:
if (printerJobThread != null && printerJobThread.isAlive() ){
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239598578
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239599185
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239599562
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239599930
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239600419
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239601037
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239601366
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239602520
PR Review Comment: https://git.openjdk.org/jdk/pull/26432#discussion_r2239602907
More information about the client-libs-dev
mailing list