ER-080 Avoid "for", "do", "while", "if" and "if ... else" statements with empty bodies

Severity1
Enabledyes
Waivable
Violation
private static final int RETVAL1 = 10;
private static final int RETVAL2 = 1;
public int getInt(final boolean which) {
	if (which) {
	} else {
		return RETVAL2;
	}
	return RETVAL1;
}
Fix
private static final int RETVAL1 = 10;
private static final int RETVAL2 = 1;
public int getInt(final boolean which) {
	if (which) {
		return RETVAL1;
	} else {
		return RETVAL2;
	}
}


Hammurapi 3 Copyright © 2004 Hammurapi Group. All Rights Reserved.