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 251969 - NPECheck does not handle boolean XOR
Summary: NPECheck does not handle boolean XOR
Status: RESOLVED DUPLICATE of bug 245201
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 249320
Blocks:
  Show dependency tree
 
Reported: 2015-04-21 14:28 UTC by jo.navy
Modified: 2015-11-10 17:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jo.navy 2015-04-21 14:28:32 UTC
Consider this piece of code:

    Object o = null;
    if ((o != null) ^ false) { // ^ false is a NOP
        throw new RuntimeException();
    }
    if (o == null) { // NetBeans: "Unnecessary test for null - the expression is never null"
    }


NetBeans says "the expression is never null" but, on the contrary, it is always null.
Comment 1 jo.navy 2015-04-21 14:35:38 UTC
Also note that the wrong hint disappears if you remove the bitwise XOR from the first "if" statement.

Perhaps this bug is related to https://netbeans.org/bugzilla/show_bug.cgi?id=249234
Comment 2 Svata Dedic 2015-06-02 12:12:19 UTC
Will be fixed as part of issue #249320
Comment 3 Svata Dedic 2015-09-10 13:28:09 UTC

*** This bug has been marked as a duplicate of bug 245201 ***
Comment 4 Svata Dedic 2015-11-10 17:30:06 UTC
Fixed in experimental impl, wait for the umbrella issue to close.