Bug 165346 - [compiler][null] org.eclipse.jdt.internal.compiler.ast.OperatorExpression.nullStatus(FlowInfo) too conservative
Summary: [compiler][null] org.eclipse.jdt.internal.compiler.ast.OperatorExpression.nul...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-11-21 12:32 EST by Perry James CLA
Modified: 2007-06-06 13:27 EDT (History)
1 user (show)

See Also:


Attachments
patch for OperatorExpression.nullStatus() (823 bytes, patch)
2006-11-21 12:33 EST, Perry James CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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