View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   // Created: 2001
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.puppycrawl.tools.checkstyle.checks.whitespace.operatorwrap;
6   
7   import java.util.Arrays;
8   
9   /**
10   * Test case for detecting operator wrapping.
11   * @author Lars K�hne
12   **/
13  class InputOperatorWrap
14  {
15      void test()
16      {
17          int x = 1 +
18              2 -
19              3
20              -
21              4;
22          x = x + 2;
23          boolean y = true
24              &&
25              false;
26          y = true &&
27              false;
28          y = false
29              && true;
30          Arrays.sort(null, String
31                      ::
32                      compareToIgnoreCase);
33          Arrays.sort(null, String::
34                      compareToIgnoreCase);
35          Arrays.sort(null, String
36                      ::compareToIgnoreCase);
37      }
38      
39      void testAssignment()
40      {
41          int x
42              = 0; //error when checking assignment operators with EOL wrap option
43          int y =
44              0;
45      }
46      
47      <
48          T extends Comparable &
49          java.io.Serializable
50      >
51      void testGenerics1()
52      {
53          Comparable
54              <
55              String
56              >
57              c = new String(); 
58      }
59  }
60  
61  class badCase2<T extends Foo &
62      Bar> {
63  }
64  
65  class goodCase<T extends Foo & Bar> {
66  }
67  
68  class Switch {
69      public void test(int i, int j) {
70          switch(j) {
71          case 7:
72              return;
73          }
74          switch(i) {
75          case 1:
76              break;
77          default:
78              ;
79          }
80          for (int k : new int[]{1,2,3}) {}
81      }
82  }