Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 287648 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java (+1589 lines)
Added Link Here
1
package org.eclipse.jdt.core.tests.compiler.parser;
2
3
import java.io.IOException;
4
5
public class TypeAnnotationSyntaxTest extends AbstractTypeAnnotationSyntaxTest {
6
7
	public TypeAnnotationSyntaxTest(String testName) {
8
		super(testName);
9
	}
10
11
// wild card bounds 
12
public void test0021() throws IOException  {
13
		String source = 
14
			"public class X {\n" +
15
			"	void foo(Map<? super @Typesafe Object, ? extends @NonNull String> m){\n" +
16
			"	}\n" +
17
			"}\n";
18
		String expectedUnitToString = 
19
			"public class X {\n" + 
20
			"  public X() {\n" + 
21
			"    super();\n" + 
22
			"  }\n" + 
23
			"  void foo(Map<? super @Typesafe Object, ? extends @NonNull String> m) {\n" + 
24
			"  }\n" + 
25
			"}\n"; 
26
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
27
	}
28
	//wild card bounds 
29
	public void test0021a() throws IOException  {
30
		String source = 
31
			"public class X {\n" +
32
			"	void foo(Map<? super @Typesafe Object[]@Marker @Normal(Value=10) @SingleMember(0)[][]," +
33
			"                ? extends @NonNull HashMap<@Positive Integer, @Negative Integer>> m){\n" +
34
			"	}\n" +
35
			"}\n";
36
		String expectedUnitToString = 
37
			"public class X {\n" + 
38
			"  public X() {\n" + 
39
			"    super();\n" + 
40
			"  }\n" + 
41
			"  void foo(Map<? super @Typesafe Object[] @Marker @Normal(Value = 10) @SingleMember(0) [][], ? extends @NonNull HashMap<@Positive Integer, @Negative Integer>> m) {\n" + 
42
			"  }\n" + 
43
			"}\n";
44
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
45
	}
46
	//ReferenceType : ReferenceType1, ReferenceType2, ReferenceType3 ...
47
	public void test0020() throws IOException  {
48
		String source = 	"public class X<@Marker A extends @Useless X1<@Readonly X2<@Marker X3<@ReadOnly String>>>> {\n" +
49
							"	A a;\n" +
50
							"	public static void main(String[] args) {\n" +
51
							"		@Useless X<@Usefull X1<@Readonly X2<@Marker X3<@NonNull String>>>> x;\n" +
52
							"       x = new @Useless X<@Usefull X1<@Uselss X2<@Usefull X3<@NonNull String>>>>();\n" +
53
							"		x.a = new @NonNull X1<@NonEmpty X2<@Marker X3<@English String>>>();\n" +
54
							"		x.a.a1 = new @Uselss X2<@Usefull X3<@English String>>();\n" +
55
							"		x.a.a1.a2 = new @Useless X3<@Hindi String>();\n" +
56
							"		x.a.a1.a2.a3 = \"SUCCESS\";\n" +
57
							"		System.out.println(x.a.a1.a2.a3);\n" +
58
							"	}\n" +
59
							"}\n" +
60
							"@Java5 class X1<@Useless A extends @Usefull X2<@Useless X3<@English String>>> {\n" +
61
							"	A a1;\n" +
62
							"}\n" +
63
							"class X2<@Java7 A extends @Java7 X3<@Java7 String>> {\n" +
64
							"	A a2;\n" +
65
							"}\n" +
66
							"@Java5 class X3<@Java7 A> {\n" +
67
							"	A a3;\n" +
68
							"}\n";
69
		String expectedUnitToString = 
70
			"public class X<@Marker A extends @Useless X1<@Readonly X2<@Marker X3<@ReadOnly String>>>> {\n" + 
71
			"  A a;\n" + 
72
			"  public X() {\n" + 
73
			"    super();\n" + 
74
			"  }\n" + 
75
			"  public static void main(String[] args) {\n" + 
76
			"    @Useless X<@Usefull X1<@Readonly X2<@Marker X3<@NonNull String>>>> x;\n" +
77
			"    x = new @Useless X<@Usefull X1<@Uselss X2<@Usefull X3<@NonNull String>>>>();\n" + 
78
			"    x.a = new @NonNull X1<@NonEmpty X2<@Marker X3<@English String>>>();\n" + 
79
			"    x.a.a1 = new @Uselss X2<@Usefull X3<@English String>>();\n" + 
80
			"    x.a.a1.a2 = new @Useless X3<@Hindi String>();\n" + 
81
			"    x.a.a1.a2.a3 = \"SUCCESS\";\n" + 
82
			"    System.out.println(x.a.a1.a2.a3);\n" + 
83
			"  }\n" + 
84
			"}\n" + 
85
			"@Java5 class X1<@Useless A extends @Usefull X2<@Useless X3<@English String>>> {\n" + 
86
			"  A a1;\n" + 
87
			"  X1() {\n" + 
88
			"    super();\n" + 
89
			"  }\n" + 
90
			"}\n" + 
91
			"class X2<@Java7 A extends @Java7 X3<@Java7 String>> {\n" + 
92
			"  A a2;\n" + 
93
			"  X2() {\n" + 
94
			"    super();\n" + 
95
			"  }\n" + 
96
			"}\n" + 
97
			"@Java5 class X3<@Java7 A> {\n" + 
98
			"  A a3;\n" + 
99
			"  X3() {\n" + 
100
			"    super();\n" + 
101
			"  }\n" + 
102
			"}\n";
103
		checkParse((CHECK_ALL & ~CHECK_INDEXING_PARSER), source.toCharArray(), null, "test001", expectedUnitToString);
104
	}
105
	//ReferenceType : type argument
106
	public void test0019() throws IOException  {
107
		String source = 	"@Deprecated public class X<@Useless Tx1 extends @NonNull String, @Usefull Tx2 extends @NonNull Comparable>  extends @Volatile XS<@NonNegative Tx2> {\n" +
108
							"\n" +
109
							"    public static void main(String[] args) {\n" +
110
							"        Integer w;\n" +
111
							"        w = new @Transient X<@Marker @Singlemember(10) @Normal(Value=10) String, Integer>().get(new @Positive Integer(12));\n" +
112
							"        w = new @Transient X<String, @Positive @Marker @Singlemember(10) @Normal(Value=10) Integer>().get(new @Positive Integer(12));\n" +
113
							"        w = new @Transient X<String, Integer>().get(new @Positive Integer(12));\n" +
114
							"        System.out.println(\"SUCCESS\");\n" +
115
							"    }\n" +
116
							"}\n" +
117
							"class XS <@Positive Txs> {\n" +
118
							"    Txs get(Txs t) @Readonly {\n" +
119
							"        return t;\n" +
120
							"    }\n" +
121
							"}\n";
122
	
123
						
124
		String expectedUnitToString = 
125
			"public @Deprecated class X<@Useless Tx1 extends @NonNull String, @Usefull Tx2 extends @NonNull Comparable> extends @Volatile XS<@NonNegative Tx2> {\n" + 
126
			"  public X() {\n" + 
127
			"    super();\n" + 
128
			"  }\n" + 
129
			"  public static void main(String[] args) {\n" + 
130
			"    Integer w;\n" + 
131
			"    w = new @Transient X<@Marker @Singlemember(10) @Normal(Value = 10) String, Integer>().get(new @Positive Integer(12));\n" + 
132
			"    w = new @Transient X<String, @Positive @Marker @Singlemember(10) @Normal(Value = 10) Integer>().get(new @Positive Integer(12));\n" + 
133
			"    w = new @Transient X<String, Integer>().get(new @Positive Integer(12));\n" + 
134
			"    System.out.println(\"SUCCESS\");\n" + 
135
			"  }\n" + 
136
			"}\n" + 
137
			"class XS<@Positive Txs> {\n" + 
138
			"  XS() {\n" + 
139
			"    super();\n" + 
140
			"  }\n" + 
141
			"  Txs get(Txs t) @Readonly  {\n" + 
142
			"    return t;\n" + 
143
			"  }\n" + 
144
			"}\n";
145
		checkParse((CHECK_ALL & ~CHECK_INDEXING_PARSER), source.toCharArray(), null, "test001", expectedUnitToString);
146
	}
147
	//ReferenceType : type argument
148
	public void test0019a() throws IOException  {
149
		String source = 	"@Deprecated public class X<@Useless Tx1 extends @NonNull String, @Usefull Tx2 extends @NonNull Comparable>  extends @Volatile XS<@NonNegative Tx2> {\n" +
150
							"\n" +
151
							"    public static void main(String[] args) {\n" +
152
							"        Integer w;\n" +
153
							"        w = new @Transient X<@Singlemember(10) String [] @Marker[] [], HashMap<@Readonly String, @Positive Integer>>().get(new @Positive Integer(12));\n" +
154
							"    }\n" +
155
							"}\n" +
156
							"class XS <@Positive Txs> {\n" +
157
							"    Txs get(Txs t) @Readonly {\n" +
158
							"        return null;\n" +
159
							"    }\n" +
160
							"}\n";
161
	
162
						
163
		String expectedUnitToString = 
164
			"public @Deprecated class X<@Useless Tx1 extends @NonNull String, @Usefull Tx2 extends @NonNull Comparable> extends @Volatile XS<@NonNegative Tx2> {\n" + 
165
			"  public X() {\n" + 
166
			"    super();\n" + 
167
			"  }\n" + 
168
			"  public static void main(String[] args) {\n" + 
169
			"    Integer w;\n" + 
170
			"    w = new @Transient X<@Singlemember(10) String[] @Marker [][], HashMap<@Readonly String, @Positive Integer>>().get(new @Positive Integer(12));\n" + 
171
			"  }\n" + 
172
			"}\n" + 
173
			"class XS<@Positive Txs> {\n" + 
174
			"  XS() {\n" + 
175
			"    super();\n" + 
176
			"  }\n" + 
177
			"  Txs get(Txs t) @Readonly  {\n" + 
178
			"    return null;\n" + 
179
			"  }\n" + 
180
			"}\n";
181
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
182
	}
183
	public void test0001() throws IOException  {
184
		String source = "@Marker class A extends String {}\n;" +
185
						"@Marker class B extends @Marker String {}\n" +
186
						"@Marker class C extends @Marker @SingleMember(0) String {}\n" +
187
						"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
188
						"@Marker class E extends String {}\n;";
189
	    
190
		String expectedUnitToString = 
191
			"@Marker class A extends String {\n" + 
192
			"  A() {\n" + 
193
			"    super();\n" + 
194
			"  }\n" + 
195
			"}\n" + 
196
			"@Marker class B extends @Marker String {\n" + 
197
			"  B() {\n" + 
198
			"    super();\n" + 
199
			"  }\n" + 
200
			"}\n" + 
201
			"@Marker class C extends @Marker @SingleMember(0) String {\n" + 
202
			"  C() {\n" + 
203
			"    super();\n" + 
204
			"  }\n" + 
205
			"}\n" + 
206
			"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + 
207
			"  D() {\n" + 
208
			"    super();\n" + 
209
			"  }\n" + 
210
			"}\n" + 
211
			"@Marker class E extends String {\n" + 
212
			"  E() {\n" + 
213
			"    super();\n" + 
214
			"  }\n" + 
215
			"}\n";
216
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
217
	}
218
	public void test0001a() throws IOException  {
219
		String source = "class A extends String {}\n;" +
220
						"class B extends @Marker String {}\n" +
221
						"class C extends @Marker @SingleMember(0) String {}\n" +
222
						"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
223
						"class E extends String {}\n;";
224
	    
225
		String expectedUnitToString = 
226
			"class A extends String {\n" + 
227
			"  A() {\n" + 
228
			"    super();\n" + 
229
			"  }\n" + 
230
			"}\n" + 
231
			"class B extends @Marker String {\n" + 
232
			"  B() {\n" + 
233
			"    super();\n" + 
234
			"  }\n" + 
235
			"}\n" + 
236
			"class C extends @Marker @SingleMember(0) String {\n" + 
237
			"  C() {\n" + 
238
			"    super();\n" + 
239
			"  }\n" + 
240
			"}\n" + 
241
			"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + 
242
			"  D() {\n" + 
243
			"    super();\n" + 
244
			"  }\n" + 
245
			"}\n" + 
246
			"class E extends String {\n" + 
247
			"  E() {\n" + 
248
			"    super();\n" + 
249
			"  }\n" + 
250
			"}\n";
251
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
252
	}
253
	public void test0002() throws IOException  {
254
		String source = "@Marker class A implements Comparable, " +
255
						"                   @Marker Serializable," +
256
						"                   Cloneable  {\n" +
257
						"}\n";
258
		String expectedUnitToString = 
259
			"@Marker class A implements Comparable, @Marker Serializable, Cloneable {\n" + 
260
			"  A() {\n" + 
261
			"    super();\n" + 
262
			"  }\n" + 
263
			"}\n";
264
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
265
	}
266
	public void test0002a() throws IOException  {
267
		String source = "@Marker class A implements Comparable, " +
268
						"                   @Marker @SingleMember(0) Serializable," +
269
						"                   Cloneable  {\n" +
270
						"}\n";
271
		String expectedUnitToString = 
272
			"@Marker class A implements Comparable, @Marker @SingleMember(0) Serializable, Cloneable {\n" + 
273
			"  A() {\n" + 
274
			"    super();\n" + 
275
			"  }\n" + 
276
			"}\n";
277
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
278
	}
279
	public void test0002b() throws IOException  {
280
		String source = "@Marker class A implements Comparable, " +
281
						"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
282
						"                   Cloneable  {\n" +
283
						"}\n";
284
		String expectedUnitToString = 
285
			"@Marker class A implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
286
			"  A() {\n" + 
287
			"    super();\n" + 
288
			"  }\n" + 
289
			"}\n";
290
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
291
	}
292
	public void test0002c() throws IOException  {
293
		String source = "@Marker class A implements @Marker Comparable, " +
294
						"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
295
						"                   @Marker Cloneable  {\n" +
296
						"}\n";
297
		String expectedUnitToString = 
298
			"@Marker class A implements @Marker Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, @Marker Cloneable {\n" +
299
			"  A() {\n" + 
300
			"    super();\n" + 
301
			"  }\n" + 
302
			"}\n";
303
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
304
	}
305
	public void test0003() throws IOException  {
306
		String source = "@Marker class A extends Object implements Comparable, " +
307
						"                   @Marker @SingleMember(10) @Normal(Value=0) Serializable," +
308
						"                   Cloneable  {\n" +
309
						"}\n";
310
		String expectedUnitToString = 
311
			"@Marker class A extends Object implements Comparable, @Marker @SingleMember(10) @Normal(Value = 0) Serializable, Cloneable {\n" +
312
			"  A() {\n" + 
313
			"    super();\n" + 
314
			"  }\n" + 
315
			"}\n";
316
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
317
	}
318
	public void test0003a() throws IOException  {
319
		String source = "@Marker class A extends @Marker Object implements Comparable, " +
320
						"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
321
						"                   Cloneable  {\n" +
322
						"}\n";
323
		String expectedUnitToString = 
324
			"@Marker class A extends @Marker Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
325
			"  A() {\n" + 
326
			"    super();\n" + 
327
			"  }\n" + 
328
			"}\n";
329
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
330
	}
331
	public void test0003b() throws IOException  {
332
		String source = "@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, " +
333
		"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
334
		"                   Cloneable  {\n" +
335
		"}\n";
336
		String expectedUnitToString = 
337
			"@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
338
			"  A() {\n" + 
339
			"    super();\n" + 
340
			"  }\n" + 
341
			"}\n";
342
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
343
	}
344
	public void test0003c() throws IOException  {
345
		String source = "@Marker class A extends @Marker @SingleMember(0) @Normal(Value=0) Object implements Comparable, " +
346
		"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
347
		"                   Cloneable  {\n" +
348
		"}\n";
349
		String expectedUnitToString = 
350
			"@Marker class A extends @Marker @SingleMember(0) @Normal(Value = 0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
351
			"  A() {\n" + 
352
			"    super();\n" + 
353
			"  }\n" + 
354
			"}\n";
355
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
356
	}
357
	public void test0004() throws IOException  {
358
		String source = "public class A  {\n" +
359
						"    int [] f [];\n" +
360
						"    @Marker String [] @Marker [] [] s [] @SingleMember(0) [] [] @Normal(Value = 0) [] [];\n" +
361
						"    float [] p [];\n" +
362
						"}\n";
363
		String expectedUnitToString = 
364
			"public class A {\n" + 
365
			"  int[][] f;\n" + 
366
			"  @Marker String[] @Marker [][][] @SingleMember(0) [][] @Normal(Value = 0) [][] s;\n" + 
367
			"  float[][] p;\n" + 
368
			"  public A() {\n" + 
369
			"    super();\n" + 
370
			"  }\n" + 
371
			"}\n";
372
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
373
	}
374
	public void test0005() throws IOException  {
375
		String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable  {\n" +
376
						"    int [] f [];\n" +
377
						"    @English String [] @NonNull [] s [] @Nullable [] [];\n" +
378
						"    float [] p [];\n" +
379
						"public static void main(String args[]) {\n" +
380
						"    @Readonly String @Nullable [] @NonNull[] s;\n" +
381
						"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
382
						"}\n" +
383
						"}\n";
384
		String expectedUnitToString = 
385
			"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
386
			"  int[][] f;\n" + 
387
			"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
388
			"  float[][] p;\n" + 
389
			"  public A() {\n" + 
390
			"    super();\n" + 
391
			"  }\n" + 
392
			"  public static void main(String[] args) {\n" + 
393
			"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
394
			"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
395
			"  }\n" + 
396
			"}\n";
397
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
398
	}
399
	public void test0005a() throws IOException  {
400
		String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable  {\n" +
401
						"    int [] f [];\n" +
402
						"    @English String [] @NonNull [] s [] @Nullable [] [];\n" +
403
						"    float [] p [];\n" +
404
						"public static void main(String args[]) {\n" +
405
						"    @Readonly String s;\n" +
406
						"	 s = new @Readonly String @NonNull[] @Nullable[] { {\"Hello\"}, {\"World\"}} [0][0];\n" +
407
						"}\n" +
408
						"}\n";
409
		String expectedUnitToString = 
410
			"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
411
			"  int[][] f;\n" + 
412
			"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
413
			"  float[][] p;\n" + 
414
			"  public A() {\n" + 
415
			"    super();\n" + 
416
			"  }\n" + 
417
			"  public static void main(String[] args) {\n" + 
418
			"    @Readonly String s;\n" + 
419
			"    s = new @Readonly String @NonNull [] @Nullable []{{\"Hello\"}, {\"World\"}}[0][0];\n" + 
420
			"  }\n" + 
421
			"}\n";
422
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
423
	}
424
	public void test0006() throws IOException  {
425
		String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable  {\n" +
426
						"    int [] f [];\n" +
427
						"    @English String [] @NonNull [] s [] @Nullable [] [];\n" +
428
						"    float [] p [];\n" +
429
						"public static int main(String args[]) [] @Marker[] [] @Marker @SingleMember(0) @Normal(Value=0) [] [] @Marker {\n" +
430
						"    @Readonly String @Nullable [] @NonNull[] s;\n" +
431
						"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
432
						"}\n" +
433
						"}\n";
434
		String expectedUnitToString = 
435
			"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
436
			"  int[][] f;\n" + 
437
			"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
438
			"  float[][] p;\n" + 
439
			"  public A() {\n" + 
440
			"    super();\n" + 
441
			"  }\n" + 
442
			"  public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker  {\n" +		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
443
			"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
444
			"  }\n" + 
445
			"}\n";
446
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
447
	
448
	}
449
	public void test0007() throws IOException  {
450
		String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable  {\n" +
451
						"    int [] f [];\n" +
452
						"    @English String [] @NonNull [] s [] @Nullable [] [];\n" +
453
						"    float [] p [];\n" +
454
						"public static int main(String args[]) [] @Marker[] [] @Marker @SingleMember(0) @Normal(Value=0) [] [] @Marker {\n" +
455
						"    @Readonly String @Nullable [] @NonNull[] s;\n" +
456
						"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
457
						"}\n" +
458
						"@Marker public A () @Marker @SingleMember(0) @Normal(Value=10) {}\n" +
459
						"}\n";
460
		String expectedUnitToString = 
461
			"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
462
			"  int[][] f;\n" + 
463
			"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
464
			"  float[][] p;\n" + 
465
			"  public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker  {\n" + 
466
			"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
467
			"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
468
			"  }\n" + 
469
			"  public @Marker A() @Marker @SingleMember(0) @Normal(Value = 10)  {\n" + 
470
			"    super();\n" + 
471
			"  }\n" + 
472
			"}\n";
473
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
474
	}
475
	// parameters
476
	public void test0008() throws IOException  {
477
		String source = "public class A {\n" +
478
						"@Marker public int [] @Marker [] [] main(int [] @SingleMember(10) [] [] args [] @Normal(Value = 10)[] []) [] @Marker [] [] @Marker {\n" +
479
						"}\n" +
480
						"}";
481
		String expectedUnitToString = 
482
			"public class A {\n" + 
483
			"  public A() {\n" + 
484
			"    super();\n" + 
485
			"  }\n" + 
486
			"  public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker  {\n" + 
487
			"  }\n" + 
488
			"}\n";
489
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
490
	}
491
	public void test0008a() throws IOException  {
492
		String source = "public class A {\n" +
493
						"@Marker public int [] @Marker [] [] main(String [] @SingleMember(10) [] [] args [] @Normal(Value = 10)[] []) [] @Marker [] [] @Marker {\n" +
494
						"}\n" +
495
						"}";
496
		String expectedUnitToString = 
497
			"public class A {\n" + 
498
			"  public A() {\n" + 
499
			"    super();\n" + 
500
			"  }\n" + 
501
			"  public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker  {\n" + 
502
			"  }\n" + 
503
			"}\n";
504
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
505
	}
506
	public void test0008b() throws IOException  {
507
		String source = "public class A {\n" +
508
						"@Marker public int [] @Marker [] [] main(HashMap<String, Object> [] @SingleMember(10) [] [] args [] @Normal(Value = 10)[] []) [] @Marker [] [] @Marker {\n" +
509
						"}\n" +
510
						"}";
511
		String expectedUnitToString = 
512
			"public class A {\n" + 
513
			"  public A() {\n" + 
514
			"    super();\n" + 
515
			"  }\n" + 
516
			"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker  {\n" + 
517
			"  }\n" + 
518
			"}\n";
519
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
520
	}
521
	public void test0008c() throws IOException  {
522
		String source = "public class A {\n" +
523
						"@Marker public int [] @Marker [] [] main(HashMap<String, Object>.Iterator [] @SingleMember(10) [] [] args [] @Normal(Value = 10)[] []) [] @Marker [] [] @Marker {\n" +
524
						"}\n" +
525
						"}";
526
		String expectedUnitToString = 
527
			"public class A {\n" + 
528
			"  public A() {\n" + 
529
			"    super();\n" + 
530
			"  }\n" + 
531
			"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker  {\n" + 
532
			"  }\n" + 
533
			"}\n";
534
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
535
	}
536
	// varargs annotation
537
	public void test0008d() throws IOException  {
538
		String source = "public class A {\n" +
539
						"@Marker public int [] @Marker [] [] main(int [] @SingleMember(10) [] [] @Marker ... args ) [] @Marker [] [] @Marker {\n" +
540
						"}\n" +
541
						"}";
542
		String expectedUnitToString = 
543
			"public class A {\n" + 
544
			"  public A() {\n" + 
545
			"    super();\n" + 
546
			"  }\n" + 
547
			"  public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][] @Marker ... args) @Marker  {\n" + 
548
			"  }\n" + 
549
			"}\n";
550
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
551
	}
552
	public void test0008e() throws IOException  {
553
		String source = "public class A {\n" +
554
						"@Marker public int [] @Marker [] [] main(String [] @SingleMember(10) [] [] @Marker ... args ) [] @Marker [] [] @Marker {\n" +
555
						"}\n" +
556
						"}";
557
		String expectedUnitToString = 
558
			"public class A {\n" + 
559
			"  public A() {\n" + 
560
			"    super();\n" + 
561
			"  }\n" + 
562
			"  public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][] @Marker ... args) @Marker  {\n" + 
563
			"  }\n" + 
564
			"}\n";
565
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
566
	}
567
	public void test0008f() throws IOException  {
568
		String source = "public class A {\n" +
569
						"@Marker public int [] @Marker [] [] main(HashMap<Integer,String> [] @SingleMember(10) [] [] @Marker ... args ) [] @Marker [] [] @Marker {\n" +
570
						"}\n" +
571
						"}";
572
		String expectedUnitToString = 
573
			"public class A {\n" + 
574
			"  public A() {\n" + 
575
			"    super();\n" + 
576
			"  }\n" + 
577
			"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>[] @SingleMember(10) [][] @Marker ... args) @Marker  {\n" + 
578
			"  }\n" + 
579
			"}\n";
580
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
581
	}
582
	public void test0008g() throws IOException  {
583
		String source = "public class A {\n" +
584
						"@Marker public int [] @Marker [] [] main(HashMap<Integer,String>.Iterator [] @SingleMember(10) [] [] @Marker ... args ) [] @Marker [] [] @Marker {\n" +
585
						"}\n" +
586
						"}";
587
		String expectedUnitToString = 
588
			"public class A {\n" + 
589
			"  public A() {\n" + 
590
			"    super();\n" + 
591
			"  }\n" + 
592
			"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>.Iterator[] @SingleMember(10) [][] @Marker ... args) @Marker  {\n" + 
593
			"  }\n" + 
594
			"}\n";
595
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
596
	}
597
	// local variables
598
	public void test0009() throws IOException  {
599
		String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable  {\n" +
600
						"public static void main(String args[]) {\n" +
601
						"    int [] f [];\n" +
602
						"    @English String [] @NonNull [] s [] @Nullable [] [];\n" +
603
						"    float [] p [];\n" +
604
						"}\n" +
605
						"}\n";
606
		String expectedUnitToString = 
607
			"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
608
			"  public A() {\n" + 
609
			"    super();\n" + 
610
			"  }\n" + 
611
			"  public static void main(String[] args) {\n" + 
612
			"    int[][] f;\n" + 
613
			"    @English String[] @NonNull [][] @Nullable [][] s;\n" + 
614
			"    float[][] p;\n" + 
615
			"  }\n" + 
616
			"}\n";
617
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
618
	}
619
	// type parameter
620
	public void test0010() throws IOException  {
621
		String source = "class A {\n" +
622
						"public <Integer, @Positive Integer, @Negative Integer, Integer> void foo() {\n" +
623
						"}\n" +
624
						"}\n";
625
		String expectedUnitToString = 
626
			"class A {\n" + 
627
			"  A() {\n" + 
628
			"    super();\n" + 
629
			"  }\n" +
630
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>void foo() {\n" + 
631
			"  }\n" + 
632
			"}\n";
633
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
634
	}
635
	// Type
636
	public void test0011() throws IOException  {
637
		String source = "class A {\n" +
638
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int foo() @Marker {\n" +
639
						"    return 0;\n" +
640
						"}\n" +
641
						"public <Integer, @Positive Integer, @Negative Integer, Integer> int bar() @Marker{\n" +
642
						"    return 0;\n" +
643
						"}\n" +
644
						"}\n";
645
		String expectedUnitToString = 
646
			"class A {\n" + 
647
			"  A() {\n" + 
648
			"    super();\n" + 
649
			"  }\n" + 
650
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int foo() @Marker  {\n" + 
651
			"    return 0;\n" +
652
			"  }\n" + 
653
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>int bar() @Marker  {\n" + 
654
			"    return 0;\n" +
655
			"  }\n" + 
656
			"}\n";
657
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
658
	}
659
	// Type
660
	public void test0011a() throws IOException  {
661
		String source = "class A {\n" +
662
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String foo() @Marker {\n" +
663
						"    return null;\n" +
664
						"}\n" +
665
						"public <Integer, @Positive Integer, @Negative Integer, Integer> String bar () @Marker {\n" +
666
						"    return null;\n" +
667
						"}\n" +
668
						"}\n";
669
		String expectedUnitToString = 
670
			"class A {\n" + 
671
			"  A() {\n" + 
672
			"    super();\n" + 
673
			"  }\n" + 
674
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String foo() @Marker  {\n" + 
675
			"    return null;\n" +
676
			"  }\n" + 
677
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>String bar() @Marker  {\n" + 
678
			"    return null;\n" +
679
			"  }\n" + 
680
			"}\n";
681
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
682
	}
683
	//Type
684
	public void test0011b() throws IOException  {
685
		String source = "class A {\n" +
686
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object> foo() @Marker {\n" +
687
						"    return null;\n" +
688
						"}\n" +
689
						"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object> bar () @Marker {\n" +
690
						"    return null;\n" +
691
						"}\n" +
692
						"}\n";
693
		String expectedUnitToString = 
694
			"class A {\n" + 
695
			"  A() {\n" + 
696
			"    super();\n" + 
697
			"  }\n" + 
698
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object> foo() @Marker  {\n" + 
699
			"    return null;\n" +
700
			"  }\n" + 
701
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object> bar() @Marker  {\n" + 
702
			"    return null;\n" +
703
			"  }\n" + 
704
			"}\n";
705
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
706
	}
707
	// Type
708
	public void test0011c() throws IOException  {
709
		String source = "class A {\n" +
710
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" +
711
						"    return null;\n" +
712
						"}\n" +
713
						"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator bar () @Marker {\n" +
714
						"    return null;\n" +
715
						"}\n" +
716
						"}\n";
717
		String expectedUnitToString = 
718
			"class A {\n" + 
719
			"  A() {\n" + 
720
			"    super();\n" + 
721
			"  }\n" + 
722
			"  public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker  {\n" + 
723
			"    return null;\n" +
724
			"  }\n" + 
725
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator bar() @Marker  {\n" + 
726
			"    return null;\n" +
727
			"  }\n" + 
728
			"}\n";
729
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
730
	}
731
	//Type
732
	public void test0011d() throws IOException  {
733
		String source = "class A {\n" +
734
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator [] @NonEmpty [] [] foo() @Marker {\n" +
735
						"    return null;\n" +
736
						"}\n" +
737
						"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator [] @NonEmpty [] [] bar () @Marker {\n" +
738
						"    return null;\n" +
739
						"}\n" +
740
						"}\n";
741
		String expectedUnitToString = 
742
			"class A {\n" + 
743
			"  A() {\n" + 
744
			"    super();\n" + 
745
			"  }\n" + 
746
			"  public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty [][] foo() @Marker  {\n" + 
747
			"    return null;\n" +
748
			"  }\n" + 
749
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator[] @NonEmpty [][] bar() @Marker  {\n" + 
750
			"    return null;\n" +
751
			"  }\n" + 
752
			"}\n";
753
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
754
	}
755
	//Type
756
	public void test0011e() throws IOException  {
757
		String source = "class A {\n" +
758
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int [] @NonEmpty[] [] foo() @Marker {\n" +
759
						"    return 0;\n" +
760
						"}\n" +
761
						"public <Integer, @Positive Integer, @Negative Integer, Integer> int [] @NonEmpty [] [] bar() @Marker{\n" +
762
						"    return 0;\n" +
763
						"}\n" +
764
						"}\n";
765
		String expectedUnitToString = 
766
			"class A {\n" + 
767
			"  A() {\n" + 
768
			"    super();\n" + 
769
			"  }\n" + 
770
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int[] @NonEmpty [][] foo() @Marker  {\n" + 
771
			"    return 0;\n" +
772
			"  }\n" + 
773
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>int[] @NonEmpty [][] bar() @Marker  {\n" + 
774
			"    return 0;\n" +
775
			"  }\n" + 
776
			"}\n";
777
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
778
	}
779
	// Type
780
	public void test0011f() throws IOException  {
781
		String source = "class A {\n" +
782
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String []@NonEmpty[][] foo() @Marker {\n" +
783
						"    return null;\n" +
784
						"}\n" +
785
						"public <Integer, @Positive Integer, @Negative Integer, Integer> String []@NonEmpty[][] bar () @Marker {\n" +
786
						"    return null;\n" +
787
						"}\n" +
788
						"}\n";
789
		String expectedUnitToString = 
790
			"class A {\n" + 
791
			"  A() {\n" + 
792
			"    super();\n" + 
793
			"  }\n" + 
794
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String[] @NonEmpty [][] foo() @Marker  {\n" + 
795
			"    return null;\n" +
796
			"  }\n" + 
797
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>String[] @NonEmpty [][] bar() @Marker  {\n" + 
798
			"    return null;\n" +
799
			"  }\n" + 
800
			"}\n";
801
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
802
	}
803
	//Type
804
	public void test0011g() throws IOException  {
805
		String source = "class A {\n" +
806
						"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object> [] @NonEmpty [] [] foo() @Marker {\n" +
807
						"    return null;\n" +
808
						"}\n" +
809
						"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object> []@NonEmpty[][] bar () @Marker {\n" +
810
						"    return null;\n" +
811
						"}\n" +
812
						"}\n";
813
		String expectedUnitToString = 
814
			"class A {\n" + 
815
			"  A() {\n" + 
816
			"    super();\n" + 
817
			"  }\n" + 
818
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object>[] @NonEmpty [][] foo() @Marker  {\n" + 
819
			"    return null;\n" +
820
			"  }\n" + 
821
			"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>[] @NonEmpty [][] bar() @Marker  {\n" + 
822
			"    return null;\n" +
823
			"  }\n" + 
824
			"}\n";
825
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
826
	}
827
	// Type0 field declaration.
828
	public void test0012() throws IOException  {
829
		String source = "public class A  {\n" +
830
						"    int [] f [];\n" +
831
						"    @Marker int k;\n" +
832
						"    float [] p [];\n" +
833
						"}\n";
834
		String expectedUnitToString = 
835
			"public class A {\n" + 
836
			"  int[][] f;\n" + 
837
			"  @Marker int k;\n" + 
838
			"  float[][] p;\n" + 
839
			"  public A() {\n" + 
840
			"    super();\n" + 
841
			"  }\n" + 
842
			"}\n";
843
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
844
	}
845
	//Type0 field declaration.
846
	public void test0012a() throws IOException  {
847
		String source = "public class A  {\n" +
848
						"    int [] f [];\n" +
849
						"    @Marker String k;\n" +
850
						"    float [] p [];\n" +
851
						"}\n";
852
		String expectedUnitToString = 
853
			"public class A {\n" + 
854
			"  int[][] f;\n" + 
855
			"  @Marker String k;\n" + 
856
			"  float[][] p;\n" + 
857
			"  public A() {\n" + 
858
			"    super();\n" + 
859
			"  }\n" + 
860
			"}\n";
861
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
862
	}
863
	//Type0 field declaration.
864
	public void test0012b() throws IOException  {
865
		String source = "public class A  {\n" +
866
						"    int [] f [];\n" +
867
						"    @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" +
868
						"    float [] p [];\n" +
869
						"}\n";
870
		String expectedUnitToString = 
871
			"public class A {\n" + 
872
			"  int[][] f;\n" + 
873
			"  @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" + 
874
			"  float[][] p;\n" + 
875
			"  public A() {\n" + 
876
			"    super();\n" + 
877
			"  }\n" + 
878
			"}\n";
879
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
880
	}
881
	//Type0 field declaration.
882
	public void test0012c() throws IOException  {
883
		String source = "public class A  {\n" +
884
						"    int [] f [];\n" +
885
						"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" +
886
						"    float [] p [];\n" +
887
						"}\n";
888
		String expectedUnitToString = 
889
			"public class A {\n" + 
890
			"  int[][] f;\n" + 
891
			"  @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" + 
892
			"  float[][] p;\n" + 
893
			"  public A() {\n" + 
894
			"    super();\n" + 
895
			"  }\n" + 
896
			"}\n";
897
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
898
	}
899
	//Type0 field declaration.
900
	public void test0012d() throws IOException  {
901
		String source = "public class A  {\n" +
902
						"    int [] f [];\n" +
903
						"    @Marker int [] @NonEmpty[] [] k;\n" +
904
						"    float [] p [];\n" +
905
						"}\n";
906
		String expectedUnitToString = 
907
			"public class A {\n" + 
908
			"  int[][] f;\n" + 
909
			"  @Marker int[] @NonEmpty [][] k;\n" + 
910
			"  float[][] p;\n" + 
911
			"  public A() {\n" + 
912
			"    super();\n" + 
913
			"  }\n" + 
914
			"}\n";
915
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
916
	}
917
	//Type0 field declaration.
918
	public void test0012e() throws IOException  {
919
		String source = "public class A  {\n" +
920
						"    int [] f [];\n" +
921
						"    @Marker String [] @NonEmpty[] []k;\n" +
922
						"    float [] p [];\n" +
923
						"}\n";
924
		String expectedUnitToString = 
925
			"public class A {\n" + 
926
			"  int[][] f;\n" + 
927
			"  @Marker String[] @NonEmpty [][] k;\n" + 
928
			"  float[][] p;\n" + 
929
			"  public A() {\n" + 
930
			"    super();\n" + 
931
			"  }\n" + 
932
			"}\n";
933
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
934
	}
935
	//Type0 field declaration.
936
	public void test0012f() throws IOException  {
937
		String source = "public class A  {\n" +
938
						"    int [] f [];\n" +
939
						"    @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty[] [] k;\n" +
940
						"    float [] p [];\n" +
941
						"}\n";
942
		String expectedUnitToString = 
943
			"public class A {\n" + 
944
			"  int[][] f;\n" + 
945
			"  @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] k;\n" + 
946
			"  float[][] p;\n" + 
947
			"  public A() {\n" + 
948
			"    super();\n" + 
949
			"  }\n" + 
950
			"}\n";
951
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
952
	}
953
	//Type0 field declaration.
954
	public void test0012g() throws IOException  {
955
		String source = "public class A  {\n" +
956
						"    int [] f [];\n" +
957
						"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[] [] k;\n" +
958
						"    float [] p [];\n" +
959
						"}\n";
960
		String expectedUnitToString = 
961
			"public class A {\n" + 
962
			"  int[][] f;\n" + 
963
			"  @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] k;\n" + 
964
			"  float[][] p;\n" + 
965
			"  public A() {\n" + 
966
			"    super();\n" + 
967
			"  }\n" + 
968
			"}\n";
969
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
970
	}
971
	//Type0 MethodHeaderName.
972
	public void test0013() throws IOException  {
973
		String source = "public class A  {\n" +
974
						"    public @Marker int foo() { return 0; }\n" +
975
						"    public int bar() { return 0; }\n" +
976
						"}\n";
977
		String expectedUnitToString = 
978
			"public class A {\n" + 
979
			"  public A() {\n" + 
980
			"    super();\n" + 
981
			"  }\n" + 
982
			"  public @Marker int foo() {\n" + 
983
			"    return 0;\n" + 
984
			"  }\n" + 
985
			"  public int bar() {\n" + 
986
			"    return 0;\n" + 
987
			"  }\n" + 
988
			"}\n";
989
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
990
	}
991
	//Type0 MethodHeaderName.
992
	public void test0013a() throws IOException  {
993
		String source = "public class A  {\n" +
994
						"    public @Marker String foo() { return null; }\n" +
995
						"    public String bar() { return null; }\n" +
996
						"}\n";
997
		String expectedUnitToString = 
998
			"public class A {\n" + 
999
			"  public A() {\n" + 
1000
			"    super();\n" + 
1001
			"  }\n" + 
1002
			"  public @Marker String foo() {\n" + 
1003
			"    return null;\n" + 
1004
			"  }\n" + 
1005
			"  public String bar() {\n" + 
1006
			"    return null;\n" + 
1007
			"  }\n" + 
1008
			"}\n";
1009
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1010
	}
1011
	//Type0 MethodHeaderName.
1012
	public void test0013b() throws IOException  {
1013
		String source = "public class A  {\n" +
1014
						"    public @Marker HashMap<@Positive Integer, @Negative Integer> foo() { return null; }\n" +
1015
						"    public HashMap<@Positive Integer, @Negative Integer>  bar() { return null; }\n" +
1016
						"}\n";
1017
		String expectedUnitToString = 
1018
			"public class A {\n" + 
1019
			"  public A() {\n" + 
1020
			"    super();\n" + 
1021
			"  }\n" + 
1022
			"  public @Marker HashMap<@Positive Integer, @Negative Integer> foo() {\n" + 
1023
			"    return null;\n" + 
1024
			"  }\n" + 
1025
			"  public HashMap<@Positive Integer, @Negative Integer> bar() {\n" + 
1026
			"    return null;\n" + 
1027
			"  }\n" + 
1028
			"}\n";
1029
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1030
	}
1031
	//Type0 MethodHeaderName.
1032
	public void test0013c() throws IOException  {
1033
		String source = "public class A  {\n" +
1034
						"    public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() { return null; }\n" +
1035
						"    public HashMap<@Positive Integer, @Negative Integer>.Iterator  bar() { return null; }\n" +
1036
						"}\n";
1037
		String expectedUnitToString = 
1038
			"public class A {\n" + 
1039
			"  public A() {\n" + 
1040
			"    super();\n" + 
1041
			"  }\n" + 
1042
			"  public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() {\n" + 
1043
			"    return null;\n" + 
1044
			"  }\n" + 
1045
			"  public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() {\n" + 
1046
			"    return null;\n" + 
1047
			"  }\n" + 
1048
			"}\n";
1049
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1050
	}
1051
	//Type0 MethodHeaderName.
1052
	public void test0013d() throws IOException  {
1053
		String source = "public class A  {\n" +
1054
						"    public @Marker int [] foo() @NonEmpty [] [] { return 0; }\n" +
1055
						"    public int [] @NonEmpty [] [] bar() { return 0; }\n" +
1056
						"}\n";
1057
		String expectedUnitToString = 
1058
			"public class A {\n" + 
1059
			"  public A() {\n" + 
1060
			"    super();\n" + 
1061
			"  }\n" + 
1062
			"  public @Marker int[] @NonEmpty [][] foo() {\n" + 
1063
			"    return 0;\n" + 
1064
			"  }\n" + 
1065
			"  public int[] @NonEmpty [][] bar() {\n" + 
1066
			"    return 0;\n" + 
1067
			"  }\n" + 
1068
			"}\n";
1069
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1070
	}
1071
	//Type0 MethodHeaderName.
1072
	public void test0013e() throws IOException  {
1073
		String source = "public class A  {\n" +
1074
						"    public @Marker String []  foo() @NonEmpty [] [] { return null; }\n" +
1075
						"    public String [] @NonEmpty [] [] bar() { return null; }\n" +
1076
						"}\n";
1077
		String expectedUnitToString = 
1078
			"public class A {\n" + 
1079
			"  public A() {\n" + 
1080
			"    super();\n" + 
1081
			"  }\n" + 
1082
			"  public @Marker String[] @NonEmpty [][] foo() {\n" + 
1083
			"    return null;\n" + 
1084
			"  }\n" + 
1085
			"  public String[] @NonEmpty [][] bar() {\n" + 
1086
			"    return null;\n" + 
1087
			"  }\n" + 
1088
			"}\n";
1089
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1090
	}
1091
	//Type0 MethodHeaderName.
1092
	public void test0013f() throws IOException  {
1093
		String source = "public class A  {\n" +
1094
						"    public @Marker HashMap<@Positive Integer, @Negative Integer> [] foo() @NonEmpty [] [] { return null; }\n" +
1095
						"    public HashMap<@Positive Integer, @Negative Integer>  [] @NonEmpty [] [] bar() { return null; }\n" +
1096
						"}\n";
1097
		String expectedUnitToString = 
1098
			"public class A {\n" + 
1099
			"  public A() {\n" + 
1100
			"    super();\n" + 
1101
			"  }\n" + 
1102
			"  public @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] foo() {\n" + 
1103
			"    return null;\n" + 
1104
			"  }\n" + 
1105
			"  public HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] bar() {\n" + 
1106
			"    return null;\n" + 
1107
			"  }\n" + 
1108
			"}\n";
1109
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1110
	}
1111
	//Type0 MethodHeaderName.
1112
	public void test0013g() throws IOException  {
1113
		String source = "public class A  {\n" +
1114
						"    public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[]  foo() @NonEmpty [] [] { return null; }\n" +
1115
						"    public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [] [] bar() { return null; }\n" +
1116
						"}\n";
1117
		String expectedUnitToString = 
1118
			"public class A {\n" + 
1119
			"  public A() {\n" + 
1120
			"    super();\n" + 
1121
			"  }\n" + 
1122
			"  public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] foo() {\n" + 
1123
			"    return null;\n" + 
1124
			"  }\n" + 
1125
			"  public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] bar() {\n" + 
1126
			"    return null;\n" + 
1127
			"  }\n" + 
1128
			"}\n";
1129
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1130
	}
1131
	//Type0 local variable declaration
1132
	public void test0014() throws IOException  {
1133
		String source = "public class A  {\n" +
1134
						"    public void foo() {\n" +
1135
						"        @Marker int p;\n" +
1136
						"        int q;\n" + 
1137
						"    }\n" +
1138
						"}\n";
1139
		String expectedUnitToString = 
1140
			"public class A {\n" + 
1141
			"  public A() {\n" + 
1142
			"    super();\n" + 
1143
			"  }\n" + 
1144
			"  public void foo() {\n" + 
1145
			"    @Marker int p;\n" + 
1146
			"    int q;\n" + 
1147
			"  }\n" + 
1148
			"}\n";
1149
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1150
	}
1151
	//Type0 local variable declaration
1152
	public void test0014a() throws IOException  {
1153
		String source = "public class A  {\n" +
1154
						"    public void foo() {\n" +
1155
						"        @Marker String p;\n" +
1156
						"        String q;\n" + 
1157
						"    }\n" +
1158
						"}\n";
1159
		String expectedUnitToString = 
1160
			"public class A {\n" + 
1161
			"  public A() {\n" + 
1162
			"    super();\n" + 
1163
			"  }\n" + 
1164
			"  public void foo() {\n" + 
1165
			"    @Marker String p;\n" + 
1166
			"    String q;\n" + 
1167
			"  }\n" + 
1168
			"}\n";
1169
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1170
	}
1171
	//Type0 local variable declaration
1172
	public void test0014b() throws IOException  {
1173
		String source = "public class A  {\n" +
1174
						"    public void foo() {\n" +
1175
						"        @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" +
1176
						"        HashMap<@Positive Integer, @Negative Integer> q;\n" + 
1177
						"    }\n" +
1178
						"}\n";
1179
		String expectedUnitToString = 
1180
			"public class A {\n" + 
1181
			"  public A() {\n" + 
1182
			"    super();\n" + 
1183
			"  }\n" + 
1184
			"  public void foo() {\n" + 
1185
			"    @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" + 
1186
			"    HashMap<@Positive Integer, @Negative Integer> q;\n" + 
1187
			"  }\n" + 
1188
			"}\n";
1189
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1190
	}
1191
	//Type0 local variable declaration
1192
	public void test0014c() throws IOException  {
1193
		String source = "public class A  {\n" +
1194
						"    public void foo() {\n" +
1195
						"        @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" +
1196
						"        HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + 
1197
						"    }\n" +
1198
						"}\n";
1199
		String expectedUnitToString = 
1200
			"public class A {\n" + 
1201
			"  public A() {\n" + 
1202
			"    super();\n" + 
1203
			"  }\n" + 
1204
			"  public void foo() {\n" + 
1205
			"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" + 
1206
			"    HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + 
1207
			"  }\n" + 
1208
			"}\n";
1209
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1210
	}
1211
	//Type0 local variable declaration
1212
	public void test0014d() throws IOException  {
1213
		String source = "public class A  {\n" +
1214
						"    public void foo() {\n" +
1215
						"        @Marker int [] @NonNull[] p @NonEmpty [] [];\n" +
1216
						"        int [] @NonNull[] q @NonEmpty [] [];\n" + 
1217
						"    }\n" +
1218
						"}\n";
1219
		String expectedUnitToString = 
1220
			"public class A {\n" + 
1221
			"  public A() {\n" + 
1222
			"    super();\n" + 
1223
			"  }\n" + 
1224
			"  public void foo() {\n" + 
1225
			"    @Marker int[] @NonNull [] @NonEmpty [][] p;\n" + 
1226
			"    int[] @NonNull [] @NonEmpty [][] q;\n" + 
1227
			"  }\n" + 
1228
			"}\n";
1229
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1230
	}
1231
	//Type0 local variable declaration
1232
	public void test0014e() throws IOException  {
1233
		String source = "public class A  {\n" +
1234
						"    public void foo() {\n" +
1235
						"        @Marker String [] @NonNull[] p @NonEmpty [] [];\n" +
1236
						"        String [] @NonNull[] q @NonEmpty [] [];\n" + 
1237
						"    }\n" +
1238
						"}\n";
1239
		String expectedUnitToString = 
1240
			"public class A {\n" + 
1241
			"  public A() {\n" + 
1242
			"    super();\n" + 
1243
			"  }\n" + 
1244
			"  public void foo() {\n" + 
1245
			"    @Marker String[] @NonNull [] @NonEmpty [][] p;\n" + 
1246
			"    String[] @NonNull [] @NonEmpty [][] q;\n" + 
1247
			"  }\n" + 
1248
			"}\n";
1249
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1250
	}
1251
	//Type0 local variable declaration
1252
	public void test0014f() throws IOException  {
1253
		String source = "public class A  {\n" +
1254
						"    public void foo() {\n" +
1255
						"        @Marker HashMap<@Positive Integer, @Negative Integer> [] @NonNull[] p @NonEmpty [] [];\n" +
1256
						"        HashMap<@Positive Integer, @Negative Integer> [] @NonNull[] q @NonEmpty [] [];\n" + 
1257
						"    }\n" +
1258
						"}\n";
1259
		String expectedUnitToString = 
1260
			"public class A {\n" + 
1261
			"  public A() {\n" + 
1262
			"    super();\n" + 
1263
			"  }\n" + 
1264
			"  public void foo() {\n" + 
1265
			"    @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] p;\n" + 
1266
			"    HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] q;\n" + 
1267
			"  }\n" + 
1268
			"}\n";
1269
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1270
	}
1271
	//Type0 local variable declaration
1272
	public void test0014g() throws IOException  {
1273
		String source = "public class A  {\n" +
1274
						"    public void foo() {\n" +
1275
						"        @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator [] @NonNull[] p @NonEmpty [] [];\n" +
1276
						"        HashMap<@Positive Integer, @Negative Integer>.Iterator [] @NonNull[] @NonEmpty [] [] q;\n" + 
1277
						"    }\n" +
1278
						"}\n";
1279
		String expectedUnitToString = 
1280
			"public class A {\n" + 
1281
			"  public A() {\n" + 
1282
			"    super();\n" + 
1283
			"  }\n" + 
1284
			"  public void foo() {\n" + 
1285
			"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] p;\n" + 
1286
			"    HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] q;\n" + 
1287
			"  }\n" + 
1288
			"}\n";
1289
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1290
	}
1291
	//Type0 foreach
1292
	public void test0015() throws IOException  {
1293
		String source = "public class A  {\n" +
1294
						"    public void foo() {\n" +
1295
						"        String @NonNull [] @Marker [] s @Readonly [];\n" +
1296
						"    	 for (@Readonly String @NonNull [] si @Marker [] : s) {}\n" +
1297
						"    	 for (String @NonNull [] sii @Marker [] : s) {}\n" +
1298
						"    }\n" +
1299
						"}\n";
1300
		String expectedUnitToString = 
1301
			"public class A {\n" + 
1302
			"  public A() {\n" + 
1303
			"    super();\n" + 
1304
			"  }\n" + 
1305
			"  public void foo() {\n" + 
1306
			"    String @NonNull [] @Marker [] @Readonly [] s;\n" + 
1307
			"    for (@Readonly String @NonNull [] @Marker [] si : s) \n" + 
1308
			"      {\n" + 
1309
			"      }\n" + 
1310
			"    for (String @NonNull [] @Marker [] sii : s) \n" + 
1311
			"      {\n" + 
1312
			"      }\n" + 
1313
			"  }\n" + 
1314
			"}\n";
1315
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1316
	}
1317
	//Type0 foreach
1318
	public void test0015a() throws IOException  {
1319
		String source = "public class A  {\n" +
1320
						"    public void foo() {\n" +
1321
						"        int @NonNull [] @Marker [] s @Readonly [];\n" +
1322
						"    	 for (@Readonly int @NonNull [] si @Marker [] : s) {}\n" +
1323
						"    	 for (int @NonNull [] sii @Marker [] : s) {}\n" +
1324
						"    }\n" +
1325
						"}\n";
1326
		String expectedUnitToString = 
1327
			"public class A {\n" + 
1328
			"  public A() {\n" + 
1329
			"    super();\n" + 
1330
			"  }\n" + 
1331
			"  public void foo() {\n" + 
1332
			"    int @NonNull [] @Marker [] @Readonly [] s;\n" + 
1333
			"    for (@Readonly int @NonNull [] @Marker [] si : s) \n" + 
1334
			"      {\n" + 
1335
			"      }\n" + 
1336
			"    for (int @NonNull [] @Marker [] sii : s) \n" + 
1337
			"      {\n" + 
1338
			"      }\n" + 
1339
			"  }\n" + 
1340
			"}\n";
1341
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1342
	}
1343
	// cast expression
1344
	public void test0016() throws IOException  {
1345
		String source = "public class Clazz {\n" +
1346
						"public static void main(String [] args) {\n" +
1347
						"int x;\n" +
1348
						"x = (Integer)\n" +
1349
						"(@Readonly Object)\n" +
1350
						"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator [] @Normal(Value=0)[] [] )\n" +
1351
						"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator [] @SingleMember(0)[] [] )\n" +
1352
						"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator [] @Marker[] [] )\n" +
1353
						"(@Readonly Object)\n" +
1354
						"(@Readonly HashMap<@Positive Integer, @Negative Integer> [] @Normal(Value=0)[] [] )\n" +
1355
						"(@Readonly HashMap<@Positive Integer, @Negative Integer> [] @SingleMember(0)[] [] )\n" +
1356
						"(@Readonly HashMap<@Positive Integer, @Negative Integer> [] @Marker[] [] )\n" +
1357
						"(@Readonly Object)\n" +
1358
						"(@Readonly String [] @Normal(Value=0)[] [] )\n" +
1359
						"(@Readonly String [] @SingleMember(0)[] [] )\n" +
1360
						"(@Readonly String [] @Marker[] [] )\n" +
1361
						"(@Readonly Object)\n" +
1362
						"(@Readonly int [] @Normal(Value=0)[] [] )\n" +
1363
						"(@Readonly int [] @SingleMember(0)[] [] )\n" +
1364
						"(@Readonly int [] @Marker[] [] )\n" +
1365
						"(@Readonly Object)\n" +
1366
						"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator)\n" +
1367
						"(@Readonly Object)\n" +
1368
						"(@Readonly HashMap<@Positive Integer, @Negative Integer>)\n" +
1369
						"(@Readonly Object)\n" +
1370
						"(@ReadOnly String)\n" +
1371
						"(@Readonly Object)\n" +
1372
						"(@Readonly int) 10;\n" +
1373
						"}\n" +
1374
						"}\n";
1375
		String expectedUnitToString = 
1376
			"public class Clazz {\n" + 
1377
			"  public Clazz() {\n" + 
1378
			"    super();\n" + 
1379
			"  }\n" + 
1380
			"  public static void main(String[] args) {\n" + 
1381
			"    int x;\n" + 
1382
			"    x = (Integer) (@Readonly Object) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0) [][]) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker [][]) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value = 0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker [][]) (@Readonly Object) (@Readonly String[] @Normal(Value = 0) [][]) (@Readonly String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (@Readonly Object) (@Readonly int[] @Normal(Value = 0) [][]) (@Readonly int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (@Readonly Object) ( @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>) (@Readonly Object) (@ReadOnly String) (@Readonly Object) (@Readonly int) 10;\n" + 
1383
			"  }\n" + 
1384
			"}\n";
1385
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1386
	}
1387
	//cast expression
1388
	public void test0016a() throws IOException  {
1389
		String source = "public class Clazz {\n" +
1390
						"public static void main(String [] args) {\n" +
1391
						"int x;\n" +
1392
						"x = (Integer)\n" +
1393
						"(Object)\n" +
1394
						"(@Readonly HashMap<Integer, @Negative Integer>.Iterator [] @Normal(Value=0)[] [] )\n" +
1395
						"(HashMap<@Positive Integer, Integer>.Iterator [] @SingleMember(0)[] [] )\n" +
1396
						"(@Readonly HashMap<Integer, @Negative Integer>.Iterator [] @Marker[] [] )\n" +
1397
						"(Object)\n" +
1398
						"(@Readonly HashMap<@Positive Integer, Integer> [] @Normal(Value=0)[] [] )\n" +
1399
						"(HashMap<Integer, @Negative Integer> [] @SingleMember(0)[] [] )\n" +
1400
						"(@Readonly HashMap<@Positive Integer, Integer> [] @Marker[] [] )\n" +
1401
						"(Object)\n" +
1402
						"(@Readonly String [] @Normal(Value=0)[] [] )\n" +
1403
						"(String [] @SingleMember(0)[] [] )\n" +
1404
						"(@Readonly String [] @Marker[] [] )\n" +
1405
						"(Object)\n" +
1406
						"(@Readonly int [] @Normal(Value=0)[] [] )\n" +
1407
						"(int [] @SingleMember(0)[] [] )\n" +
1408
						"(@Readonly int [] @Marker[] [] )\n" +
1409
						"(Object)\n" +
1410
						"(@Readonly HashMap<Integer, @Negative Integer>.Iterator)\n" +
1411
						"(Object)\n" +
1412
						"(@Readonly HashMap<@Positive Integer, Integer>)\n" +
1413
						"(Object)\n" +
1414
						"(@ReadOnly String)\n" +
1415
						"(Object)\n" +
1416
						"(@Readonly int) 10;\n" +
1417
						"}\n" +
1418
						"}\n";
1419
		String expectedUnitToString = 
1420
			"public class Clazz {\n" + 
1421
			"  public Clazz() {\n" + 
1422
			"    super();\n" + 
1423
			"  }\n" + 
1424
			"  public static void main(String[] args) {\n" + 
1425
			"    int x;\n" + 
1426
			"    x = (Integer) (Object) ( @Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) (HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0) [][]) ( @Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker [][]) (Object) (@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value = 0) [][]) (HashMap<Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, Integer>[] @Marker [][]) (Object) (@Readonly String[] @Normal(Value = 0) [][]) (String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (Object) (@Readonly int[] @Normal(Value = 0) [][]) (int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (Object) ( @Readonly HashMap<Integer, @Negative Integer>.Iterator) (Object) (@Readonly HashMap<@Positive Integer, Integer>) (Object) (@ReadOnly String) (Object) (@Readonly int) 10;\n" + 
1427
			"  }\n" + 
1428
			"}\n";
1429
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1430
	}
1431
	// instanceof checks 
1432
	public void test0017() throws IOException  {
1433
		String source = "public class Clazz {\n" +
1434
						"public static void main(Object o) {\n" +
1435
						"if (o instanceof @Readonly String) {\n" +
1436
						"} else if (o instanceof @Readonly int [] @NonEmpty[] [] ) {\n" +
1437
						"} else if (o instanceof @Readonly String [] @NonEmpty[] [] ) {\n" +
1438
						"} else if (o instanceof @Readonly HashMap<?,?> [] @NonEmpty[] [] ) {\n" +
1439
						"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator [] @NonEmpty[] [] ) {\n" +	
1440
						"} else if (o instanceof @Readonly HashMap<?,?>) {\n" +
1441
						"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) {\n" +
1442
						"}\n" +
1443
						"}\n" +
1444
						"}";
1445
		String expectedUnitToString = 
1446
			"public class Clazz {\n" + 
1447
			"  public Clazz() {\n" + 
1448
			"    super();\n" + 
1449
			"  }\n" + 
1450
			"  public static void main(Object o) {\n" + 
1451
			"    if ((o instanceof @Readonly String))\n" + 
1452
			"        {\n" + 
1453
			"        }\n" + 
1454
			"    else\n" + 
1455
			"        if ((o instanceof @Readonly int[] @NonEmpty [][]))\n" + 
1456
			"            {\n" + 
1457
			"            }\n" + 
1458
			"        else\n" + 
1459
			"            if ((o instanceof @Readonly String[] @NonEmpty [][]))\n" + 
1460
			"                {\n" + 
1461
			"                }\n" + 
1462
			"            else\n" + 
1463
			"                if ((o instanceof @Readonly HashMap<?, ?>[] @NonEmpty [][]))\n" + 
1464
			"                    {\n" + 
1465
			"                    }\n" + 
1466
			"                else\n" + 
1467
			"                    if ((o instanceof  @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][]))\n" + 
1468
			"                        {\n" + 
1469
			"                        }\n" + 
1470
			"                    else\n" + 
1471
			"                        if ((o instanceof @Readonly HashMap<?, ?>))\n" + 
1472
			"                            {\n" + 
1473
			"                            }\n" + 
1474
			"                        else\n" + 
1475
			"                            if ((o instanceof  @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator))\n" + 
1476
			"                                {\n" + 
1477
			"                                }\n" + 
1478
			"  }\n" + 
1479
			"}\n";
1480
		checkParse(source.toCharArray(), null, "test001", expectedUnitToString);
1481
	}
1482
	// assorted unclassified 
1483
	public void test0018() throws IOException  {
1484
		String source = "import java.util.HashMap;\n" +
1485
						"import java.util.Map; \n" +  
1486
						"\n" +
1487
						"public class Clazz <@A M extends @B String, @C N extends @D Comparable> extends\n" +
1488
						"								@E Object implements @F Comparable <@G Object> {\n" +
1489
						"	\n" +
1490
						"  Clazz(char [] ...args) @H { \n" +   
1491
						"   }\n" +
1492
						"   \n" +
1493
						"  int @I[] f @J[], g, h[], i@K[];\n" +
1494
						"  int @L[][]@M[] f2; \n" +
1495
						"   \n" +
1496
						"  Clazz (int @N [] @O... a) @Q {}\n" +
1497
						" int @R[]@S[] aa() {}\n" +
1498
						" \n" +
1499
						" int @T[]@U[]@V[] a () @W[]@X[]@Y[] @Z { return null; }\n" +
1500
						"   \n" +
1501
						"  public void main(String @A[] @B ... args) @C throws @D Exception {\n" +
1502
						"  	\n" +
1503
						"       HashMap<@E String, @F String> b1;\n" +
1504
						"      \n" +
1505
						"     int b; b = (@G int) 10;\n" +
1506
						"      \n" +
1507
						"     char @H[]@I[] ch; ch = (@K char @L[]@M[])(@N char @O[]@P[]) null;\n" +
1508
						"      \n" +
1509
						"      int [] i; i = new @Q int @R[10];\n" +
1510
						"       \n" +
1511
						"      \n" +
1512
						"   Integer w; w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" +
1513
						"    throw new @V Exception(\"test\");\n" +
1514
						"    boolean c; c  = null instanceof @W String;\n" +
1515
						"	} \n" +
1516
						" public <@X X, @Y Y> void foo(X x, Y @Z... y) {  \n" +
1517
						"	\n" +
1518
						"}\n" +
1519
						" \n" +
1520
						" void foo(Map<? super @A Object, ? extends @B String> m){}\n" +
1521
						" public int compareTo(Object arg0) {\n" +
1522
						"     return 0;\n" +
1523
						" }\n" +
1524
						"\n" +
1525
						"}\n" +
1526
						"class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" +
1527
						"	\n" +
1528
						"  public Integer get(Integer integer) {\n" +
1529
						"       return null;\n" +
1530
						"   }\n" +
1531
						"}\n";
1532
						
1533
						
1534
		String expectedUnitToString = "import java.util.HashMap;\n" + 
1535
									  "import java.util.Map;\n" + 
1536
									  "public class Clazz<@A M extends @B String, @C N extends @D Comparable> extends @E Object implements @F Comparable<@G Object> {\n" + 
1537
									  "  int @I [] @J [] f;\n" + 
1538
									  "  int @I [] g;\n" + 
1539
									  "  int @I [][] h;\n" + 
1540
									  "  int @I [] @K [] i;\n" + 
1541
									  "  int @L [][] @M [] f2;\n" + 
1542
									  "  Clazz(char[]... args) @H  {\n" + 
1543
									  "    super();\n" + 
1544
									  "  }\n" + 
1545
									  "  Clazz(int @N [] @O ... a) @Q  {\n" + 
1546
									  "    super();\n" + 
1547
									  "  }\n" + 
1548
									  "  int @R [] @S [] aa() {\n" + 
1549
									  "  }\n" + 
1550
									  "  int @T [] @U [] @V [] @W [] @X [] @Y [] a() @Z  {\n" + 
1551
									  "    return null;\n" + 
1552
									  "  }\n" + 
1553
									  "  public void main(String @A [] @B ... args) @C  throws @D Exception {\n" + 
1554
									  "    HashMap<@E String, @F String> b1;\n" + 
1555
									  "    int b;\n" +
1556
									  "    b = (@G int) 10;\n" + 
1557
									  "    char @H [] @I [] ch;\n" +
1558
									  "    ch = (@K char @L [] @M []) (@N char @O [] @P []) null;\n" + 
1559
									  "    int[] i;\n" +
1560
									  "    i = new @Q int @R [10];\n" + 
1561
									  "    Integer w;\n" +
1562
									  "    w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" + 
1563
									  "    throw new @V Exception(\"test\");\n" + 
1564
									  "    boolean c;\n" +
1565
									  "    c = (null instanceof @W String);\n" + 
1566
									  "  }\n" + 
1567
									  "  public <@X X, @Y Y>void foo(X x, Y @Z ... y) {\n" + 
1568
									  "  }\n" + 
1569
									  "  void foo(Map<? super @A Object, ? extends @B String> m) {\n" + 
1570
									  "  }\n" + 
1571
									  "  public int compareTo(Object arg0) {\n" + 
1572
									  "    return 0;\n" + 
1573
									  "  }\n" + 
1574
									  "}\n" + 
1575
									  "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" + 
1576
									  "  X() {\n" + 
1577
									  "    super();\n" + 
1578
									  "  }\n" + 
1579
									  "  public Integer get(Integer integer) {\n" + 
1580
									  "    return null;\n" + 
1581
									  "  }\n" + 
1582
									  "}\n";
1583
	    // indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
1584
		// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
1585
		checkParse((CHECK_ALL & ~CHECK_INDEXING_PARSER), source.toCharArray(), null, "test001", expectedUnitToString);
1586
	}
1587
1588
1589
}
(-)src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java (+495 lines)
Added Link Here
1
package org.eclipse.jdt.core.tests.compiler.parser;
2
3
import java.io.BufferedReader;
4
import java.io.File;
5
import java.io.FileInputStream;
6
import java.io.FileOutputStream;
7
import java.io.IOException;
8
import java.io.InputStreamReader;
9
import java.io.OutputStreamWriter;
10
import java.util.Locale;
11
12
import org.eclipse.jdt.core.compiler.CategorizedProblem;
13
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
14
import org.eclipse.jdt.core.tests.util.CompilerTestSetup;
15
import org.eclipse.jdt.core.tests.util.Util;
16
import org.eclipse.jdt.internal.codeassist.complete.CompletionParser;
17
import org.eclipse.jdt.internal.codeassist.select.SelectionParser;
18
import org.eclipse.jdt.internal.compiler.CompilationResult;
19
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
20
import org.eclipse.jdt.internal.compiler.DocumentElementParser;
21
import org.eclipse.jdt.internal.compiler.IDocumentElementRequestor;
22
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
23
import org.eclipse.jdt.internal.compiler.SourceElementParser;
24
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
25
import org.eclipse.jdt.internal.compiler.ast.Expression;
26
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
27
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
28
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
29
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
30
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
31
import org.eclipse.jdt.internal.compiler.parser.Parser;
32
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
33
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
34
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
35
import org.eclipse.jdt.internal.core.search.indexing.IndexingParser;
36
import org.eclipse.jdt.internal.core.util.CommentRecorderParser;
37
38
public abstract class AbstractTypeAnnotationSyntaxTest extends AbstractCompilerTest implements IDocumentElementRequestor, ISourceElementRequestor {
39
	
40
	protected static String  jsr308TestScratchArea = "c:\\Jsr308TestScratchArea";
41
	protected static final int CHECK_PARSER = 0x1;
42
	protected static final int CHECK_COMPLETION_PARSER = 0x2;
43
	private static final int CHECK_SELECTION_PARSER = 0x4;
44
	private static final int CHECK_DOCUMENT_ELEMENT_PARSER = 0x8;
45
	private static final int CHECK_COMMENT_RECORDER_PARSER = 0x10;
46
	private static final int CHECK_SOURCE_ELEMENT_PARSER = 0x20;
47
	protected static final int CHECK_INDEXING_PARSER = 0x40;
48
	protected static final int CHECK_JAVAC_PARSER = 0x80;
49
	protected static int CHECK_ALL = (CHECK_PARSER | CHECK_COMPLETION_PARSER | CHECK_SELECTION_PARSER |
50
											CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER |
51
											CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER);
52
	public static final String compiler = "C:\\jdk-7-ea-bin-b65-windows-i586-16_jul_2009\\jdk7\\bin\\javac.exe"; 
53
	public static boolean optimizeStringLiterals = false;
54
	
55
56
	
57
public void initialize(CompilerTestSetup setUp) {
58
	super.initialize(setUp);
59
}
60
public AbstractTypeAnnotationSyntaxTest(String testName){
61
	super(testName);
62
//	if ((new File(compiler).exists())) {
63
//		File f = new File(jsr308TestScratchArea);
64
//		if (!f.exists()) {
65
//			f.mkdir();
66
//		}
67
//		if (f.exists()) {
68
//			try {
69
//				OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Marker.java")));
70
//				w.write("@interface Marker {}\n".toCharArray());
71
//				w.close();
72
//				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Normal.java")));
73
//				w.write("@interface Normal {\n\tint value() default 10;\n}\n".toCharArray());
74
//				w.close();
75
//				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "SingleMember.java")));
76
//				w.write("@interface SingleMember {\n\tint value() default 10;\n}\n".toCharArray());
77
//				w.close();
78
//				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Positive.java")));
79
//				w.write("@interface Positive {}\n".toCharArray());
80
//				w.close();
81
//				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Negative.java")));
82
//				w.write("@interface Negative{}\n".toCharArray());
83
//				w.close();
84
//				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Readonly.java")));
85
//				w.write("@interface Readonly {}\n".toCharArray());
86
//				w.close();
87
//				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "HashMap.java")));
88
//				w.write("class HashMap<X,Y> {\n class Iterator {}; \n}\n".toCharArray());
89
//				w.close();
90
//				CHECK_ALL |= CHECK_JAVAC_PARSER;
91
//			} catch (IOException e) {
92
//				// ignore 
93
//			}
94
//		}
95
//	}	
96
}
97
public void checkParse(
98
	int parserToCheck,	
99
	char[] source,
100
	String expectedSyntaxErrorDiagnosis,
101
	String testName, String expectedUnitToString) throws IOException {
102
103
	CompilerOptions options = new CompilerOptions(getCompilerOptions());
104
	options.complianceLevel = ClassFileConstants.JDK1_7;
105
	options.sourceLevel = ClassFileConstants.JDK1_7;
106
	options.targetJDK = ClassFileConstants.JDK1_7;
107
108
	ICompilationUnit sourceUnit = null;
109
	CompilationResult compilationResult = null;
110
	CompilationUnitDeclaration unit = null;
111
	
112
	if ((parserToCheck & CHECK_JAVAC_PARSER) != 0) {
113
		String javaFilePath = jsr308TestScratchArea + "\\Xyz.java";
114
		File f = new File(javaFilePath);
115
		FileOutputStream o = new FileOutputStream(f);
116
		OutputStreamWriter w = new OutputStreamWriter(o);
117
		w.write(source);
118
		w.close();
119
		Process p = Runtime.getRuntime().exec (new String[] { compiler, "-sourcepath", jsr308TestScratchArea, javaFilePath }, null, new File(jsr308TestScratchArea));
120
		try {
121
			BufferedReader stdout  = new BufferedReader(new InputStreamReader(p.getInputStream()));            
122
			BufferedReader stderr  = new BufferedReader(new InputStreamReader(p.getErrorStream())); 
123
			String line;
124
			while ((line = stderr.readLine())!= null)
125
				System.out.println(line); 
126
			while ((line = stdout.readLine())!= null)
127
				System.out.println(line);
128
			assertTrue("javac unhappy", p.waitFor() == 0);
129
		} catch (InterruptedException e) {
130
			System.err.println("Skipped javac behavior check due to interrupt...");
131
		}
132
	}
133
	if ((parserToCheck & CHECK_PARSER) != 0) {
134
		Parser parser1 =
135
			new Parser(
136
					new ProblemReporter(
137
							DefaultErrorHandlingPolicies.proceedWithAllProblems(),
138
							options,
139
							new DefaultProblemFactory(Locale.getDefault())),
140
							optimizeStringLiterals);
141
		sourceUnit = new CompilationUnit(source, testName, null);
142
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
143
		unit = parser1.parse(sourceUnit, compilationResult);
144
		parser1.getMethodBodies(unit);
145
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
146
		assertParseTreeEquals(expectedUnitToString, unit.toString());
147
		parser1 = null;
148
	}
149
	
150
	if ((parserToCheck & CHECK_COMPLETION_PARSER) != 0) {
151
		CompletionParser parser2 = new CompletionParser(
152
				new ProblemReporter(
153
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
154
						options,
155
						new DefaultProblemFactory(Locale.getDefault())),
156
						false);
157
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
158
		unit = parser2.parse(sourceUnit, compilationResult, Integer.MAX_VALUE);
159
		parser2.getMethodBodies(unit);
160
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
161
		assertParseTreeEquals(expectedUnitToString, unit.toString());
162
		parser2 = null;
163
	}
164
	if ((parserToCheck & CHECK_SELECTION_PARSER) != 0) {
165
		SelectionParser parser3 = new SelectionParser(
166
				new ProblemReporter(
167
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
168
						options,
169
						new DefaultProblemFactory(Locale.getDefault())));
170
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
171
		unit = parser3.parse(sourceUnit, compilationResult, Integer.MAX_VALUE, Integer.MAX_VALUE);
172
		parser3.getMethodBodies(unit);
173
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
174
		assertParseTreeEquals(expectedUnitToString, unit.toString());
175
		parser3 = null;
176
	}
177
	if ((parserToCheck & CHECK_DOCUMENT_ELEMENT_PARSER) != 0) {
178
		DocumentElementParser parser4 = new DocumentElementParser(
179
				this, 
180
				new DefaultProblemFactory(Locale.getDefault()),
181
				options);
182
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
183
		unit = parser4.parse(sourceUnit, compilationResult);
184
		parser4.getMethodBodies(unit);
185
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
186
		assertParseTreeEquals(expectedUnitToString, unit.toString());
187
		parser4 = null;
188
	}
189
	if ((parserToCheck & CHECK_COMMENT_RECORDER_PARSER) != 0) {
190
		CommentRecorderParser parser5 = new CommentRecorderParser(
191
				new ProblemReporter(
192
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
193
						options,
194
						new DefaultProblemFactory(Locale.getDefault())),
195
						optimizeStringLiterals);
196
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
197
		unit = parser5.parse(sourceUnit, compilationResult);
198
		parser5.getMethodBodies(unit);
199
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
200
		assertParseTreeEquals(expectedUnitToString, unit.toString());
201
		parser5 = null;
202
	}
203
	if ((parserToCheck & CHECK_SOURCE_ELEMENT_PARSER) != 0) {
204
		SourceElementParser parser6 = new SourceElementParser(this, 
205
				new DefaultProblemFactory(Locale.getDefault()),
206
				options,
207
				true,
208
				optimizeStringLiterals);
209
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
210
		unit = parser6.parse(sourceUnit, compilationResult);
211
		parser6.getMethodBodies(unit);
212
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
213
		assertParseTreeEquals(expectedUnitToString, unit.toString());
214
		parser6 = null;
215
	}
216
	if ((parserToCheck & CHECK_INDEXING_PARSER) != 0) {
217
		IndexingParser parser7 = new IndexingParser(this, 
218
				new DefaultProblemFactory(Locale.getDefault()),
219
				options,
220
				true,
221
				optimizeStringLiterals, false);
222
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
223
		unit = parser7.parse(sourceUnit, compilationResult);
224
		parser7.getMethodBodies(unit);
225
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
226
		assertParseTreeEquals(expectedUnitToString, unit.toString());
227
		parser7 = null;
228
	}
229
}
230
public void checkParse(
231
		char[] source,
232
		String expectedSyntaxErrorDiagnosis,
233
		String testName, 
234
		String expectedUnitToString) throws IOException {
235
	checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString);
236
}
237
private void assertParseTreeEquals(String expectedUnitToString, String computedUnitToString) {
238
		if (expectedUnitToString == null) {  // just checking that we are able to digest.
239
			return;
240
		}
241
		if (!expectedUnitToString.equals(computedUnitToString)) {
242
			System.out.println(Util.displayString(computedUnitToString));
243
		}
244
		assertEquals("Parse Tree is wrong",
245
				Util.convertToIndependantLineDelimiter(expectedUnitToString),
246
				Util.convertToIndependantLineDelimiter(computedUnitToString));
247
}
248
private void assertDianosticEquals(String expectedSyntaxErrorDiagnosis,
249
		String testName, CompilationResult compilationResult) {
250
	String computedSyntaxErrorDiagnosis = getCompilerMessages(compilationResult);
251
	assertEquals(
252
		"Invalid syntax error diagnosis" + testName,
253
		Util.convertToIndependantLineDelimiter(expectedSyntaxErrorDiagnosis),
254
		Util.convertToIndependantLineDelimiter(computedSyntaxErrorDiagnosis));
255
}
256
private String getCompilerMessages(CompilationResult compilationResult) {
257
	StringBuffer buffer = new StringBuffer(100);
258
	if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
259
		CategorizedProblem[] problems = compilationResult.getAllProblems();
260
		int count = problems.length;
261
		int problemCount = 0;
262
		char[] unitSource = compilationResult.compilationUnit.getContents();
263
		for (int i = 0; i < count; i++) {
264
			if (problems[i] != null) {
265
				if (problemCount == 0)
266
					buffer.append("----------\n");
267
				problemCount++;
268
				buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING"));
269
				buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\'));
270
				try {
271
					buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource));
272
					buffer.append("\n");
273
					buffer.append(problems[i].getMessage());
274
					buffer.append("\n");
275
				} catch (Exception e) {
276
				}
277
				buffer.append("----------\n");
278
			}
279
		}
280
	}
281
	String computedSyntaxErrorDiagnosis = buffer.toString();
282
	return computedSyntaxErrorDiagnosis;
283
}
284
285
void traverse (File f) throws IOException {
286
if (f.isDirectory()) {
287
	File [] files = f.listFiles();
288
	for (int i = 0; i < files.length; i++) {
289
		traverse(files[i]);
290
	}
291
} else {
292
	if (f.getName().endsWith(".java")) {
293
		System.out.println(f.getCanonicalPath());
294
		char [] contents = new char[(int) f.length()];
295
		FileInputStream fs = new FileInputStream(f);
296
		InputStreamReader isr = new InputStreamReader(fs);
297
		isr.read(contents);
298
		checkParse(contents, null, f.getCanonicalPath(), null);
299
	}
300
}
301
}
302
public void _test000() throws IOException {
303
traverse(new File("C:\\jsr308tests"));
304
}
305
306
public void acceptImport(int declarationStart, int declarationEnd,
307
		int[] javaDocPositions, char[] name, int nameStartPosition,
308
		boolean onDemand, int modifiers) {
309
	
310
	
311
}
312
public void acceptInitializer(int declarationStart, int declarationEnd,
313
		int[] javaDocPositions, int modifiers, int modifiersStart,
314
		int bodyStart, int bodyEnd) {
315
	
316
	
317
}
318
public void acceptLineSeparatorPositions(int[] positions) {
319
	
320
	
321
}
322
public void acceptPackage(int declarationStart, int declarationEnd,
323
		int[] javaDocPositions, char[] name, int nameStartPosition) {
324
	
325
	
326
}
327
public void acceptProblem(CategorizedProblem problem) {
328
	
329
	
330
}
331
public void enterClass(int declarationStart, int[] javaDocPositions,
332
		int modifiers, int modifiersStart, int classStart, char[] name,
333
		int nameStart, int nameEnd, char[] superclass, int superclassStart,
334
		int superclassEnd, char[][] superinterfaces,
335
		int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
336
	
337
	
338
}
339
public void enterCompilationUnit() {
340
	
341
	
342
}
343
public void enterConstructor(int declarationStart, int[] javaDocPositions,
344
		int modifiers, int modifiersStart, char[] name, int nameStart,
345
		int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts,
346
		int[] parameterTypeEnds, char[][] parameterNames,
347
		int[] parameterNameStarts, int[] parameterNameEnds, int parametersEnd,
348
		char[][] exceptionTypes, int[] exceptionTypeStarts,
349
		int[] exceptionTypeEnds, int bodyStart) {
350
	
351
	
352
}
353
public void enterField(int declarationStart, int[] javaDocPositions,
354
		int modifiers, int modifiersStart, char[] type, int typeStart,
355
		int typeEnd, int typeDimensionCount, char[] name, int nameStart,
356
		int nameEnd, int extendedTypeDimensionCount,
357
		int extendedTypeDimensionEnd) {
358
	
359
	
360
}
361
public void enterInterface(int declarationStart, int[] javaDocPositions,
362
		int modifiers, int modifiersStart, int interfaceStart, char[] name,
363
		int nameStart, int nameEnd, char[][] superinterfaces,
364
		int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
365
	
366
	
367
}
368
public void enterMethod(int declarationStart, int[] javaDocPositions,
369
		int modifiers, int modifiersStart, char[] returnType,
370
		int returnTypeStart, int returnTypeEnd, int returnTypeDimensionCount,
371
		char[] name, int nameStart, int nameEnd, char[][] parameterTypes,
372
		int[] parameterTypeStarts, int[] parameterTypeEnds,
373
		char[][] parameterNames, int[] parameterNameStarts,
374
		int[] parameterNameEnds, int parametersEnd,
375
		int extendedReturnTypeDimensionCount,
376
		int extendedReturnTypeDimensionEnd, char[][] exceptionTypes,
377
		int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart) {
378
	
379
	
380
}
381
public void exitClass(int bodyEnd, int declarationEnd) {
382
	
383
	
384
}
385
public void exitCompilationUnit(int declarationEnd) {
386
	
387
	
388
}
389
public void exitConstructor(int bodyEnd, int declarationEnd) {
390
	
391
	
392
}
393
public void exitField(int bodyEnd, int declarationEnd) {
394
	
395
	
396
}
397
public void exitInterface(int bodyEnd, int declarationEnd) {
398
	
399
	
400
}
401
public void exitMethod(int bodyEnd, int declarationEnd) {
402
	
403
	
404
}
405
public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart,
406
		int sourceEnd) {
407
	
408
	
409
}
410
public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) {
411
	
412
	
413
}
414
public void acceptConstructorReference(char[] typeName, int argCount,
415
		int sourcePosition) {
416
	
417
	
418
}
419
public void acceptFieldReference(char[] fieldName, int sourcePosition) {
420
	
421
	
422
}
423
public void acceptImport(int declarationStart, int declarationEnd,
424
		char[][] tokens, boolean onDemand, int modifiers) {
425
	
426
	
427
}
428
public void acceptMethodReference(char[] methodName, int argCount,
429
		int sourcePosition) {
430
	
431
	
432
}
433
public void acceptPackage(ImportReference importReference) {
434
	
435
	
436
}
437
public void acceptTypeReference(char[][] typeName, int sourceStart,
438
		int sourceEnd) {
439
	
440
	
441
}
442
public void acceptTypeReference(char[] typeName, int sourcePosition) {
443
	
444
	
445
}
446
public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {
447
	
448
	
449
}
450
public void acceptUnknownReference(char[] name, int sourcePosition) {
451
	
452
	
453
}
454
public void enterConstructor(MethodInfo methodInfo) {
455
	
456
	
457
}
458
public void enterField(FieldInfo fieldInfo) {
459
	
460
	
461
}
462
public void enterInitializer(int declarationStart, int modifiers) {
463
	
464
	
465
}
466
public void enterMethod(MethodInfo methodInfo) {
467
	
468
	
469
}
470
public void enterType(TypeInfo typeInfo) {
471
	
472
	
473
}
474
public void exitConstructor(int declarationEnd) {
475
	
476
	
477
}
478
public void exitField(int initializationStart, int declarationEnd,
479
		int declarationSourceEnd) {
480
	
481
	
482
}
483
public void exitInitializer(int declarationEnd) {
484
	
485
	
486
}
487
public void exitMethod(int declarationEnd, Expression defaultValue) {
488
	
489
	
490
}
491
public void exitType(int declarationEnd) {
492
	
493
	
494
}
495
}

Return to bug 287648