Community
Participate
Working Groups
N20100421-2000 Would be nice to have a warning for unnecessary boolean operations that should be simplified. Example (there are probably more cases): public class Try { boolean foo(boolean b) { b&= true; // b unchanged b&= false; // b= false b|= false; // b unchanged b= b & true; // b unchanged if (b) { // 'if(b)' followed by 'return true' and 'return false' // should be written as: 'return b' (with a '!' if reversed) return true; } return false; } boolean bar() { return Math.random() < .5 ? false : true; // use 'return !(Math.random() < .5)' } } This would e.g. help to spot wrong implementations like ApiFilterStore#removeFilters(IApiProblemFilter[]), which uses "success &= true;" and "success &= false;" in a for-loop (that case does not cause problems in the current code base, because the return value is only used in an invocation that passes a single filter).