Bug 388049 - [compiler][null] white list for constructors known not to throw any exception
Summary: [compiler][null] white list for constructors known not to throw any exception
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.2   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-25 13:43 EDT by Stephan Herrmann CLA
Modified: 2012-08-25 13:43 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2012-08-25 13:43:26 EDT
After bug 345305 is fixed null analysis inside a try block detects the first statement that could cause an abrupt exit.
This includes calls to *any* constructors. 
For well-known constructors like String and Object we might use a white list to make the analysis yet more precise.

Example:

  Object o = null;
  try {
      o = new Object();
  } finally {
      if (o == null) // should flag here
          bar();
  }
  
At the indicated position we'd like to report a redundant null check, but analysis "believes" that "new Object()" can throw an exception, therefore the assignment may not be executed.