1
2
3
4
5
6
7
8
9
10
11
12
13
14 package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses;
15
16 public class InputUnnecessaryParenthesesIfStatement {
17
18 void method(String sectionName) {
19 if ("Content".equals(sectionName) || "Overview".equals(sectionName)
20 || (!"A".equals(sectionName)
21 && !"AbstractClassName".equals(sectionName)
22 )) {
23 System.out.println("sd");
24 }
25 }
26
27 private void method() {
28 int x, y, z;
29 x = 0;
30 y = 0;
31
32 z = (x < y) ? x : y;
33
34 if ((x < y)
35 && (x > z)) {
36 return;
37 }
38
39 if (((x < y)
40 && (x > z))) {
41 return;
42 }
43
44 if (!(x <= y)
45 || (x >= z)) {
46 return;
47 }
48
49 if ((x == y)
50 || (x != z)) {
51 return;
52 }
53
54 if ((
55 (x == y)
56 || (x != z)
57 )) {
58 return;
59 }
60
61 if ((Integer.valueOf(x) instanceof Integer)
62 || Integer.valueOf(y) instanceof Integer) {
63 return;
64 }
65 if (x == ((y<z) ? y : z) &&
66 ((x>y && y>z)
67 || (!(x<z) && y>z))) {
68 return;
69 }
70 if ((x >= 0 && y <= 9)
71 || (z >= 5 && y <= 5)
72 || (z >= 3 && x <= 7)) {
73 return;
74 }
75 if(x>= 0 && (x<=8 || y<=11) && y>=8) {
76 return;
77 }
78 if((y>=11 && x<=5)
79 || (x<=12 && y>=8)) {
80 return;
81 }
82 }
83 private void check() {
84 String sectionName = "Some String";
85 if ("Some content".equals(sectionName) || "Some overview".equals(sectionName)
86 || (!"A".equals(sectionName)
87 && !"AbstractClassName".equals(sectionName)
88 )) {
89 return;
90 }
91
92 if (sectionName instanceof String && "Other Overview".equals(sectionName)
93 && (!"AbbreviationAsWordInName".equals(sectionName)
94 || !"AbstractClassName".equals(sectionName)
95 )) {
96 return;
97 }
98 }
99 private void UnaryAndPostfix() {
100 boolean x = true;
101 boolean y = true;
102 int a = 25;
103 if ((++a) >= 54 && x) {
104 return;
105 }
106 if ((~a) > -27
107 && (a-- < 30)) {
108 return;
109 }
110 if ((-a) != -27
111 && x) {
112 return;
113 }
114 }
115 }