ER-081 Do not assign loop control variables in the body of a "for" loop

Severity2
Enabledyes
Waivable
Violation
for (Object obj = iter.next(); iter.hasNext(); obj = iter.next()) {
	if (obj.equals(anObj)) {
		throw new HammurapiTestCasesException(obj.toString());
	}
	obj = iter.next();
}
Fix
for (Object obj = iter.next(); iter.hasNext(); obj = iter.next()) {
	if (obj.equals(anObj)) {
		throw new HammurapiTestCasesException(obj.toString());
	}
}


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