View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="UnnecessaryParentheses">
5         <property name="tokens" value="QUESTION" />
6       </module>
7     </module>
8   </module>
9   */
10  package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses;
11  
12  // xdoc section -- start
13  class Example3 {
14  
15    void method() {
16      int a = 9, b = 8;
17      int c = (a > b) ? 1 : 0; // violation 'Unnecessary parentheses around expression'
18  
19      int d = c == 1 ? (b % 2 == 0) ? 1 : 0 : 5;
20      // violation above 'Unnecessary parentheses around expression'
21    }
22  
23  }
24  // xdoc section -- end