1
2
3
4
5
6
7 package com.puppycrawl.tools.checkstyle.checks.coding.simplifybooleanreturn;
8
9
10
11
12
13
14 public class InputSimplifyBooleanReturn
15 {
16
17 public static boolean isOddMillis()
18 {
19 boolean even = System.currentTimeMillis() % 2 == 0;
20
21
22 if (even == true) {
23 return false;
24 }
25 else {
26 return true;
27 }
28
29 }
30
31 public static boolean isOddMillis2()
32 {
33 boolean even = System.currentTimeMillis() % 2 == 0;
34
35 if (!even)
36 return true;
37 else
38 return false;
39 }
40
41 public static boolean giveMeTrue()
42 {
43 boolean tt = isOddMillis() || true;
44 boolean ff = isOddMillis() && false;
45 return !false || (true != false);
46 }
47
48 public void tryToProvokeNPE()
49 {
50 if (true) {
51 }
52 else {
53 }
54
55 if (true) {
56 return;
57 }
58 else {
59 return;
60 }
61 }
62
63 public boolean ifNoElse()
64 {
65 if (isOddMillis()) {
66 return true;
67 }
68 return false;
69 }
70
71 boolean a() {
72 boolean asd = false;
73 boolean dasa = true;
74
75 if (asd) {
76 return true;
77 } else {
78 return dasa;
79 }
80 }
81
82 boolean aa() {
83 boolean asd = false;
84 boolean dasa = true;
85
86 if (asd) {
87 return dasa;
88 } else {
89 return true;
90 }
91 }
92
93 boolean b() {
94 boolean asd = false;
95
96 if(asd);
97 else;
98
99 return true;
100 }
101 }