1
+ /**
2
+ * A package header
3
+ */
1
4
package test .scaladoc ;
2
5
3
6
/**
6
9
*/
7
10
public class JavaComments {
8
11
12
+ /** A field */
13
+ public final int x ;
14
+ /** A field */
15
+ protected int y ;
16
+ /** A field */
17
+ private int z ;
18
+
19
+ /**
20
+ * Inner class
21
+ */
22
+ public class Inner {
23
+ /** Inner method */
24
+ public void foo () {
25
+ }
26
+ }
27
+
28
+ /**
29
+ * A typed inner class
30
+ * @param <T> some type
31
+ */
32
+ public class InnerTyped <T > {
33
+ }
34
+
9
35
/**
10
36
* Compute the answer to the ultimate question of life, the
11
37
* universe, and everything. :marker:
@@ -16,5 +42,268 @@ public int answer(int factor) {
16
42
return 42 * factor ;
17
43
}
18
44
45
+ /** Private */
46
+ private double foo (double value ) {
47
+ return value ;
48
+ }
49
+
50
+ /** Protected */
51
+ protected double bar (double value ) {
52
+ return value ;
53
+ }
54
+
55
+ /** No qualifier*/
56
+ String noqualifier () {
57
+ return "something" ;
58
+ }
59
+
60
+ /** Void */
61
+ public void voidmethod (boolean t ) {
62
+ }
63
+
64
+ /**
65
+ * Typed parameter
66
+ * @param <A> the parameter type
67
+ * @param a parameter
68
+ * @return something
69
+ */
70
+ public <A > void tparams (A a ) {
71
+ }
72
+
73
+ /**
74
+ * Typed parameter
75
+ * @param <A> the return type
76
+ * @param <B> the parameter typeA
77
+ * @param b parameter
78
+ * @return casts B to A
79
+ */
80
+ public <A , B extends A > A cast (B b ) {
81
+ return (B ) b ;
82
+ }
83
+
19
84
}
20
85
86
+ // The following snippet is taken from Akka, it mainly tests interfaces
87
+
88
+ /**
89
+ * Class that encapsulates all the Functional Interfaces
90
+ * used for creating partial functions.
91
+ *
92
+ * This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
93
+ */
94
+ public final class FI {
95
+
96
+ /** Doc comment on constructor */
97
+ private FI () {
98
+ }
99
+
100
+ /**
101
+ * Functional interface for an application.
102
+ *
103
+ * @param <I> the input type, that this Apply will be applied to
104
+ * @param <R> the return type, that the results of the application will have
105
+ */
106
+ public static interface Apply <I , R > {
107
+ /**
108
+ * The application to perform.
109
+ *
110
+ * @param i an instance that the application is performed on
111
+ * @return the result of the application
112
+ */
113
+ public R apply (I i ) throws Exception ;
114
+ }
115
+
116
+ /**
117
+ * Functional interface for an application.
118
+ *
119
+ * @param <I1> the first input type, that this Apply will be applied to
120
+ * @param <I2> the second input type, that this Apply will be applied to
121
+ * @param <R> the return type, that the results of the application will have
122
+ */
123
+ public static interface Apply2 <I1 , I2 , R > {
124
+ /**
125
+ * The application to perform.
126
+ *
127
+ * @param i1 an instance that the application is performed on
128
+ * @param i2 an instance that the application is performed on
129
+ * @return the result of the application
130
+ */
131
+ public R apply (I1 i1 , I2 i2 ) throws Exception ;
132
+ }
133
+
134
+ /**
135
+ * Functional interface for a predicate.
136
+ *
137
+ * @param <T> the type that the predicate will operate on.
138
+ */
139
+ public static interface TypedPredicate <T > {
140
+ /**
141
+ * The predicate to evaluate.
142
+ *
143
+ * @param t an instance that the predicate is evaluated on.
144
+ * @return the result of the predicate
145
+ */
146
+ public boolean defined (T t );
147
+ }
148
+
149
+ /**
150
+ * Functional interface for a predicate.
151
+ *
152
+ * @param <T> the type that the predicate will operate on.
153
+ * @param <U> the type that the predicate will operate on.
154
+ */
155
+ public static interface TypedPredicate2 <T , U > {
156
+ /**
157
+ * The predicate to evaluate.
158
+ *
159
+ * @param t an instance that the predicate is evaluated on.
160
+ * @param u an instance that the predicate is evaluated on.
161
+ * @return the result of the predicate
162
+ */
163
+ public boolean defined (T t , U u );
164
+ }
165
+
166
+ /**
167
+ * Functional interface for an application.
168
+ *
169
+ * @param <I> the input type, that this Apply will be applied to
170
+ */
171
+ public static interface UnitApply <I > {
172
+ /**
173
+ * The application to perform.
174
+ *
175
+ * @param i an instance that the application is performed on
176
+ */
177
+ public void apply (I i ) throws Exception ;
178
+ }
179
+
180
+ /**
181
+ * Functional interface for an application.
182
+ *
183
+ * @param <I1> the first input type, that this Apply will be applied to
184
+ * @param <I2> the second input type, that this Apply will be applied to
185
+ */
186
+ public static interface UnitApply2 <I1 , I2 > {
187
+ /**
188
+ * The application to perform.
189
+ *
190
+ * @param i1 an instance that the application is performed on
191
+ * @param i2 an instance that the application is performed on
192
+ */
193
+ public void apply (I1 i1 , I2 i2 ) throws Exception ;
194
+ }
195
+
196
+ /**
197
+ * Functional interface for an application.
198
+ *
199
+ * @param <I1> the first input type, that this Apply will be applied to
200
+ * @param <I2> the second input type, that this Apply will be applied to
201
+ * @param <I3> the third input type, that this Apply will be applied to
202
+ */
203
+ public static interface UnitApply3 <I1 , I2 , I3 > {
204
+ /**
205
+ * The application to perform.
206
+ *
207
+ * @param i1 an instance that the application is performed on
208
+ * @param i2 an instance that the application is performed on
209
+ * @param i3 an instance that the application is performed on
210
+ */
211
+ public void apply (I1 i1 , I2 i2 , I3 i3 ) throws Exception ;
212
+ }
213
+
214
+ /**
215
+ * Functional interface for an application.
216
+ *
217
+ * @param <I1> the first input type, that this Apply will be applied to
218
+ * @param <I2> the second input type, that this Apply will be applied to
219
+ * @param <I3> the third input type, that this Apply will be applied to
220
+ * @param <I4> the fourth input type, that this Apply will be applied to
221
+ */
222
+ public static interface UnitApply4 <I1 , I2 , I3 , I4 > {
223
+ /**
224
+ * The application to perform.
225
+ *
226
+ * @param i1 an instance that the application is performed on
227
+ * @param i2 an instance that the application is performed on
228
+ * @param i3 an instance that the application is performed on
229
+ * @param i4 an instance that the application is performed on
230
+ */
231
+ public void apply (I1 i1 , I2 i2 , I3 i3 , I4 i4 ) throws Exception ;
232
+ }
233
+
234
+ /**
235
+ * Functional interface for an application.
236
+ */
237
+ public static interface UnitApplyVoid {
238
+ /**
239
+ * The application to perform.
240
+ */
241
+ public void apply () throws Exception ;
242
+ }
243
+
244
+ /**
245
+ * Package scoped functional interface for a predicate. Used internally to match against arbitrary types.
246
+ */
247
+ static interface Predicate {
248
+ /**
249
+ * The predicate to evaluate.
250
+ *
251
+ * @param o an instance that the predicate is evaluated on.
252
+ * @return the result of the predicate
253
+ */
254
+ public boolean defined (Object o );
255
+ }
256
+
257
+ /** comment about */
258
+ /** a comment about */
259
+ /** a comment */
260
+ void foo () {}
261
+
262
+ /** someone forgot to uncomment */
263
+ //void thisMethod() {}
264
+ /** and also this */
265
+ //void otherMethod() {}
266
+ }
267
+
268
+ /**
269
+ * Functional interface for an application.
270
+ *
271
+ * @param <I1> the first input type, that this Apply will be applied to
272
+ * @param <I2> the second input type, that this Apply will be applied to
273
+ * @param <I3> the third input type, that this Apply will be applied to
274
+ * @param <I4> the fourth input type, that this Apply will be applied to
275
+ */
276
+ public interface UnitApply4 <I1 , I2 , I3 , I4 > {
277
+ /**
278
+ * The application to perform.
279
+ *
280
+ * @param i1 an instance that the application is performed on
281
+ * @param i2 an instance that the application is performed on
282
+ * @param i3 an instance that the application is performed on
283
+ * @param i4 an instance that the application is performed on
284
+ */
285
+ public void apply (I1 i1 , I2 i2 , I3 i3 , I4 i4 ) throws Exception ;
286
+ }
287
+
288
+ /**
289
+ * Functional interface for an application.
290
+ */
291
+ public interface UnitApplyVoid {
292
+ /**
293
+ * The application to perform.
294
+ */
295
+ public void apply () throws Exception ;
296
+ }
297
+
298
+ /**
299
+ * Package scoped functional interface for a predicate. Used internally to match against arbitrary types.
300
+ */
301
+ interface Predicate {
302
+ /**
303
+ * The predicate to evaluate.
304
+ *
305
+ * @param o an instance that the predicate is evaluated on.
306
+ * @return the result of the predicate
307
+ */
308
+ public boolean defined (Object o );
309
+ }
0 commit comments