Did you mean to assign (mask - 1) & h here?
161 Buffer<E>[] rs;
162 int mask, j;
163 if (((rs = table) != null) && ((mask = rs.length) > 0)
164 && (rs[j = (mask - 1) & h] == null)) {165 rs[j] = create(e);
166 created = true;
167 }
Did you mean to assign expirationTicker().r... here?
2515 oldValue[0] = n.getValue();
2516 oldWeight[0] = n.getWeight();
2517 if ((nodeKey[0] == null) || (oldValue[0] == null)
2518 || hasExpired(n, now[0] = expirationTicker().read())) {2519 oldValue[0] = null;
2520 return n;
2521 }
Did you mean to assign expirationTicker().r... here?
2573 prevValue[0] = n.getValue();
2574 oldWeight[0] = n.getWeight();
2575 if ((nodeKey[0] == null) || (prevValue[0] == null) || !n.containsValue(oldValue)
2576 || hasExpired(n, now[0] = expirationTicker().read())) {2577 return n;
2578 }
2579
Description
This condition seems to have an assignment (like a = b
) instead of a comparison (like a == b
).
Such code can be confusing and difficult to read and debug. Consider separating out the assignment and perform only a comparison within the expression.
Bad Practice
While this code will compile, it will also likely perform the wrong operation, since a
will always be treated as being true
.
if (a = true) {
// ...
}
For other types, compilation will likely fail because in general, constructs such as if
, for
and while
expect boolean expressions in their conditions, and will not accept other types.
Recommended
Change the assignment to a comparison.
if (a == true) {
// ...
}