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