Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this noncompliant code example, an assignment expression is the controlling expression in an if statement.:

Code Block
bgColor#FFcccc
public void f(boolean a, boolean b) {
  if (a = b) {
    /* ... */
  }
}

...

When the assignment of b to a is unintended, this conditional block is now executed only when a is equal to b.:

Code Block
bgColor#ccccff
public void f(boolean a, boolean b) {
  while ( (a == b) && flag ) {
    /* ... */
  }
}

...