RFR: 8334016: Make PrintNullString.java automatic [v2]
Alexey Ivanov
aivanov at openjdk.org
Fri May 9 19:11:56 UTC 2025
On Wed, 23 Apr 2025 12:25:16 GMT, Renjith Kannath Pariyangad <rkannathpari at openjdk.org> wrote:
>> Hi Reviewers,
>>
>> I have updated the test and made it semi-automatic (need to click "Print") . Test will initiate a print and result will be generated automatic.
>>
>> Please review and let me know your suggestions.
>
> Renjith Kannath Pariyangad has updated the pull request incrementally with one additional commit since the last revision:
>
> Made test fully automatic
Changes requested by aivanov (Reviewer).
test/jdk/java/awt/print/PrinterJob/PrintNullString.java line 33:
> 31: import java.awt.print.PrinterJob;
> 32: import java.io.File;
> 33: import java.lang.Override;
Suggestion:
import java.io.File;
No need to import classes from `java.lang` package.
test/jdk/java/awt/print/PrinterJob/PrintNullString.java line 48:
> 46: * @run main PrintNullString
> 47: */
> 48: public class PrintNullString extends Frame {
You don't display UI any more, no need to extend `Frame`.
test/jdk/java/awt/print/PrinterJob/PrintNullString.java line 63:
> 61: }
> 62:
> 63: private static class TextCanvas extends Panel implements Printable {
Suggestion:
private static class PrintText implements Printable {
`Panel` isn't needed any more, so simple class would do.
Better yet, make the test class `PrintNullString` implement `Printable` and embed everything from `TextCanvas` directly to `PrintNullString`.
test/jdk/java/awt/print/PrinterJob/PrintNullString.java line 84:
> 82:
> 83: private void paint(Graphics2D g2d) {
> 84: // API 1: null & empty drawString(String, int, int);
Now this `paint` method is redundant, you can copy its body directly into `print` above.
-------------
PR Review: https://git.openjdk.org/jdk/pull/24501#pullrequestreview-2829420241
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2082350935
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2082356860
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2082359813
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2082361378
More information about the client-libs-dev
mailing list