1 package com.puppycrawl.tools.checkstyle.checks.coding.unnecessaryparentheses;
2 public class InputUnnecessaryParenthesesOperatorsAndCasts {
3 int f1() {
4 int x = 0;
5 for (int i = (0+1); ((i) < (6+6)); i += (1+0)) {
6 x += (i + 100);
7 (x) += (i + 100);
8 x = (x + i + 100);
9 (x) = (x + i + 100);
10 }
11
12 for (int i = (0+1); (i) < ((6+6)); i += (1+0)) {
13 System.identityHashCode("hi");
14 }
15
16 return (0);
17 }
18
19 private int f2(int arg1, double arg2) {
20 int x, a, b, c, d;
21 String e, f;
22
23 x = 0;
24 a = 0;
25 b = 0;
26 c = (a + b);
27 d = c - 1;
28
29 int i = (int) arg2;
30 i = ((int) arg2);
31
32 x += (i + 100 + arg1);
33 a = (a + b) * (c + d);
34 b = ((((a + b) * (c + d))));
35 c = (((a) <= b)) ? 0 : 1;
36 d = (a) + (b) * (600) / (int) (12.5f) + (int) (arg2);
37 e = ("this") + ("that") + ("is" + "other");
38 f = ("this is a really, really long string that should be truncated.");
39
40 return (x + a + b + d);
41 }
42
43 private boolean f3() {
44 int x = f2((1), (13.5));
45 boolean b = (true);
46 return (b);
47 }
48
49 public static int f4(int z, int a) {
50 int r = (z * a);
51 r = (a > z) ? a : z;
52 r = ((a > z) ? a : z);
53 r = (a > z) ? a : (z + z);
54 return (r * r - 1);
55 }
56
57 public void f5() {
58 int x, y;
59 x = 0;
60 y = 0;
61 if (x == y) {
62 print(x);
63 }
64 if ((x > y)) {
65 print(y);
66 }
67
68 while ((x < 10)) {
69 print(x++);
70 }
71
72 do {
73 print((y+=100));
74 } while (y < (4000));
75 }
76
77 private void f6(TypeA a) {
78 TypeB b = (TypeB) a;
79 TypeC c = ((TypeC) a);
80 int r = 12345;
81 r <<= (3);
82 TypeParameterized<String> d = ((TypeParameterized<String>) a);
83 }
84
85 private void print(int arg)
86 {
87 System.identityHashCode("arg = " + arg);
88 }
89
90 private int f7() {
91 String f;
92
93 f = ("12345678901234567890123");
94
95 return 0;
96 }
97
98 static class TypeParameterized<T> {}
99 static class TypeA extends TypeParameterized<String> {}
100 static class TypeB extends TypeA {}
101 static class TypeC extends TypeA {}
102 }