RFR: 8293862: javax/swing/JFileChooser/8046391/bug8046391.java failed with 'Cannot invoke "java.awt.Image.getWidth(java.awt.image.ImageObserver)" because "retVal" is null' [v2]

Tejesh R tr at openjdk.org
Mon Dec 19 14:34:49 UTC 2022


On Mon, 19 Dec 2022 14:29:09 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Means the other constructor is called in two places only and in those places null checks are done. So, even if we add assertion inside constructor, it will unreachable.
>
>> Means the other constructor is called in two places only and in those places null checks are done. So, even if we add assertion inside constructor, it will unreachable.
> 
> It won't be unreachable, _it will prevent such a situation from happening again_. The code which calls the other constructor could be changed.
> 
> I still think it's reasonable to add the assertion. It's a no-op if assertions aren't enabled (the default), and it'll catch the broken invariant in testing since tests are (usually) run with assertions enabled.

Yeah, got your point. It's better to add as a preventive measure.

-------------

PR: https://git.openjdk.org/jdk/pull/11104



More information about the client-libs-dev mailing list