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 247446 - Caret operator produces "Unnecessary test for null" hint
Summary: Caret operator produces "Unnecessary test for null" hint
Status: RESOLVED DUPLICATE of bug 245201
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-24 14:17 UTC by rosa_t
Modified: 2015-09-10 13: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 rosa_t 2014-09-24 14:17:23 UTC
Caret operator (^) produces this hint inappropriately:        


1        private boolean testBug(Object o1, Object o2) {
2            if ((o1 == null ^ o2 == null) || o1 != null) {
3                return true;
4            }
5            return false;
6        }

On line 2 "o1 != null" is highlighted with "Unecessary test for null - expression is never null". The first part of the test returns true if exactly one of o1 or o2 is null, therefore o1 can be null.
Comment 1 Svata Dedic 2015-09-10 13:30:48 UTC

*** This bug has been marked as a duplicate of bug 245201 ***