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

Bug 107804

Summary: Warning for possible NullPointerException
Product: [Eclipse Project] JDT Reporter: Prashant Deva <prashant.deva>
Component: CoreAssignee: Maxime Daniel <maxime_daniel>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: akiezun
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Prashant Deva CLA 2005-08-23 18:29:31 EDT
The compiler should give a warning when it sees a possible null pointer exception.
Eg-

public void asd(MyObj a)
{

   if(a!=null)
      a.doSomething();

   a.doSomething(); //warning here
}

Basically it should check if some var is checked for null.
If it is, and there is some portion of the code which exccutes code on that var
without checking it for null then there can be a possible nullpointer excpetion.

For example this wont produce warning in the following code as no check for null
is done-


public void asd(MyObj a)
{
   a.doSomething(); // NO warning here
}
Comment 1 Maxime Daniel CLA 2006-10-10 01:32:13 EDT
Sorry, missed this one when implementing 110030. The behaviors you ask for were included in 3.2.

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