RFR: 8334016: Make PrintNullString.java automatic [v5]
Alexey Ivanov
aivanov at openjdk.org
Thu May 22 10:37:59 UTC 2025
On Wed, 9 Apr 2025 09:27:38 GMT, Mikhail Yankelevich <myankelevich at openjdk.org> wrote:
>> This **builder** is for PassFailJFrame (user instruction window).
>
> @Renjithkannath apologies, I meant the constructor, line 64 😄
> Minor: Don't you think It's a bit unusual to have the test be executed with the builder of the class? Seems a bit odd to me, but if you prefer it, it's fine as is
Maybe… There are other tests that use this code style.
> 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
@myankelev It's not a new test. Explicit `null` requires cast to either `String` or `AttributedCharacterIterator`. The name of the variable have a type associated with it. In addition to that, it keeps the code consistent where null values are tested and where non-null values are tested, and it's clear from the parameter name what is tested.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2102222223
PR Review Comment: https://git.openjdk.org/jdk/pull/24501#discussion_r2102231520
More information about the client-libs-dev
mailing list