RFR: 8334016: Make PrintNullString.java semi-automatic
Mikhail Yankelevich
myankelevich at openjdk.org
Wed Apr 9 09:34:35 UTC 2025
On Wed, 9 Apr 2025 03:55:58 GMT, Renjith Kannath Pariyangad <rkannathpari at openjdk.org> wrote:
>> test/jdk/java/awt/print/PrinterJob/PrintNullString.java line 112:
>>
>>> 110: // API 1: null & empty drawString(String, int, int);
>>> 111: try {
>>> 112: g2d.drawString(nullStr, 20, 40);
>>
>> Isn't it always null? Don't you think it is a bit misleading when reading the test?
>>
>> Also applies to the lines 123, 134, 149
>
> Yes it is, this test intended to evaluate how `drawString` handle _null_ and _emptyStr_
I understand, but this is a string value which is always set to null. Wouldn't it be easier to read if it was `null` straight in the method call? Something like this: `g2d.drawString((String) null, 20, 40);`
If you prefer it as is, it's fine too
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2034933835
More information about the client-libs-dev
mailing list