...
Although it advises against depending on parentheses for specifying evaluation order , EXP05-J. Do not write more than once to the same variable follow a write by a subsequent write or read of the same object within an expression applies only to expressions that contain side effects.
...
Detection of all expressions using low-precedence operators without parentheses is straightforward. Determining the correctness of such uses is infeasible in the general case, although heuristic warnings could be useful.
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| FB.CORRECTNESS.BSHIFT_WRONG_ADD_PRIORITY | Possible bad parsing of shift operation | ||||||
SonarQube Java Plugin |
| S864 |
Bibliography
[ESA 2005] | Rule 65, Use parentheses to explicitly indicate the order of execution of numerical operators |
...
...