On Fri, 10 Feb 2023 16:08:56 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Add both null check > > test/jdk/javax/swing/JFileChooser/JFileChooserFontReset.java line 70: > >> 68: System.out.println("current font " + curFont); >> 69: if ((curFont != null && !curFont.equals(origFont)) || >> 70: (origFont != null && !origFont.equals(curFont))) >> { > > The newly added condition is redundant because `origFont.equals(curFont) == > curFont.equals(origFont)`. (It's possible `equals` returns different values > but it violates its contract then.) I dont think it's redundant..There's a || check in between If `curFont `is not null and `origFont `is null, then 1st condition `curFont != null && !curFont.equals(origFont)` is satisfied and it will throw exception If `origFont `is not null and `curFont `is null, then 1st condition `curFont != null && !curFont.equals(origFont)` is not satisfied and 2nd condition `origFont != null && !origFont.equals(curFont)` is satisfied and it will throw exception. If we remove origFont.equals(curFont) check, it will not check the fix.. ------------- PR: https://git.openjdk.org/jdk/pull/12180