Assignments within sub-expressions are hard to spot and therefore make the code less readable. Ideally, sub-expressions should not have side-effects.
if ((str = cont.substring(pos1, pos2)).isEmpty()) { // Noncompliant //...
str = cont.substring(pos1, pos2); if (str.isEmpty()) { //...
Assignments in while
statement conditions, and assignments enclosed in relational expressions are ignored.
BufferedReader br = new BufferedReader(/* ... */); String line; while ((line = br.readLine()) != null) {...}
Chained assignments, including compound assignments, are ignored.
int i = j = 0; int k = (j += 1); result = (bresult = new byte[len]);