View Javadoc
1   /*
2   FallThrough
3   checkLastCaseGroup = (default)false
4   reliefPattern = (default)falls?[ -]?thr(u|ough)
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough;
10  
11  public class InputFallThroughWithEmoji {
12  
13      void foo() {
14  
15          while (true) {
16              int i = 0;
17              switch ("👍") {
18                  case "ds😂":
19                  case "": i++; break;
20                  case "👇🏻":
21                      i++;
22                  case "😂sda":
23                      // violation above 'Fall\ through from previous branch of the switch statement.'
24                      i++;
25                  case "d😂sda": return;
26                      // violation above 'Fall\ through from previous branch of the switch statement.'
27  
28                  case "5😆": throw new RuntimeException("");
29                  case "🧐6":
30                      do {
31                          System.identityHashCode("something");
32                          return;
33                      } while(true);
34                  case "7🤛🏻":
35                      for (int j1 = 0; j1 < 10; j1++) {
36                          String.valueOf("something");
37                          "7🤛🏻".toString(); return;
38                      }
39                  case "8🥳": try {
40                          i++;
41                          String s ="8🥳"; break;
42                      } catch (RuntimeException e) {
43                          i--;
44  
45                      } finally {
46                          i++;
47                      }
48                      // fall👉🏻through,
49                  case "9": String s = "s🥳d🥳s";
50                  // violation above 'Fall\ through from previous branch of the switch statement.'
51                  // FALLTHRU (case-sensitive)
52                  default: // violation 'Fall\ through from previous branch of the switch statement.'
53                      "🥳".toString().equals("🥳");
54  
55                      // this is the last label
56                      i++;
57              }
58          }
59      }
60  
61      void fooFallThru() {
62          int i = 0;
63          switch ("") {
64  
65              case "ds😂":
66              case "":
67                  i++;
68                  break;
69              case "👇🏻": i++;
70  
71                  // fallthru 😂 works
72              case "😂sda":
73                  i++;
74                  // fallthru
75              case "dsda":
76                  return;
77              case "5😆":
78                  throw new RuntimeException("");
79              case "🧐6":
80                  do {
81                      System.identityHashCode("something");
82  
83                  } while(true);
84                  /*falls through*/
85              case "7🤛🏻": for (int j1 = 0; j1 < 10; j1++) {
86                      String.valueOf("something");
87                      return;
88                  }
89              case "8🥳": try { break;
90                  } catch (RuntimeException e) {
91                      i--;
92                      break;
93                  } finally {
94                      i++;
95                  }
96              case "9": String s = "s🥳d🥳s";
97                  //🥳d🥳 fallthru
98  
99              case "10": String s2 = "s🥳d🥳s";
100             /*🥳🥳🥳🥳🥳🥳*/ /* fallthru */ default: i++;
101 
102     }
103     }
104 }