On Fri, 10 Feb 2023 16:58:02 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> 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.. `curFont != origFont && (curFont != null && !curFont.equals(origFont))` The first part catches the case where both are null. ------------- PR: https://git.openjdk.org/jdk/pull/12180