Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 136676

Summary: [compiler][null][correlation] warns "may be null" within block that would be unreachable if arg was null
Product: [Eclipse Project] JDT Reporter: Grant Gayed <grant_gayed>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P5 CC: feles, nilskp+eclipse, stephan.herrmann, vlsergey
Version: 3.2Keywords: helpwanted
Target Milestone: 4.7 M1   
Hardware: PC   
OS: All   
Whiteboard:

Description Grant Gayed CLA 2006-04-13 12:20:26 EDT
snippet:

public static void main(String[] args) {
    String abc = System.currentTimeMillis() % 2 == 0 ? "abc" : null;
    boolean doit = abc != null;
    if (doit) {
        System.out.println(abc.length());  // <-- cannnot get here if abc==null
    }
}
Comment 1 Maxime Daniel CLA 2006-04-13 12:27:10 EDT
This is a slightly simpler case than bug 134933. This calls for variables correlation, which is not in 3.2 scope.
Comment 2 Maxime Daniel CLA 2006-07-10 11:10:58 EDT
*** Bug 150123 has been marked as a duplicate of this bug. ***
Comment 3 Maxime Daniel CLA 2006-07-26 03:01:00 EDT
*** Bug 151725 has been marked as a duplicate of this bug. ***
Comment 4 Maxime Daniel CLA 2006-08-24 13:07:58 EDT
*** Bug 155043 has been marked as a duplicate of this bug. ***
Comment 5 Maxime Daniel CLA 2007-06-19 08:07:53 EDT
Reopening as P5 (since RESOLVED LATER is deprecated).
Comment 6 Stephan Herrmann CLA 2016-06-28 17:17:34 EDT
Bulk closing all compiler bugs tagged [null][correlation], because we have no plans to add such a feature: it would be a tremendous implementation effort, beyond our current man power, and may be impossible to achieve within the desired performance bounds.

If s.o. has a viable strategy or even implementation for such a feature, I'm all ears.
Comment 7 Jay Arthanareeswaran CLA 2016-08-03 07:58:16 EDT
Verified for 4.7 M1.
Comment 8 Stephan Herrmann CLA 2018-08-30 10:32:12 EDT
I created a new umbrella RFE outlining what would be needed to address this issue.

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