Skip to content

Commit

Permalink
Latest docs on successful build 5723 auto-pushed to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
copybara-service[bot] committed Oct 19, 2023
1 parent 4bba9d8 commit 77eccb2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bugpattern/OperatorPrecedence.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,24 @@ The [Google Java Style Guide §4.7][style] states:
[style]: https://google.github.io/styleguide/javaguide.html#s4.7-grouping-parentheses

Use grouping parentheses to disambiguate expressions that contain both `||` and
`&&`, or both shift and arithmetic operators.
Use grouping parentheses to disambiguate expressions that could be
misinterpreted.

For example, consider this:

```java
boolean d = (a && b) || c;",
boolean e = (a || b) ? c : d;",
int z = (x + y) << 2;",
```
Instead of this:
```java
boolean r = a && b || c;",
boolean e = a || b ? c : d;",
int z = x + y << 2;",
```

## Suppression
Suppress false positives by adding the suppression annotation `@SuppressWarnings("OperatorPrecedence")` to the enclosing element.

0 comments on commit 77eccb2

Please sign in to comment.