View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="UnnecessaryParentheses">
5         <property name="tokens" value="BOR, BAND, BXOR" />
6       </module>
7     </module>
8   </module>
9   */
10  package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses;
11  
12  // xdoc section -- start
13  class Example2 {
14  
15    void method() {
16      int x = 9, y = 8;
17      // violation below, 'Unnecessary parentheses around expression'
18      if (x >= 0 ^ (x <= 8 & y <= 11)
19           ^ y >= 8) {
20        return;
21      }
22      if (x >= 0 ^ x <= 8 & y <= 11 ^ y >= 8) {
23        return;
24      }
25      // violation below, 'Unnecessary parentheses around expression'
26      if (x >= 0 || (x <= 8 & y <= 11)
27          && y >= 8) {
28        return;
29      }
30      if (x >= 0 || x <= 8 & y <= 11 && y >= 8) {
31        return;
32      }
33      if (x >= 0 & (x <= 8 ^ y <= 11) & y >= 8) {
34        return;
35      }
36    }
37  
38  }
39  // xdoc section -- end