Bug 178254 - [quick fix] quick fixes for null-related problems
Summary: [quick fix] quick fixes for null-related problems
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: fix candidate
Keywords: helpwanted
: 221152 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-20 09:43 EDT by Markus Keller CLA
Modified: 2013-04-20 12:06 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-03-20 09:43:59 EDT
I20070320-0010

Currently, there are no quick fixes for null-related problems (null pointer access, potential NPE, redundant null checks.

For (potential) NPE problems, the fix would be to add a null check.
For redundant null checks, the fix would be to replace the check with true or false.

Here's a testbed that produces all null-related problems we currently have:

class Nullerei {
	void nullAccess(Object a, Object b) {
		a= null;
		a.hashCode();
	}
	void potential(Object a, Object b) {
		if (a != null) { }
		a.hashCode();
		
		if (b == null) { }
		b.hashCode();
	}
	void redundantCheck(Object a, Object b) {
		a.hashCode();
		if (a == null) { }
		a= null;
		if (a != null) { }
		a= null;
		if (a instanceof Integer) {}
		
		b= new Object();
		if (b != null) { }
		b= null;
		b= null;
		if (b == null) { }
	}
}
Comment 1 Markus Keller CLA 2008-08-07 09:54:57 EDT
*** Bug 221152 has been marked as a duplicate of this bug. ***