1
2
3
4
5
6
7
8 package com.puppycrawl.tools.checkstyle.checks.metrics.npathcomplexity;
9
10 public class InputNPathComplexityDefault {
11
12 public void foo() {
13
14 while (true) {
15 Runnable runnable = new Runnable() {
16
17 public void run() {
18
19 while (true) {
20 }
21 }
22 };
23
24 new Thread(runnable).start();
25 }
26 }
27
28
29 public void bar() {
30
31 if (System.currentTimeMillis() == 0) {
32
33 if (System.currentTimeMillis() == 0 && System.currentTimeMillis() == 0) {
34 }
35
36 if (System.currentTimeMillis() == 0 || System.currentTimeMillis() == 0) {
37 }
38 }
39 }
40
41
42 public void simpleElseIf() {
43
44 if (System.currentTimeMillis() == 0) {
45
46 } else if (System.currentTimeMillis() == 0) {
47 } else {
48 }
49 }
50
51
52 public void stupidElseIf() {
53
54 if (System.currentTimeMillis() == 0) {
55 } else {
56
57 if (System.currentTimeMillis() == 0) {
58 } else {
59
60 if (System.currentTimeMillis() == 0) {
61 }
62 }
63
64 if (System.currentTimeMillis() == 0) {
65 }
66 }
67 }
68
69
70 public InputNPathComplexityDefault()
71 {
72 int i = 1;
73
74 if (System.currentTimeMillis() == 0) {
75
76 } else if (System.currentTimeMillis() == 0) {
77 } else {
78 }
79 }
80
81
82
83 static {
84 int i = 1;
85
86 if (System.currentTimeMillis() == 0) {
87
88 } else if (System.currentTimeMillis() == 0) {
89 } else {
90 }
91 }
92
93
94
95 {
96 int i = 1;
97
98 if (System.currentTimeMillis() == 0) {
99
100 } else if (System.currentTimeMillis() == 0) {
101 } else {
102 }
103 }
104
105
106
107 public InputNPathComplexityDefault(int aParam)
108 {
109 Runnable runnable = new Runnable() {
110
111 public void run() {
112
113 while (true) {
114 }
115 }
116 };
117 new Thread(runnable).start();
118 }
119
120 public void InputNestedTernaryCheck() {
121 double x = (getSmth() || Math.random() == 5) ? null : (int) Math
122 .cos(400 * (10 + 40));
123 double y = (0.2 == Math.random()) ? (0.3 == Math.random()) ? null : (int) Math
124 .cos(400 * (10 + 40)) : 6;
125 double z = (Integer) ((0.2 == Math.random()) ? (Integer) null + apply(null)
126 : (0.3 == Math.random()) ? (Integer) null : (int) Math
127 .sin(300 * (12 + 30)));
128
129 }
130 public boolean getSmth() { return true; };
131 public int apply(Object o) { return 0; }
132
133 public void inClass(int type, Short s, int color) {
134 switch (type) {
135 case 3:
136 new Object() {
137 public void anonymousMethod() {
138 {
139 switch (s) {
140 case 5:
141 switch (type) {
142 default:
143 }
144 }
145 }
146 }
147 };
148 default:
149 new Object() {
150 class SwitchClass {
151 {
152 switch (color) {
153 case 5:
154 switch (type) {
155 default:
156 }
157 }
158 }
159 }
160 };
161 }
162 }
163 }