Summary: | [quick fix] Add null check if potential null dereference | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Benno Baumgartner <benno.baumgartner> |
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | markus.kell.r, martinae |
Version: | 3.4 | ||
Target Milestone: | 3.5 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Benno Baumgartner
2008-03-03 10:12:36 EST
Sorry, that was too quick I20080226-1155 Given: public class Foo { public void foo() { StringBuffer b1 = null; if (bar()) { b1= new StringBuffer(); } b1.append(true); } private boolean bar() { return false; } } 1. Quick fix at b1: Potential null pointer access: The variable b1 may be null at this location Is: Add suppress warning is the only available quick fix (pretty useless) Should: 'Add null check' with result: StringBuffer b1 = null; if (b1 != null) { b1.append(true); } *** This bug has been marked as a duplicate of bug 178254 *** |