1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.finalparameters;
10
11 import javax.swing.AbstractAction;
12 import javax.swing.Action;
13 import java.awt.event.ActionEvent;
14
15
16
17
18
19 class InputFinalParameters
20 {
21
22 InputFinalParameters()
23 {
24 }
25
26
27 InputFinalParameters(String s)
28 {
29 }
30
31
32 InputFinalParameters(final Integer i)
33 {
34 }
35
36
37 InputFinalParameters(final @MyAnnotation33 Class<Object> i)
38 {
39 }
40
41
42 InputFinalParameters(@MyAnnotation33 Boolean i)
43 {
44 }
45
46
47 InputFinalParameters(String s, final Integer i)
48 {
49 }
50
51
52 void method()
53 {
54 }
55
56
57 void method(String s)
58 {
59 }
60
61
62 void method(final Integer i)
63 {
64 }
65
66
67 void method(@MyAnnotation33 final Object s)
68 {
69
70 }
71
72
73 void method(@MyAnnotation33 Class<Object> s)
74 {
75
76 }
77
78
79 void method(String s, final Integer i)
80 {
81 }
82
83
84 interface TestInterface
85 {
86 void method(String s);
87 }
88
89
90 void holder()
91 {
92 Action a = new AbstractAction()
93 {
94 public void actionPerformed(ActionEvent e)
95 {
96 }
97 void somethingElse(@MyAnnotation33 ActionEvent e)
98 {
99 }
100 };
101
102 Action b = new AbstractAction()
103 {
104 public void actionPerformed(final ActionEvent e)
105 {
106 }
107 void somethingElse(@MyAnnotation33 final ActionEvent e)
108 {
109 }
110 };
111 }
112
113
114 void methodA(java.lang.String aParam) {
115 }
116
117 void methodB(String[] args) {
118 }
119
120 void methodC(java.lang.String[] args) {
121 }
122
123
124 void method1()
125 {
126 try {
127 String.CASE_INSENSITIVE_ORDER.equals("");
128 }
129 catch (java.lang.NullPointerException npe) {
130 npe.getMessage();
131 }
132 catch (@MyAnnotation33 final ClassCastException e) {
133 e.getMessage();
134 }
135 catch (RuntimeException e) {
136 e.getMessage();
137 }
138 catch (@MyAnnotation33 NoClassDefFoundError e) {
139 e.getMessage();
140 }
141 }
142
143 native void method(int i);
144 }
145
146 abstract class AbstractClass
147 {
148 public abstract void abstractMethod(int aParam);
149 }
150
151 class Foo
152 {
153
154 public void Bar()
155 {
156 for(String s : someExpression())
157 {
158
159 }
160 for(final String s : someExpression())
161 {
162
163 }
164 for(@MyAnnotation33 String s : someExpression())
165 {
166
167 }
168 for(@MyAnnotation33 final String s : someExpression())
169 {
170
171 }
172 }
173
174 private String[] someExpression()
175 {
176 return null;
177 }
178 }
179
180 @interface MyAnnotation3 {
181 }