Bug 107804 - Warning for possible NullPointerException
Summary: Warning for possible NullPointerException
Status: RESOLVED DUPLICATE of bug 110030
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-23 18:29 EDT by Prashant Deva CLA
Modified: 2006-10-10 01:32 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 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 ***