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 256749 - False positive of warning "null" in Loop assignment
Summary: False positive of warning "null" in Loop assignment
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
Depends on: 249320
  Show dependency tree
Reported: 2015-11-23 19:12 UTC by SirIntellegence
Modified: 2015-11-23 19:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:

Test file (662 bytes, text/plain)
2015-11-23 19:12 UTC, SirIntellegence

Note You need to log in before you can comment on or make changes to this bug.
Description SirIntellegence 2015-11-23 19:12:36 UTC
Created attachment 157462 [details]
Test file

It thinks the variable could be null when we are checking that it is not null.
Comment 1 Svata Dedic 2015-11-23 19:37:17 UTC
The good news is that the new implemenation handles the situation correctly -- as the loop condition tests the assignment (= the variable value) for != null, the value is asserted to be non-null within loop body.

The bad news is that it the new impl is still a little clumsy and not well tested :-/