View Javadoc
1   /*
2   StringLiteralEquality
3   
4   
5   */
6   
7   package com.puppycrawl.tools.checkstyle.checks.coding.stringliteralequality;
8   
9   public class InputStringLiteralEqualityCheck {
10  
11      int method(int a) {
12          if (a == 2 + 3
13                  + 5 + 2) {
14              return 0;
15          }
16          else {
17              return 1;
18          }
19      }
20  
21      boolean method() {
22          boolean result = false;
23          if (result == false && 3 - 0 == 9) {
24          }
25          return result;
26      }
27  
28      boolean method2() {
29          boolean result = false;
30          String str = "check";
31          if (result == false && 3 - 0 == 9
32                  && str == "check" + "Style"
33                  // violation above 'Literal Strings should be compared using equals(), not '==''
34                  + "code" + "convention") {
35          }
36          return result;
37      }
38  }