Bug 163497 - [compiler][null][correlation] Null warning when variable tracks possibility of null
Summary: [compiler][null][correlation] Null warning when variable tracks possibility o...
Status: CLOSED DUPLICATE of bug 538421
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: 4.7 M1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2006-11-05 18:53 EST by Missing name Mising name CLA
Modified: 2018-08-30 10:40 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name Mising name CLA 2006-11-05 18:53:57 EST
3.3M3 (I20061102-1715)

Considering the aim of bug 157154, here is an example of a false positive, albeit one that's difficult to reason about (since 'x' tracks whether 's1' could be null):

  public static int compare(String s1, String s2)
  {
    int x = 0;
    x = (s1 == null) ? 1 : 0;
    x = (x != 0) ? x : s1.compareTo(s2); // s1 may be null reported
    return x;
  }

(Of course, easily rewritten to remove the warning in this instance).
Comment 1 Maxime Daniel CLA 2006-11-06 02:44:03 EST
Thanks for the test case. There is no firm plan as of today to address variables correlation in the JDT Core null analysis feature. This may be reconsidered in the future.
Comment 2 Maxime Daniel CLA 2007-06-19 08:08:30 EDT
Reopening as P5 (since RESOLVED LATER is deprecated).
Comment 3 Stephan Herrmann CLA 2016-06-28 17:18:22 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 4 Sasikanth Bharadwaj CLA 2016-08-02 04:24:14 EDT
Verified for 4.7 M1
Comment 5 Stephan Herrmann CLA 2018-08-30 10:40:05 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 ***