Bug 165346

Summary: [compiler][null] org.eclipse.jdt.internal.compiler.ast.OperatorExpression.nullStatus(FlowInfo) too conservative
Product: [Eclipse Project] JDT Reporter: Perry James <perry>
Component: CoreAssignee: Maxime Daniel <maxime_daniel>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: chalin
Version: 3.3Keywords: contributed
Target Milestone: 3.3 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch for OperatorExpression.nullStatus() none

Description Perry James CLA 2006-11-21 12:32:20 EST
During our exploration at the DSRG of integrating JML with Eclipse, we found that OperatorExpression.nullStatus(FlowInfo) should return NON_NULL instead of UNKNOWN: no operators other than the conditional operator can produce a null result, and that case is covered by an overriding method in ConditionalExpression.
Comment 1 Perry James CLA 2006-11-21 12:33:19 EST
Created attachment 54268 [details]
patch for OperatorExpression.nullStatus()

proposed fix.
Comment 2 Maxime Daniel CLA 2006-11-22 04:16:58 EST
You're right, thanks for the heads up. Found a test case that is broken by the current code:
public class X {
  void foo() {
    int j = 5;    Integer i = 0 + j;
    if (i == null) {} // should complain here but does not
  }
}

Comment 3 Maxime Daniel CLA 2006-11-22 04:23:49 EST
Added NullReferenceTest#45.

Released for 3.3 M4.
Comment 4 Olivier Thomann CLA 2006-12-11 15:10:54 EST
Verified for 3.3M4 with I20061211-1119