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 256485 - Mutliple-pass NPE analysis
Summary: Mutliple-pass NPE analysis
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 256484 226083
Blocks:
  Show dependency tree
 
Reported: 2015-11-10 07:34 UTC by Svata Dedic
Modified: 2015-11-10 12:34 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2015-11-10 07:34:47 UTC
Taking example from issue #226083:

public class Main {

    public static void main(String[] args) {
        Object obj = getObject();
        boolean isOkay = obj != null;
        if (true) {
            obj.toString();
        }
    }

    public static Object getObject() {
        return "something";
    }
}

This code originally provokes a possible NPE hint on obj.toString(). However when analysis of the whole class completes, it becomes known that getObject() never returns null on normal completion. 
This knowledge can be used to recompute data flow for methods which directly calls such a method. Depends on method outcome analysis, see issue #256484