This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268249 - Unnecessary test for null complain even when this test is necessary
Summary: Unnecessary test for null complain even when this test is necessary
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-28 13:37 UTC by ilya.e.g
Modified: 2016-09-28 13:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (56.45 KB, text/plain)
2016-09-28 13:37 UTC, ilya.e.g
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ilya.e.g 2016-09-28 13:37:04 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_92
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.92-b14

Reproducibility: Happens every time

STEPS:
Please have a look at the following code:

    public static boolean nullSafeEquals(final Object obj1, final Object obj2) {
        return obj1 == null & obj2 == null || obj1 != null && obj1.equals(obj2);
    }

The check for null:
 obj1 != null
is necessary to prevent a NullPointerException, and the old version of Netbeans (7.4) demands that check.
But new version 8.0.1 and 8.1 claims that test as unnecessary, but it is necessary
ACTUAL:
    Unnecessary test for null - the expression is never null

EXPECTED:
  This check is necessary, as it was in  the 7.4 versio
Comment 1 ilya.e.g 2016-09-28 13:37:11 UTC
Created attachment 162255 [details]
IDE log