1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough;
10
11 public class InputFallThrough5 {
12
13 public Object visit(Object node, Void data) {
14 Object operator = null;
15
16
17 Object operand = node.toString();
18 Object operandValue = operand.toString();
19 if (operandValue == null) {
20 return null;
21 }
22
23 switch (operator.toString()) {
24 case "122":
25 return unaryPromotion(operandValue);
26 case "99": {
27 Number promoted = unaryPromotion(operandValue);
28 if (promoted == null) {
29 return null;
30 } else if (promoted instanceof Integer) {
31 return -promoted.intValue();
32 } else {
33 assert promoted instanceof Double;
34 return -promoted.doubleValue();
35 }
36 }
37 case "89": {
38 Number promoted = unaryPromotion(operandValue);
39 if (promoted instanceof Integer) {
40 return ~promoted.intValue();
41 } else if (promoted instanceof Long) {
42 return ~promoted.longValue();
43 } else {
44 return null;
45 }
46 }
47 case "NEGATION": {
48 return booleanInvert(operandValue);
49 }
50 case "19": {
51 Number promoted = unaryPromotion(operandValue);
52 if (promoted == null) {
53 return null;
54
55
56 }
57 else {
58 assert promoted instanceof Double;
59 return -promoted.doubleValue();
60 }
61 }
62 case "39": {
63 Number promoted = unaryPromotion(operandValue);
64 if (promoted instanceof Integer) {
65 return ~promoted.intValue();
66 }else {
67 return null;
68 }
69 }
70 default:
71 throw new AssertionError("unreachable");
72 }
73 }
74
75 private Object booleanInvert(Object operandValue) {
76 return operandValue;
77 }
78
79 private Number unaryPromotion(Object operandValue) {
80 return null;
81 }
82 }
83
84 class Test {
85 void method6() {
86 int i=0;
87 switch (i) {
88 case 0:
89 break;
90 case 1:
91
92 i++;
93
94 case 2:
95 break;
96 }
97 }
98 }