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

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java (+647 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.tests.compiler.parser;
16
17
import java.io.BufferedReader;
18
import java.io.File;
19
import java.io.FileInputStream;
20
import java.io.FileOutputStream;
21
import java.io.IOException;
22
import java.io.InputStreamReader;
23
import java.io.OutputStreamWriter;
24
import java.util.HashMap;
25
import java.util.Locale;
26
import java.util.Map;
27
28
import org.eclipse.jdt.core.compiler.CategorizedProblem;
29
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
30
import org.eclipse.jdt.core.tests.util.CompilerTestSetup;
31
import org.eclipse.jdt.core.tests.util.Util;
32
import org.eclipse.jdt.internal.codeassist.complete.CompletionParser;
33
import org.eclipse.jdt.internal.codeassist.select.SelectionParser;
34
import org.eclipse.jdt.internal.compiler.ASTVisitor;
35
import org.eclipse.jdt.internal.compiler.CompilationResult;
36
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
37
import org.eclipse.jdt.internal.compiler.DocumentElementParser;
38
import org.eclipse.jdt.internal.compiler.IDocumentElementRequestor;
39
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
40
import org.eclipse.jdt.internal.compiler.SourceElementParser;
41
import org.eclipse.jdt.internal.compiler.ast.Annotation;
42
import org.eclipse.jdt.internal.compiler.ast.Argument;
43
import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
44
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
45
import org.eclipse.jdt.internal.compiler.ast.Expression;
46
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
47
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
48
import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
49
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
50
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
51
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
52
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
53
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
54
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
55
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
56
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
57
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
58
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
59
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
60
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
61
import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
62
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
63
import org.eclipse.jdt.internal.compiler.parser.Parser;
64
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
65
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
66
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
67
import org.eclipse.jdt.internal.core.search.indexing.IndexingParser;
68
import org.eclipse.jdt.internal.core.util.CommentRecorderParser;
69
70
public abstract class AbstractTypeAnnotationSyntaxTest extends AbstractCompilerTest implements IDocumentElementRequestor, ISourceElementRequestor {
71
	static final class LocationPrinterVisitor extends ASTVisitor {
72
		Annotation[] primaryAnnotations;
73
		TypeReference enclosingReference;
74
		Map locations;
75
76
		public LocationPrinterVisitor() {
77
			this.locations = new HashMap();
78
		}
79
80
		public Map getLocations() {
81
			return this.locations;
82
		}
83
		public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
84
			Annotation[] annotations = fieldDeclaration.annotations;
85
			this.enclosingReference = fieldDeclaration.type;
86
			this.primaryAnnotations = annotations;
87
			return true;
88
		}
89
		public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
90
			this.primaryAnnotations = methodDeclaration.annotations;
91
			TypeReference returnType = methodDeclaration.returnType;
92
			if (returnType != null) {
93
				this.enclosingReference = returnType;
94
				returnType.traverse(this, scope);
95
			}
96
			if (methodDeclaration.thrownExceptions != null) {
97
				int thrownExceptionsLength = methodDeclaration.thrownExceptions.length;
98
				for (int i = 0; i < thrownExceptionsLength; i++) {
99
					TypeReference typeReference = methodDeclaration.thrownExceptions[i];
100
					this.enclosingReference = typeReference;
101
					this.primaryAnnotations = null;
102
					typeReference.traverse(this, scope);
103
				}
104
			}
105
			return false;
106
		}
107
		public boolean visit(Argument argument, ClassScope scope) {
108
			Annotation[] annotations = argument.annotations;
109
			this.enclosingReference = argument.type;
110
			this.primaryAnnotations = annotations;
111
			return true;
112
		}
113
		public boolean visit(Argument argument, BlockScope scope) {
114
			Annotation[] annotations = argument.annotations;
115
			this.enclosingReference = argument.type;
116
			this.primaryAnnotations = annotations;
117
			return true;
118
		}
119
		public boolean visit(MarkerAnnotation annotation, BlockScope scope) {
120
			if (this.enclosingReference != null) {
121
				storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null));
122
			}
123
			return false;
124
		}
125
		public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
126
			if (this.enclosingReference != null) {
127
				storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null));
128
			}
129
			return false;
130
		}
131
		public boolean visit(NormalAnnotation annotation, BlockScope scope) {
132
			if (this.enclosingReference != null) {
133
				storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null));
134
			}
135
			return false;
136
		}
137
		public void storeLocations(Annotation annotation, int[] tab) {
138
			String key = String.valueOf(annotation);
139
			if (this.locations.get(key) != null) {
140
				return;
141
			}
142
			if (tab == null) {
143
				this.locations.put(key, null);
144
				return;
145
			}
146
			StringBuffer buffer = new StringBuffer("{");
147
			for (int i = 0, max = tab.length; i < max; i++) {
148
				if (i > 0) {
149
					buffer.append(',');
150
				}
151
				buffer.append(tab[i]);
152
			}
153
			buffer.append('}');
154
			this.locations.put(key, String.valueOf(buffer));
155
		}
156
157
		public boolean visit(ArrayTypeReference arrayReference, BlockScope scope) {
158
			if (this.enclosingReference == null) return false;
159
			return true;
160
		}
161
		public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) {
162
			if (this.enclosingReference == null) return false;
163
			return true;
164
		}
165
		public boolean visit(SingleTypeReference typeReference, BlockScope scope) {
166
			if (this.enclosingReference == null) return false;
167
			return true;
168
		}
169
	}
170
	protected static String  jsr308TestScratchArea = "c:\\Jsr308TestScratchArea";
171
	protected static final int CHECK_PARSER = 0x1;
172
	protected static final int CHECK_COMPLETION_PARSER = 0x2;
173
	protected static final int CHECK_SELECTION_PARSER = 0x4;
174
	protected static final int CHECK_DOCUMENT_ELEMENT_PARSER = 0x8;
175
	protected static final int CHECK_COMMENT_RECORDER_PARSER = 0x10;
176
	protected static final int CHECK_SOURCE_ELEMENT_PARSER = 0x20;
177
	protected static final int CHECK_INDEXING_PARSER = 0x40;
178
	protected static final int CHECK_JAVAC_PARSER = 0x80;
179
	protected static int CHECK_ALL = (CHECK_PARSER | CHECK_COMPLETION_PARSER | CHECK_SELECTION_PARSER |
180
											CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER |
181
											CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER);
182
	public static final String compiler = "C:\\jdk-7-ea-bin-b75-windows-i586-30_oct_2009\\jdk7\\bin\\javac.exe";
183
	public static boolean optimizeStringLiterals = false;
184
185
186
187
public void initialize(CompilerTestSetup setUp) {
188
	super.initialize(setUp);
189
}
190
public AbstractTypeAnnotationSyntaxTest(String testName){
191
	super(testName);
192
	if ((new File(compiler).exists())) {
193
		File f = new File(jsr308TestScratchArea);
194
		if (!f.exists()) {
195
			f.mkdir();
196
		}
197
		if (f.exists()) {
198
			try {
199
				OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Marker.java")));
200
				w.write("@interface Marker {}\n".toCharArray());
201
				w.close();
202
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Normal.java")));
203
				w.write("@interface Normal {\n\tint value() default 10;\n}\n".toCharArray());
204
				w.close();
205
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "SingleMember.java")));
206
				w.write("@interface SingleMember {\n\tint value() default 10;\n}\n".toCharArray());
207
				w.close();
208
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Positive.java")));
209
				w.write("@interface Positive {}\n".toCharArray());
210
				w.close();
211
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Negative.java")));
212
				w.write("@interface Negative{}\n".toCharArray());
213
				w.close();
214
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Readonly.java")));
215
				w.write("@interface Readonly {}\n".toCharArray());
216
				w.close();
217
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "NonNull.java")));
218
				w.write("@interface NonNull {}\n".toCharArray());
219
				w.close();
220
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "HashMap.java")));
221
				w.write("class HashMap<X,Y> {\n class Iterator {}; \n}\n".toCharArray());
222
				w.close();
223
				CHECK_ALL |= CHECK_JAVAC_PARSER;
224
			} catch (IOException e) {
225
				// ignore
226
			}
227
		}
228
	}
229
}
230
public void checkParse(
231
		int parserToCheck,
232
		char[] source,
233
		String expectedSyntaxErrorDiagnosis,
234
		String testName, String expectedUnitToString,
235
		ASTVisitor visitor) throws IOException {
236
237
	CompilerOptions options = new CompilerOptions(getCompilerOptions());
238
	options.complianceLevel = ClassFileConstants.JDK1_7;
239
	options.sourceLevel = ClassFileConstants.JDK1_7;
240
	options.targetJDK = ClassFileConstants.JDK1_7;
241
242
	ICompilationUnit sourceUnit = null;
243
	CompilationResult compilationResult = null;
244
	CompilationUnitDeclaration unit = null;
245
246
	if ((parserToCheck & CHECK_JAVAC_PARSER) != 0) {
247
		String javaFilePath = jsr308TestScratchArea + "\\Xyz.java";
248
		File f = new File(javaFilePath);
249
		FileOutputStream o = new FileOutputStream(f);
250
		OutputStreamWriter w = new OutputStreamWriter(o);
251
		w.write(source);
252
		w.close();
253
		Process p = Runtime.getRuntime().exec (new String[] { compiler, "-sourcepath", jsr308TestScratchArea, javaFilePath }, null, new File(jsr308TestScratchArea));
254
		try {
255
			BufferedReader stdout  = new BufferedReader(new InputStreamReader(p.getInputStream()));
256
			BufferedReader stderr  = new BufferedReader(new InputStreamReader(p.getErrorStream()));
257
			String line;
258
			while ((line = stderr.readLine())!= null)
259
				System.out.println(line);
260
			while ((line = stdout.readLine())!= null)
261
				System.out.println(line);
262
			assertTrue("javac unhappy", p.waitFor() == 0);
263
		} catch (InterruptedException e) {
264
			System.err.println("Skipped javac behavior check due to interrupt...");
265
		}
266
	}
267
	if ((parserToCheck & CHECK_PARSER) != 0) {
268
		Parser parser1 =
269
			new Parser(
270
					new ProblemReporter(
271
							DefaultErrorHandlingPolicies.proceedWithAllProblems(),
272
							options,
273
							new DefaultProblemFactory(Locale.getDefault())),
274
							optimizeStringLiterals);
275
		sourceUnit = new CompilationUnit(source, testName, null);
276
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
277
		unit = parser1.parse(sourceUnit, compilationResult);
278
		parser1.getMethodBodies(unit);
279
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
280
		assertParseTreeEquals(expectedUnitToString, unit.toString());
281
		if (visitor != null) {
282
			unit.traverse(visitor, (CompilationUnitScope) null);
283
		}
284
		parser1 = null;
285
	}
286
287
	if ((parserToCheck & CHECK_COMPLETION_PARSER) != 0) {
288
		CompletionParser parser2 = new CompletionParser(
289
				new ProblemReporter(
290
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
291
						options,
292
						new DefaultProblemFactory(Locale.getDefault())),
293
						false);
294
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
295
		unit = parser2.parse(sourceUnit, compilationResult, Integer.MAX_VALUE);
296
		parser2.getMethodBodies(unit);
297
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
298
		assertParseTreeEquals(expectedUnitToString, unit.toString());
299
		parser2 = null;
300
	}
301
	if ((parserToCheck & CHECK_SELECTION_PARSER) != 0) {
302
		SelectionParser parser3 = new SelectionParser(
303
				new ProblemReporter(
304
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
305
						options,
306
						new DefaultProblemFactory(Locale.getDefault())));
307
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
308
		unit = parser3.parse(sourceUnit, compilationResult, Integer.MAX_VALUE, Integer.MAX_VALUE);
309
		parser3.getMethodBodies(unit);
310
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
311
		assertParseTreeEquals(expectedUnitToString, unit.toString());
312
		parser3 = null;
313
	}
314
	if ((parserToCheck & CHECK_DOCUMENT_ELEMENT_PARSER) != 0) {
315
		DocumentElementParser parser4 = new DocumentElementParser(
316
				this,
317
				new DefaultProblemFactory(Locale.getDefault()),
318
				options);
319
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
320
		unit = parser4.parse(sourceUnit, compilationResult);
321
		parser4.getMethodBodies(unit);
322
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
323
		assertParseTreeEquals(expectedUnitToString, unit.toString());
324
		parser4 = null;
325
	}
326
	if ((parserToCheck & CHECK_COMMENT_RECORDER_PARSER) != 0) {
327
		CommentRecorderParser parser5 = new CommentRecorderParser(
328
				new ProblemReporter(
329
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
330
						options,
331
						new DefaultProblemFactory(Locale.getDefault())),
332
						optimizeStringLiterals);
333
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
334
		unit = parser5.parse(sourceUnit, compilationResult);
335
		parser5.getMethodBodies(unit);
336
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
337
		assertParseTreeEquals(expectedUnitToString, unit.toString());
338
		parser5 = null;
339
	}
340
	if ((parserToCheck & CHECK_SOURCE_ELEMENT_PARSER) != 0) {
341
		SourceElementParser parser6 = new SourceElementParser(this,
342
				new DefaultProblemFactory(Locale.getDefault()),
343
				options,
344
				true,
345
				optimizeStringLiterals);
346
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
347
		unit = parser6.parse(sourceUnit, compilationResult);
348
		parser6.getMethodBodies(unit);
349
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
350
		assertParseTreeEquals(expectedUnitToString, unit.toString());
351
		parser6 = null;
352
	}
353
	if ((parserToCheck & CHECK_INDEXING_PARSER) != 0) {
354
		IndexingParser parser7 = new IndexingParser(this,
355
				new DefaultProblemFactory(Locale.getDefault()),
356
				options,
357
				true,
358
				optimizeStringLiterals, false);
359
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
360
		unit = parser7.parse(sourceUnit, compilationResult);
361
		parser7.getMethodBodies(unit);
362
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
363
		assertParseTreeEquals(expectedUnitToString, unit.toString());
364
		parser7 = null;
365
	}
366
}
367
public void checkParse(
368
		int parserToCheck,
369
		char[] source,
370
		String expectedSyntaxErrorDiagnosis,
371
		String testName,
372
		String expectedUnitToString) throws IOException {
373
	checkParse(parserToCheck, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, null);
374
}
375
public void checkParse(
376
		char[] source,
377
		String expectedSyntaxErrorDiagnosis,
378
		String testName, String expectedUnitToString) throws IOException {
379
	checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString);
380
}
381
public void checkParse(
382
		char[] source,
383
		String expectedSyntaxErrorDiagnosis,
384
		String testName, String expectedUnitToString,
385
		ASTVisitor visitor) throws IOException {
386
	checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, visitor);
387
}
388
private void assertParseTreeEquals(String expectedUnitToString, String computedUnitToString) {
389
		if (expectedUnitToString == null) {  // just checking that we are able to digest.
390
			return;
391
		}
392
		if (!expectedUnitToString.equals(computedUnitToString)) {
393
			System.out.println(Util.displayString(computedUnitToString));
394
		}
395
		assertEquals("Parse Tree is wrong",
396
				Util.convertToIndependantLineDelimiter(expectedUnitToString),
397
				Util.convertToIndependantLineDelimiter(computedUnitToString));
398
}
399
private void assertDianosticEquals(String expectedSyntaxErrorDiagnosis,
400
		String testName, CompilationResult compilationResult) {
401
	String computedSyntaxErrorDiagnosis = getCompilerMessages(compilationResult);
402
	assertEquals(
403
		"Invalid syntax error diagnosis" + testName,
404
		Util.convertToIndependantLineDelimiter(expectedSyntaxErrorDiagnosis),
405
		Util.convertToIndependantLineDelimiter(computedSyntaxErrorDiagnosis));
406
}
407
private String getCompilerMessages(CompilationResult compilationResult) {
408
	StringBuffer buffer = new StringBuffer(100);
409
	if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
410
		CategorizedProblem[] problems = compilationResult.getAllProblems();
411
		int count = problems.length;
412
		int problemCount = 0;
413
		char[] unitSource = compilationResult.compilationUnit.getContents();
414
		for (int i = 0; i < count; i++) {
415
			if (problems[i] != null) {
416
				if (problemCount == 0)
417
					buffer.append("----------\n");
418
				problemCount++;
419
				buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING"));
420
				buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\'));
421
				try {
422
					buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource));
423
					buffer.append("\n");
424
					buffer.append(problems[i].getMessage());
425
					buffer.append("\n");
426
				} catch (Exception e) {
427
				}
428
				buffer.append("----------\n");
429
			}
430
		}
431
	}
432
	String computedSyntaxErrorDiagnosis = buffer.toString();
433
	return computedSyntaxErrorDiagnosis;
434
}
435
436
void traverse (File f) throws IOException {
437
if (f.isDirectory()) {
438
	File [] files = f.listFiles();
439
	for (int i = 0; i < files.length; i++) {
440
		traverse(files[i]);
441
	}
442
} else {
443
	if (f.getName().endsWith(".java")) {
444
		System.out.println(f.getCanonicalPath());
445
		char [] contents = new char[(int) f.length()];
446
		FileInputStream fs = new FileInputStream(f);
447
		InputStreamReader isr = new InputStreamReader(fs);
448
		isr.read(contents);
449
		checkParse(contents, null, f.getCanonicalPath(), null);
450
	}
451
}
452
}
453
public void _test000() throws IOException {
454
traverse(new File("C:\\jsr308tests"));
455
}
456
457
public void acceptImport(int declarationStart, int declarationEnd,
458
		int[] javaDocPositions, char[] name, int nameStartPosition,
459
		boolean onDemand, int modifiers) {
460
461
462
}
463
public void acceptInitializer(int declarationStart, int declarationEnd,
464
		int[] javaDocPositions, int modifiers, int modifiersStart,
465
		int bodyStart, int bodyEnd) {
466
467
468
}
469
public void acceptLineSeparatorPositions(int[] positions) {
470
471
472
}
473
public void acceptPackage(int declarationStart, int declarationEnd,
474
		int[] javaDocPositions, char[] name, int nameStartPosition) {
475
476
477
}
478
public void acceptProblem(CategorizedProblem problem) {
479
480
481
}
482
public void enterClass(int declarationStart, int[] javaDocPositions,
483
		int modifiers, int modifiersStart, int classStart, char[] name,
484
		int nameStart, int nameEnd, char[] superclass, int superclassStart,
485
		int superclassEnd, char[][] superinterfaces,
486
		int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
487
488
489
}
490
public void enterCompilationUnit() {
491
492
493
}
494
public void enterConstructor(int declarationStart, int[] javaDocPositions,
495
		int modifiers, int modifiersStart, char[] name, int nameStart,
496
		int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts,
497
		int[] parameterTypeEnds, char[][] parameterNames,
498
		int[] parameterNameStarts, int[] parameterNameEnds, int parametersEnd,
499
		char[][] exceptionTypes, int[] exceptionTypeStarts,
500
		int[] exceptionTypeEnds, int bodyStart) {
501
502
503
}
504
public void enterField(int declarationStart, int[] javaDocPositions,
505
		int modifiers, int modifiersStart, char[] type, int typeStart,
506
		int typeEnd, int typeDimensionCount, char[] name, int nameStart,
507
		int nameEnd, int extendedTypeDimensionCount,
508
		int extendedTypeDimensionEnd) {
509
510
511
}
512
public void enterInterface(int declarationStart, int[] javaDocPositions,
513
		int modifiers, int modifiersStart, int interfaceStart, char[] name,
514
		int nameStart, int nameEnd, char[][] superinterfaces,
515
		int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
516
517
518
}
519
public void enterMethod(int declarationStart, int[] javaDocPositions,
520
		int modifiers, int modifiersStart, char[] returnType,
521
		int returnTypeStart, int returnTypeEnd, int returnTypeDimensionCount,
522
		char[] name, int nameStart, int nameEnd, char[][] parameterTypes,
523
		int[] parameterTypeStarts, int[] parameterTypeEnds,
524
		char[][] parameterNames, int[] parameterNameStarts,
525
		int[] parameterNameEnds, int parametersEnd,
526
		int extendedReturnTypeDimensionCount,
527
		int extendedReturnTypeDimensionEnd, char[][] exceptionTypes,
528
		int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart) {
529
530
531
}
532
public void exitClass(int bodyEnd, int declarationEnd) {
533
534
535
}
536
public void exitCompilationUnit(int declarationEnd) {
537
538
539
}
540
public void exitConstructor(int bodyEnd, int declarationEnd) {
541
542
543
}
544
public void exitField(int bodyEnd, int declarationEnd) {
545
546
547
}
548
public void exitInterface(int bodyEnd, int declarationEnd) {
549
550
551
}
552
public void exitMethod(int bodyEnd, int declarationEnd) {
553
554
555
}
556
public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart,
557
		int sourceEnd) {
558
559
560
}
561
public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) {
562
563
564
}
565
public void acceptConstructorReference(char[] typeName, int argCount,
566
		int sourcePosition) {
567
568
569
}
570
public void acceptFieldReference(char[] fieldName, int sourcePosition) {
571
572
573
}
574
public void acceptImport(int declarationStart, int declarationEnd,
575
		int nameStart, int nameEnd,
576
		char[][] tokens, boolean onDemand, int modifiers) {
577
578
579
}
580
public void acceptMethodReference(char[] methodName, int argCount,
581
		int sourcePosition) {
582
583
584
}
585
public void acceptPackage(ImportReference importReference) {
586
587
588
}
589
public void acceptTypeReference(char[][] typeName, int sourceStart,
590
		int sourceEnd) {
591
592
593
}
594
public void acceptTypeReference(char[] typeName, int sourcePosition) {
595
596
597
}
598
public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {
599
600
601
}
602
public void acceptUnknownReference(char[] name, int sourcePosition) {
603
604
605
}
606
public void enterConstructor(MethodInfo methodInfo) {
607
608
609
}
610
public void enterField(FieldInfo fieldInfo) {
611
612
613
}
614
public void enterInitializer(int declarationStart, int modifiers) {
615
616
617
}
618
public void enterMethod(MethodInfo methodInfo) {
619
620
621
}
622
public void enterType(TypeInfo typeInfo) {
623
624
625
}
626
public void exitConstructor(int declarationEnd) {
627
628
629
}
630
public void exitField(int initializationStart, int declarationEnd,
631
		int declarationSourceEnd) {
632
633
634
}
635
public void exitInitializer(int declarationEnd) {
636
637
638
}
639
public void exitMethod(int declarationEnd, Expression defaultValue) {
640
641
642
}
643
public void exitType(int declarationEnd) {
644
645
646
}
647
}
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java (-21 / +43 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 1477-1497 Link Here
1477
		expected13ProblemLog;
1481
		expected13ProblemLog;
1478
1482
1479
	String expected15ProblemLog =
1483
	String expected15ProblemLog =
1480
		"----------\n" +
1484
		"----------\n" + 
1481
		"1. WARNING in X.java (at line 1)\n" +
1485
		"1. WARNING in X.java (at line 1)\n" + 
1482
		"	public class X <T1 extends String, T2 extends Y {\n" +
1486
		"	public class X <T1 extends String, T2 extends Y {\n" + 
1483
		"	                           ^^^^^^\n" +
1487
		"	                           ^^^^^^\n" + 
1484
		"The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" +
1488
		"The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + 
1485
		"----------\n" +
1489
		"----------\n" + 
1486
		"2. ERROR in X.java (at line 1)\n" +
1490
		"2. ERROR in X.java (at line 1)\n" + 
1487
		"	public class X <T1 extends String, T2 extends Y {\n" +
1491
		"	public class X <T1 extends String, T2 extends Y {\n" + 
1488
		"	                                              ^\n" +
1492
		"	                                              ^\n" + 
1489
		"Syntax error, insert \">\" to complete ReferenceType1\n" +
1493
		"Syntax error, insert \"AdditionalBoundList1\" to complete TypeParameter1\n" + 
1490
		"----------\n" +
1494
		"----------\n" + 
1491
		"3. ERROR in X.java (at line 1)\n" +
1495
		"3. ERROR in X.java (at line 1)\n" + 
1492
		"	public class X <T1 extends String, T2 extends Y {\n" +
1496
		"	public class X <T1 extends String, T2 extends Y {\n" + 
1493
		"	                                              ^\n" +
1497
		"	                                              ^\n" + 
1494
		"Y cannot be resolved to a type\n" +
1498
		"Y cannot be resolved to a type\n" + 
1495
		"----------\n";
1499
		"----------\n";
1496
1500
1497
	runComplianceParserTest(
1501
	runComplianceParserTest(
Lines 1755-1765 Link Here
1755
		"Syntax error on token \"T2\", delete this token\n" +
1759
		"Syntax error on token \"T2\", delete this token\n" +
1756
		"----------\n";
1760
		"----------\n";
1757
1761
1762
	String expected17ProblemLog =
1763
		"----------\n" + 
1764
		"1. ERROR in X.java (at line 2)\n" + 
1765
		"	public <T1 extends String T2> int foo(){\n" + 
1766
		"	                   ^^^^^^\n" + 
1767
		"Syntax error on token \"String\", strictfp expected\n" + 
1768
		"----------\n";
1769
1758
	runComplianceParserTest(
1770
	runComplianceParserTest(
1759
		testFiles,
1771
		testFiles,
1760
		expected13ProblemLog,
1772
		expected13ProblemLog,
1761
		expected14ProblemLog,
1773
		expected14ProblemLog,
1762
		expected15ProblemLog
1774
		expected15ProblemLog,
1775
		expected17ProblemLog
1763
	);
1776
	);
1764
}
1777
}
1765
public void test0039() {
1778
public void test0039() {
Lines 1817-1823 Link Here
1817
		"----------\n" +
1830
		"----------\n" +
1818
		"1. ERROR in X.java (at line 2)\n" +
1831
		"1. ERROR in X.java (at line 2)\n" +
1819
		"	Z <Y1, Y2 var;\n" +
1832
		"	Z <Y1, Y2 var;\n" +
1820
		"	  ^^^^^^^\n" +
1833
		"	^^^^^^\n" +
1821
		"Syntax error on token(s), misplaced construct(s)\n" +
1834
		"Syntax error on token(s), misplaced construct(s)\n" +
1822
		"----------\n" +
1835
		"----------\n" +
1823
		"2. ERROR in X.java (at line 2)\n" +
1836
		"2. ERROR in X.java (at line 2)\n" +
Lines 1860-1867 Link Here
1860
		"----------\n" +
1873
		"----------\n" +
1861
		"1. ERROR in X.java (at line 2)\n" +
1874
		"1. ERROR in X.java (at line 2)\n" +
1862
		"	Z <Y1, for Y2> var;\n" +
1875
		"	Z <Y1, for Y2> var;\n" +
1863
		"	  ^^^^^^^^^^^^\n" +
1876
		"	^^^^^^^^^^^^^^\n" +
1864
		"Syntax error on tokens, delete these tokens\n" +
1877
		"Syntax error on tokens, Type expected instead\n" +
1865
		"----------\n";
1878
		"----------\n";
1866
	String expected14ProblemLog =
1879
	String expected14ProblemLog =
1867
		expected13ProblemLog;
1880
		expected13ProblemLog;
Lines 1874-1884 Link Here
1874
		"Syntax error on token \"for\", delete this token\n" +
1887
		"Syntax error on token \"for\", delete this token\n" +
1875
		"----------\n";
1888
		"----------\n";
1876
1889
1890
	String expected17ProblemLog =
1891
		"----------\n" + 
1892
		"1. ERROR in X.java (at line 2)\n" + 
1893
		"	Z <Y1, for Y2> var;\n" + 
1894
		"	       ^^^\n" + 
1895
		"Syntax error on token \"for\", final expected\n" + 
1896
		"----------\n";
1897
		
1877
	runComplianceParserTest(
1898
	runComplianceParserTest(
1878
		testFiles,
1899
		testFiles,
1879
		expected13ProblemLog,
1900
		expected13ProblemLog,
1880
		expected14ProblemLog,
1901
		expected14ProblemLog,
1881
		expected15ProblemLog
1902
		expected15ProblemLog,
1903
		expected17ProblemLog
1882
	);
1904
	);
1883
}
1905
}
1884
public void test0042() {
1906
public void test0042() {
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java (-14 / +17 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 2527-2546 Link Here
2527
		"}\n";
2531
		"}\n";
2528
2532
2529
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString;
2533
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString;
2530
	if (this.complianceLevel <= ClassFileConstants.JDK1_4) {
2534
	
2531
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
2535
	expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
2532
			"public class WB2 {\n" +
2536
			"public class WB2 {\n" +
2533
			"  public WB2() {\n" +
2537
			"  public WB2() {\n" +
2534
			"    super();\n" +
2538
			"    super();\n" +
2535
			"  }\n" +
2539
			"  }\n" +
2536
			"  public void foo() {\n" +
2540
			"  public void foo() {\n" +
2537
			"    java.util.Locale.java.util.Vector $missing$;\n" +
2541
			"    java.util.Locale $missing$;\n" + 
2542
			"    java.util.Locale java;\n" +
2538
			"  }\n" +
2543
			"  }\n" +
2539
			"}\n";
2544
			"}\n";
2540
	} else {
2541
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
2542
			expectedDietPlusBodyUnitToString;
2543
	}
2544
2545
2545
	String expectedFullUnitToString = expectedDietUnitToString;
2546
	String expectedFullUnitToString = expectedDietUnitToString;
2546
2547
Lines 4642-4655 Link Here
4642
		"        super();\n" +
4643
		"        super();\n" +
4643
		"      }\n" +
4644
		"      }\n" +
4644
		"      int hello() {\n" +
4645
		"      int hello() {\n" +
4645
		"        fo = $missing$;\n" +
4646
		"        fo $missing$;\n" + 
4646
		"      }\n" +
4647
		"      }\n" +
4647
		"      int world() {\n" +
4648
		"      int world() {\n" +
4648
		"      }\n" +
4649
		"      }\n" +
4649
		"      void foo() {\n" +
4650
		"      void foo() {\n" +
4650
		"      }\n" +
4651
		"      }\n" +
4651
		"    }\n" +
4652
		"    }\n" +
4652
		"    ba = $missing$;\n" +
4653
		"    ba $missing$;\n" +
4653
		"  }\n" +
4654
		"  }\n" +
4654
		"}\n";
4655
		"}\n";
4655
4656
Lines 4844-4850 Link Here
4844
		"    else\n" +
4845
		"    else\n" +
4845
		"        if ((depth > 1))\n" +
4846
		"        if ((depth > 1))\n" +
4846
		"            {\n" +
4847
		"            {\n" +
4847
		"              sol = $missing$;\n" +
4848
		"              sol $missing$;\n" +
4848
		"            }\n" +
4849
		"            }\n" +
4849
		"        else\n" +
4850
		"        else\n" +
4850
		"            ;\n" +
4851
		"            ;\n" +
Lines 5999-6005 Link Here
5999
		"    restricts breakpoint;\n" +
6000
		"    restricts breakpoint;\n" +
6000
		"    given thread;\n" +
6001
		"    given thread;\n" +
6001
		"    any other;\n" +
6002
		"    any other;\n" +
6002
		"    specified = $missing$;\n" +
6003
		"    specified $missing$;\n" +
6003
		"  }\n" +
6004
		"  }\n" +
6004
		"  public void removeThreadFilter(IJavaThread thread) {\n" +
6005
		"  public void removeThreadFilter(IJavaThread thread) {\n" +
6005
		"    removes the;\n" +
6006
		"    removes the;\n" +
Lines 6008-6014 Link Here
6008
		"    request as;\n" +
6009
		"    request as;\n" +
6009
		"    does not;\n" +
6010
		"    does not;\n" +
6010
		"    the removal;\n" +
6011
		"    the removal;\n" +
6011
		"    thread = $missing$;\n" +
6012
		"    thread $missing$;\n" +
6012
		"  }\n" +
6013
		"  }\n" +
6013
		"  public IJavaThread[] getThreadFilters() {\n" +
6014
		"  public IJavaThread[] getThreadFilters() {\n" +
6014
		"    return the;\n" +
6015
		"    return the;\n" +
Lines 7612-7629 Link Here
7612
		"}\n";
7613
		"}\n";
7613
7614
7614
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null;
7615
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null;
7615
	if(this.complianceLevel <= ClassFileConstants.JDK1_4) {
7616
	if(this.complianceLevel <= ClassFileConstants.JDK1_6) {
7616
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
7617
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
7617
			"public class Test {\n" +
7618
			"public class Test {\n" +
7618
			"  public Test() {\n" +
7619
			"  public Test() {\n" +
7619
			"    super();\n" +
7620
			"    super();\n" +
7620
			"  }\n" +
7621
			"  }\n" +
7621
			"  void aMethod() {\n" +
7622
			"  void aMethod() {\n" +
7623
			"    public static void $missing$;\n" + 
7622
			"    m1();\n" +
7624
			"    m1();\n" +
7623
			"    {\n" +
7625
			"    {\n" +
7624
			"      int a;\n" +
7626
			"      int a;\n" +
7625
			"      int b;\n" +
7627
			"      int b;\n" +
7626
			"    }\n" +
7628
			"    }\n" +
7629
			"    public static void $missing$;\n" + 
7627
			"    m2();\n" +
7630
			"    m2();\n" +
7628
			"    {\n" +
7631
			"    {\n" +
7629
			"      int c;\n" +
7632
			"      int c;\n" +
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java (-23 / +37 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 71-86 Link Here
71
			"	}\n" +
75
			"	}\n" +
72
			"}\n"
76
			"}\n"
73
		},
77
		},
74
		"----------\n" +
78
		"----------\n" + 
75
		"1. ERROR in X.java (at line 3)\n" +
79
		"1. ERROR in X.java (at line 3)\n" + 
76
		"	throws new X\n" +
80
		"	throws new X\n" + 
77
		"	^^^^^^\n" +
81
		"	^^^^^^\n" + 
78
		"Syntax error on token \"throws\", throw expected\n" +
82
		"Syntax error on token \"throws\", throw expected\n" + 
79
		"----------\n" +
83
		"----------\n" + 
80
		"2. ERROR in X.java (at line 3)\n" +
84
		"2. ERROR in X.java (at line 3)\n" + 
81
		"	throws new X\n" +
85
		"	throws new X\n" + 
82
		"	           ^\n" +
86
		"	           ^\n" + 
83
		"Syntax error, unexpected end of method\n" +
87
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
88
		"----------\n" + 
89
		"3. ERROR in X.java (at line 3)\n" + 
90
		"	throws new X\n" + 
91
		"	           ^\n" + 
92
		"Syntax error, insert \";\" to complete BlockStatements\n" + 
84
		"----------\n"
93
		"----------\n"
85
	);
94
	);
86
}
95
}
Lines 130-145 Link Here
130
			"	}\n" +
139
			"	}\n" +
131
			"}\n"
140
			"}\n"
132
		},
141
		},
133
		"----------\n" +
142
		"----------\n" + 
134
		"1. ERROR in X.java (at line 3)\n" +
143
		"1. ERROR in X.java (at line 3)\n" + 
135
		"	throws new X\n" +
144
		"	throws new X\n" + 
136
		"	^^^^^^\n" +
145
		"	^^^^^^\n" + 
137
		"Syntax error on token \"throws\", throw expected\n" +
146
		"Syntax error on token \"throws\", throw expected\n" + 
138
		"----------\n" +
147
		"----------\n" + 
139
		"2. ERROR in X.java (at line 3)\n" +
148
		"2. ERROR in X.java (at line 3)\n" + 
140
		"	throws new X\n" +
149
		"	throws new X\n" + 
141
		"	           ^\n" +
150
		"	           ^\n" + 
142
		"Syntax error, unexpected end of initializer\n" +
151
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
152
		"----------\n" + 
153
		"3. ERROR in X.java (at line 3)\n" + 
154
		"	throws new X\n" + 
155
		"	           ^\n" + 
156
		"Syntax error, insert \";\" to complete BlockStatements\n" + 
143
		"----------\n"
157
		"----------\n"
144
	);
158
	);
145
}
159
}
Lines 241-248 Link Here
241
		"----------\n" +
255
		"----------\n" +
242
		"1. ERROR in X.java (at line 2)\n" +
256
		"1. ERROR in X.java (at line 2)\n" +
243
		"	public void foo(X, Object o, String s) {\n" +
257
		"	public void foo(X, Object o, String s) {\n" +
244
		"	                 ^\n" +
258
		"	                ^\n" +
245
		"Syntax error on token \",\", . expected\n" +
259
		"Syntax error, insert \"VariableDeclaratorId\" to complete FormalParameterList\n" + 
246
		"----------\n"
260
		"----------\n"
247
	);
261
	);
248
}
262
}
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java (-18 / +27 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 166-182 Link Here
166
		"1. ERROR in <parenthesis mismatch> (at line 3)\n" +
170
		"1. ERROR in <parenthesis mismatch> (at line 3)\n" +
167
		"	[ arg1, 						\n" +
171
		"	[ arg1, 						\n" +
168
		"	^\n" +
172
		"	^\n" +
169
		"Syntax error on token \"[\", invalid Type\n" +
173
		"Syntax error on token \"[\", invalid Name\n" +
170
		"----------\n" +
174
		"----------\n" +
171
		"2. ERROR in <parenthesis mismatch> (at line 4)\n" +
175
		"2. ERROR in <parenthesis mismatch> (at line 4)\n" +
172
		"	{ arg2, ]						\n" +
176
		"	{ arg2, ]						\n" +
173
		"	^\n" +
177
		"	^\n" +
174
		"Syntax error on token \"{\", invalid Type\n" +
178
		"Syntax error on token \"{\", invalid Name\n" +
175
		"----------\n" +
179
		"----------\n" +
176
		"3. ERROR in <parenthesis mismatch> (at line 4)\n" +
180
		"3. ERROR in <parenthesis mismatch> (at line 4)\n" +
177
		"	{ arg2, ]						\n" +
181
		"	{ arg2, ]						\n" +
178
		"	        ^\n" +
182
		"	        ^\n" +
179
		"Syntax error on token \"]\", invalid Type\n" +
183
		"Syntax error on token \"]\", invalid Name\n" +
180
		"----------\n" +
184
		"----------\n" +
181
		"4. ERROR in <parenthesis mismatch> (at line 5)\n" +
185
		"4. ERROR in <parenthesis mismatch> (at line 5)\n" +
182
		"	arg3, 						\n" +
186
		"	arg3, 						\n" +
Lines 273-279 Link Here
273
		"1. ERROR in <test> (at line 3)\n"+
277
		"1. ERROR in <test> (at line 3)\n"+
274
		"	i; 									\n"+
278
		"	i; 									\n"+
275
		"	^\n"+
279
		"	^\n"+
276
		"Syntax error, insert \"AssignmentOperator Expression\" to complete Expression\n"+
280
		"Syntax error, insert \"VariableDeclarators\" to complete LocalVariableDeclaration\n" +
277
		"----------\n";
281
		"----------\n";
278
282
279
	String testName = "<test>";
283
	String testName = "<test>";
Lines 399-405 Link Here
399
}
403
}
400
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339
404
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339
401
public void test12() {
405
public void test12() {
402
403
	String s =
406
	String s =
404
		"package a;										\n"+
407
		"package a;										\n"+
405
		"public interface Test {						\n"+
408
		"public interface Test {						\n"+
Lines 407-424 Link Here
407
		"    System.out.println();						\n"+
410
		"    System.out.println();						\n"+
408
		"}												\n";
411
		"}												\n";
409
412
410
	String expectedSyntaxErrorDiagnosis =
413
	String expectedSyntaxErrorDiagnosis = this.complianceLevel < ClassFileConstants.JDK1_7
411
		"----------\n"+
414
		? 	"----------\n"+
412
		"1. ERROR in <test> (at line 3)\n"+
415
			"1. ERROR in <test> (at line 3)\n"+
413
		"	public void myMethod()						\n"+
416
			"	public void myMethod()						\n"+
414
		"	                     ^\n"+
417
			"	                     ^\n"+
415
		"Syntax error on token \")\", { expected after this token\n"+
418
			"Syntax error on token \")\", { expected after this token\n"+
416
		"----------\n"+
419
			"----------\n"+
417
		"2. ERROR in <test> (at line 5)\n"+
420
			"2. ERROR in <test> (at line 5)\n"+
418
		"	}												\n"+
421
			"	}												\n"+
419
		"	^\n"+
422
			"	^\n"+
420
		"Syntax error, insert \"}\" to complete InterfaceBody\n"+
423
			"Syntax error, insert \"}\" to complete InterfaceBody\n"+
421
		"----------\n";
424
			"----------\n"
425
		: 	"----------\n" + 
426
			"1. ERROR in <test> (at line 3)\n"+
427
			"	public void myMethod()						\n"+
428
			"	                     ^\n"+
429
			"Syntax error on token \")\", @ expected after this token\n"+
430
			"----------\n";
422
431
423
	String testName = "<test>";
432
	String testName = "<test>";
424
	checkParse(
433
	checkParse(
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java (+3633 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.tests.compiler.parser;
16
17
import java.io.IOException;
18
import java.util.Map;
19
import junit.framework.Test;
20
import org.eclipse.jdt.core.tests.util.CompilerTestSetup;
21
22
public class TypeAnnotationSyntaxTest extends AbstractTypeAnnotationSyntaxTest {
23
24
	public static Class testClass() {
25
		return TypeAnnotationSyntaxTest.class;
26
	}
27
	public void initialize(CompilerTestSetup setUp) {
28
		super.initialize(setUp);
29
	}
30
	public static Test suite() {
31
		return buildMinimalComplianceTestSuite(testClass(), F_1_7);
32
	}
33
public TypeAnnotationSyntaxTest(String testName){
34
	super(testName);
35
}
36
37
static {
38
//	TESTS_NAMES = new String[] { "test0038", "test0039", "test0040a" };
39
//	TESTS_NUMBERS = new int[] { 133, 134, 135 };
40
}
41
42
public void test0001() throws IOException {
43
	String source = "@Marker class A extends String {}\n;" +
44
					"@Marker class B extends @Marker String {}\n" +
45
					"@Marker class C extends @Marker @SingleMember(0) String {}\n" +
46
					"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
47
					"@Marker class E extends String {}\n;";
48
49
	String expectedUnitToString = 
50
		"@Marker class A extends String {\n" + 
51
		"  A() {\n" + 
52
		"    super();\n" + 
53
		"  }\n" + 
54
		"}\n" + 
55
		"@Marker class B extends @Marker String {\n" + 
56
		"  B() {\n" + 
57
		"    super();\n" + 
58
		"  }\n" + 
59
		"}\n" + 
60
		"@Marker class C extends @Marker @SingleMember(0) String {\n" + 
61
		"  C() {\n" + 
62
		"    super();\n" + 
63
		"  }\n" + 
64
		"}\n" + 
65
		"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + 
66
		"  D() {\n" + 
67
		"    super();\n" + 
68
		"  }\n" + 
69
		"}\n" + 
70
		"@Marker class E extends String {\n" + 
71
		"  E() {\n" + 
72
		"    super();\n" + 
73
		"  }\n" + 
74
		"}\n";
75
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString);
76
}
77
public void test0002() throws IOException {
78
	String source = "class A extends String {}\n;" +
79
					"class B extends @Marker String {}\n" +
80
					"class C extends @Marker @SingleMember(0) String {}\n" +
81
					"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
82
					"class E extends String {}\n;";
83
    
84
	String expectedUnitToString = 
85
		"class A extends String {\n" + 
86
		"  A() {\n" + 
87
		"    super();\n" + 
88
		"  }\n" + 
89
		"}\n" + 
90
		"class B extends @Marker String {\n" + 
91
		"  B() {\n" + 
92
		"    super();\n" + 
93
		"  }\n" + 
94
		"}\n" + 
95
		"class C extends @Marker @SingleMember(0) String {\n" + 
96
		"  C() {\n" + 
97
		"    super();\n" + 
98
		"  }\n" + 
99
		"}\n" + 
100
		"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + 
101
		"  D() {\n" + 
102
		"    super();\n" + 
103
		"  }\n" + 
104
		"}\n" + 
105
		"class E extends String {\n" + 
106
		"  E() {\n" + 
107
		"    super();\n" + 
108
		"  }\n" + 
109
		"}\n";
110
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0002", expectedUnitToString);
111
}
112
public void test0003() throws IOException {
113
	String source = "@Marker class A implements Comparable, " +
114
					"                   @Marker Serializable," +
115
					"                   Cloneable {\n" +
116
					"}\n";
117
	String expectedUnitToString = 
118
		"@Marker class A implements Comparable, @Marker Serializable, Cloneable {\n" + 
119
		"  A() {\n" + 
120
		"    super();\n" + 
121
		"  }\n" + 
122
		"}\n";
123
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0003", expectedUnitToString);
124
}
125
public void test0004() throws IOException {
126
	String source = "@Marker class A implements Comparable, " +
127
					"                   @Marker @SingleMember(0) Serializable," +
128
					"                   Cloneable {\n" +
129
					"}\n";
130
	String expectedUnitToString = 
131
		"@Marker class A implements Comparable, @Marker @SingleMember(0) Serializable, Cloneable {\n" + 
132
		"  A() {\n" + 
133
		"    super();\n" + 
134
		"  }\n" + 
135
		"}\n";
136
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0004", expectedUnitToString);
137
}
138
public void test0005() throws IOException {
139
	String source = "@Marker class A implements Comparable, " +
140
					"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
141
					"                   Cloneable {\n" +
142
					"}\n";
143
	String expectedUnitToString = 
144
		"@Marker class A implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
145
		"  A() {\n" + 
146
		"    super();\n" + 
147
		"  }\n" + 
148
		"}\n";
149
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0005", expectedUnitToString);
150
}
151
public void test0006() throws IOException {
152
	String source = "@Marker class A implements @Marker Comparable, " +
153
					"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
154
					"                   @Marker Cloneable {\n" +
155
					"}\n";
156
	String expectedUnitToString = 
157
		"@Marker class A implements @Marker Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, @Marker Cloneable {\n" +
158
		"  A() {\n" + 
159
		"    super();\n" + 
160
		"  }\n" + 
161
		"}\n";
162
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0006", expectedUnitToString);
163
}
164
public void test007() throws IOException {
165
	String source = "@Marker class A extends Object implements Comparable, " +
166
					"                   @Marker @SingleMember(10) @Normal(Value=0) Serializable," +
167
					"                   Cloneable {\n" +
168
					"}\n";
169
	String expectedUnitToString = 
170
		"@Marker class A extends Object implements Comparable, @Marker @SingleMember(10) @Normal(Value = 0) Serializable, Cloneable {\n" +
171
		"  A() {\n" + 
172
		"    super();\n" + 
173
		"  }\n" + 
174
		"}\n";
175
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0007", expectedUnitToString);
176
}
177
public void test0008() throws IOException {
178
	String source = "@Marker class A extends @Marker Object implements Comparable, " +
179
					"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
180
					"                   Cloneable {\n" +
181
					"}\n";
182
	String expectedUnitToString = 
183
		"@Marker class A extends @Marker Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
184
		"  A() {\n" + 
185
		"    super();\n" + 
186
		"  }\n" + 
187
		"}\n";
188
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0008", expectedUnitToString);
189
}
190
public void test0009() throws IOException {
191
	String source = "@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, " +
192
	"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
193
	"                   Cloneable {\n" +
194
	"}\n";
195
	String expectedUnitToString = 
196
		"@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
197
		"  A() {\n" + 
198
		"    super();\n" + 
199
		"  }\n" + 
200
		"}\n";
201
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0009", expectedUnitToString);
202
}
203
public void test0010() throws IOException {
204
	String source = "@Marker class A extends @Marker @SingleMember(0) @Normal(Value=0) Object implements Comparable, " +
205
	"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
206
	"                   Cloneable {\n" +
207
	"}\n";
208
	String expectedUnitToString = 
209
		"@Marker class A extends @Marker @SingleMember(0) @Normal(Value = 0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
210
		"  A() {\n" + 
211
		"    super();\n" + 
212
		"  }\n" + 
213
		"}\n";
214
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0010", expectedUnitToString);
215
}
216
public void test0011() throws IOException {
217
	String source = "public class A {\n" +
218
					"    int[] f[];\n" +
219
					"    @Marker String[] @Marker[][] s[] @SingleMember(0)[][] @Normal(Value = 0)[][];\n" +
220
					"    float[] p[];\n" +
221
					"}\n";
222
	String expectedUnitToString = 
223
		"public class A {\n" + 
224
		"  int[][] f;\n" + 
225
		"  @Marker String[] @Marker [][][] @SingleMember(0) [][] @Normal(Value = 0) [][] s;\n" + 
226
		"  float[][] p;\n" + 
227
		"  public A() {\n" + 
228
		"    super();\n" + 
229
		"  }\n" + 
230
		"}\n";
231
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0011", expectedUnitToString);
232
}
233
public void test0012() throws IOException {
234
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
235
					"    int[] f[];\n" +
236
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
237
					"    float[] p[];\n" +
238
					"public static void main(String args[]) {\n" +
239
					"    @Readonly String @Nullable[] @NonNull[] s;\n" +
240
					"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
241
					"}\n" +
242
					"}\n";
243
	String expectedUnitToString = 
244
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
245
		"  int[][] f;\n" + 
246
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
247
		"  float[][] p;\n" + 
248
		"  public A() {\n" + 
249
		"    super();\n" + 
250
		"  }\n" + 
251
		"  public static void main(String[] args) {\n" + 
252
		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
253
		"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
254
		"  }\n" + 
255
		"}\n";
256
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0012", expectedUnitToString);
257
}
258
public void test0013() throws IOException {
259
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
260
					"    int[] f[];\n" +
261
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
262
					"    float[] p[];\n" +
263
					"public static void main(String args[]) {\n" +
264
					"    @Readonly String s;\n" +
265
					"	 s = new @Readonly String @NonNull[] @Nullable[] { {\"Hello\"}, {\"World\"}} [0][0];\n" +
266
					"}\n" +
267
					"}\n";
268
	String expectedUnitToString = 
269
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
270
		"  int[][] f;\n" + 
271
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
272
		"  float[][] p;\n" + 
273
		"  public A() {\n" + 
274
		"    super();\n" + 
275
		"  }\n" + 
276
		"  public static void main(String[] args) {\n" + 
277
		"    @Readonly String s;\n" + 
278
		"    s = new @Readonly String @NonNull [] @Nullable []{{\"Hello\"}, {\"World\"}}[0][0];\n" + 
279
		"  }\n" + 
280
		"}\n";
281
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0013", expectedUnitToString);
282
}
283
public void test0014() throws IOException {
284
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
285
					"    int[] f[];\n" +
286
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
287
					"    float[] p[];\n" +
288
					"public static int main(String args[])[] @Marker[][] @Marker @SingleMember(0) @Normal(Value=0)[][] @Marker {\n" +
289
					"    @Readonly String @Nullable[] @NonNull[] s;\n" +
290
					"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
291
					"}\n" +
292
					"}\n";
293
	String expectedUnitToString = 
294
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
295
		"  int[][] f;\n" + 
296
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
297
		"  float[][] p;\n" + 
298
		"  public A() {\n" + 
299
		"    super();\n" + 
300
		"  }\n" + 
301
		"  public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker {\n" +
302
		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
303
		"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
304
		"  }\n" + 
305
		"}\n";
306
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0014", expectedUnitToString);
307
308
}
309
public void test0015() throws IOException {
310
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
311
					"    int[] f[];\n" +
312
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
313
					"    float[] p[];\n" +
314
					"public static int main(String args[])[] @Marker[][] @Marker @SingleMember(0) @Normal(Value=0)[][] @Marker {\n" +
315
					"    @Readonly String @Nullable[] @NonNull[] s;\n" +
316
					"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
317
					"}\n" +
318
					"@Marker public A () @Marker @SingleMember(0) @Normal(Value=10) {}\n" +
319
					"}\n";
320
	String expectedUnitToString = 
321
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
322
		"  int[][] f;\n" + 
323
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
324
		"  float[][] p;\n" + 
325
		"  public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker {\n" + 
326
		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
327
		"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
328
		"  }\n" + 
329
		"  public @Marker A() @Marker @SingleMember(0) @Normal(Value = 10) {\n" + 
330
		"    super();\n" + 
331
		"  }\n" + 
332
		"}\n";
333
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0015", expectedUnitToString);
334
}
335
// parameters
336
public void test0016() throws IOException {
337
	String source = "public class A {\n" +
338
					"@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" +
339
					"}\n" +
340
					"}";
341
	String expectedUnitToString = 
342
		"public class A {\n" + 
343
		"  public A() {\n" + 
344
		"    super();\n" + 
345
		"  }\n" + 
346
		"  public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
347
		"  }\n" + 
348
		"}\n";
349
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0016", expectedUnitToString);
350
}
351
public void test0017() throws IOException  {
352
	String source = "public class A {\n" +
353
					"@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" +
354
					"}\n" +
355
					"}";
356
	String expectedUnitToString = 
357
		"public class A {\n" + 
358
		"  public A() {\n" + 
359
		"    super();\n" + 
360
		"  }\n" + 
361
		"  public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
362
		"  }\n" + 
363
		"}\n";
364
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0017", expectedUnitToString);
365
}
366
public void test0018() throws IOException {
367
	String source = "public class A {\n" +
368
					"@Marker public int[] @Marker[][] main(HashMap<String, Object>[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" +
369
					"}\n" +
370
					"}";
371
	String expectedUnitToString = 
372
		"public class A {\n" + 
373
		"  public A() {\n" + 
374
		"    super();\n" + 
375
		"  }\n" + 
376
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
377
		"  }\n" + 
378
		"}\n";
379
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0018", expectedUnitToString);
380
}
381
public void test0019() throws IOException {
382
	String source = "public class A {\n" +
383
					"@Marker public int[] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][] args[] @Normal(Value = 10) [][])[] @Marker [][] @Marker {\n" +
384
					"}\n" +
385
					"}";
386
	String expectedUnitToString = 
387
		"public class A {\n" + 
388
		"  public A() {\n" + 
389
		"    super();\n" + 
390
		"  }\n" + 
391
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
392
		"  }\n" + 
393
		"}\n";
394
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0019", expectedUnitToString);
395
}
396
// varargs annotation
397
public void test0020() throws IOException {
398
	String source = "public class A {\n" +
399
					"@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
400
					"}\n" +
401
					"}";
402
	String expectedUnitToString = 
403
		"public class A {\n" + 
404
		"  public A() {\n" + 
405
		"    super();\n" + 
406
		"  }\n" + 
407
		"  public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
408
		"  }\n" + 
409
		"}\n";
410
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0020", expectedUnitToString);
411
}
412
public void test0021() throws IOException {
413
	String source = "public class A {\n" +
414
					"@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
415
					"}\n" +
416
					"}";
417
	String expectedUnitToString = 
418
		"public class A {\n" + 
419
		"  public A() {\n" + 
420
		"    super();\n" + 
421
		"  }\n" + 
422
		"  public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
423
		"  }\n" + 
424
		"}\n";
425
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0021", expectedUnitToString);
426
}
427
public void test0022() throws IOException {
428
	String source = "public class A {\n" +
429
					"@Marker public int[] @Marker[][] main(HashMap<Integer,String>[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
430
					"}\n" +
431
					"}";
432
	String expectedUnitToString = 
433
		"public class A {\n" + 
434
		"  public A() {\n" + 
435
		"    super();\n" + 
436
		"  }\n" + 
437
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
438
		"  }\n" + 
439
		"}\n";
440
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0022", expectedUnitToString);
441
}
442
public void test0023() throws IOException {
443
	String source = "public class A {\n" +
444
					"@Marker public int[] @Marker[][] main(HashMap<Integer,String>.Iterator[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
445
					"}\n" +
446
					"}";
447
	String expectedUnitToString = 
448
		"public class A {\n" + 
449
		"  public A() {\n" + 
450
		"    super();\n" + 
451
		"  }\n" + 
452
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>.Iterator[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
453
		"  }\n" + 
454
		"}\n";
455
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0023", expectedUnitToString);
456
}
457
// local variables
458
public void test0024() throws IOException {
459
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
460
					"public static void main(String args[]) {\n" +
461
					"    int[] f[];\n" +
462
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
463
					"    float[] p[];\n" +
464
					"}\n" +
465
					"}\n";
466
	String expectedUnitToString = 
467
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
468
		"  public A() {\n" + 
469
		"    super();\n" + 
470
		"  }\n" + 
471
		"  public static void main(String[] args) {\n" + 
472
		"    int[][] f;\n" + 
473
		"    @English String[] @NonNull [][] @Nullable [][] s;\n" + 
474
		"    float[][] p;\n" + 
475
		"  }\n" + 
476
		"}\n";
477
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0024", expectedUnitToString);
478
}
479
// type parameter
480
public void test0025() throws IOException {
481
	String source = "class A {\n" +
482
					"public <Integer, @Positive Integer, @Negative Integer, Integer> void foo() {\n" +
483
					"}\n" +
484
					"}\n";
485
	String expectedUnitToString = 
486
		"class A {\n" + 
487
		"  A() {\n" + 
488
		"    super();\n" + 
489
		"  }\n" +
490
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>void foo() {\n" + 
491
		"  }\n" + 
492
		"}\n";
493
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0025", expectedUnitToString);
494
}
495
// Type
496
public void test0026() throws IOException {
497
	String source = "class A {\n" +
498
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int foo() @Marker {\n" +
499
					"    return 0;\n" +
500
					"}\n" +
501
					"public <Integer, @Positive Integer, @Negative Integer, Integer> int bar() @Marker{\n" +
502
					"    return 0;\n" +
503
					"}\n" +
504
					"}\n";
505
	String expectedUnitToString = 
506
		"class A {\n" + 
507
		"  A() {\n" + 
508
		"    super();\n" + 
509
		"  }\n" + 
510
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int foo() @Marker {\n" + 
511
		"    return 0;\n" +
512
		"  }\n" + 
513
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>int bar() @Marker {\n" + 
514
		"    return 0;\n" +
515
		"  }\n" + 
516
		"}\n";
517
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0026", expectedUnitToString);
518
}
519
// Type
520
public void test0027() throws IOException {
521
	String source = "class A {\n" +
522
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String foo() @Marker {\n" +
523
					"    return null;\n" +
524
					"}\n" +
525
					"public <Integer, @Positive Integer, @Negative Integer, Integer> String bar () @Marker {\n" +
526
					"    return null;\n" +
527
					"}\n" +
528
					"}\n";
529
	String expectedUnitToString = 
530
		"class A {\n" + 
531
		"  A() {\n" + 
532
		"    super();\n" + 
533
		"  }\n" + 
534
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String foo() @Marker {\n" + 
535
		"    return null;\n" +
536
		"  }\n" + 
537
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>String bar() @Marker {\n" + 
538
		"    return null;\n" +
539
		"  }\n" + 
540
		"}\n";
541
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0027", expectedUnitToString);
542
}
543
//Type
544
public void test0028() throws IOException {
545
	String source = "class A {\n" +
546
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object> foo() @Marker {\n" +
547
					"    return null;\n" +
548
					"}\n" +
549
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object> bar () @Marker {\n" +
550
					"    return null;\n" +
551
					"}\n" +
552
					"}\n";
553
	String expectedUnitToString = 
554
		"class A {\n" + 
555
		"  A() {\n" + 
556
		"    super();\n" + 
557
		"  }\n" + 
558
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object> foo() @Marker {\n" + 
559
		"    return null;\n" +
560
		"  }\n" + 
561
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object> bar() @Marker {\n" + 
562
		"    return null;\n" +
563
		"  }\n" + 
564
		"}\n";
565
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0028", expectedUnitToString);
566
}
567
// Type
568
public void test0029() throws IOException {
569
	String source = "class A {\n" +
570
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" +
571
					"    return null;\n" +
572
					"}\n" +
573
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator bar () @Marker {\n" +
574
					"    return null;\n" +
575
					"}\n" +
576
					"}\n";
577
	String expectedUnitToString = 
578
		"class A {\n" + 
579
		"  A() {\n" + 
580
		"    super();\n" + 
581
		"  }\n" + 
582
		"  public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" + 
583
		"    return null;\n" +
584
		"  }\n" + 
585
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator bar() @Marker {\n" + 
586
		"    return null;\n" +
587
		"  }\n" + 
588
		"}\n";
589
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0029", expectedUnitToString);
590
}
591
//Type
592
public void test0030() throws IOException {
593
	String source = "class A {\n" +
594
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty[][] foo() @Marker {\n" +
595
					"    return null;\n" +
596
					"}\n" +
597
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator[] @NonEmpty[][] bar () @Marker {\n" +
598
					"    return null;\n" +
599
					"}\n" +
600
					"}\n";
601
	String expectedUnitToString = 
602
		"class A {\n" + 
603
		"  A() {\n" + 
604
		"    super();\n" + 
605
		"  }\n" + 
606
		"  public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty [][] foo() @Marker {\n" + 
607
		"    return null;\n" +
608
		"  }\n" + 
609
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator[] @NonEmpty [][] bar() @Marker {\n" + 
610
		"    return null;\n" +
611
		"  }\n" + 
612
		"}\n";
613
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0030", expectedUnitToString);
614
}
615
//Type
616
public void test0031() throws IOException {
617
	String source = "class A {\n" +
618
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int[] @NonEmpty[][] foo() @Marker {\n" +
619
					"    return 0;\n" +
620
					"}\n" +
621
					"public <Integer, @Positive Integer, @Negative Integer, Integer> int[] @NonEmpty[][] bar() @Marker{\n" +
622
					"    return 0;\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>@Marker int[] @NonEmpty [][] foo() @Marker {\n" + 
631
		"    return 0;\n" +
632
		"  }\n" + 
633
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>int[] @NonEmpty [][] bar() @Marker {\n" + 
634
		"    return 0;\n" +
635
		"  }\n" + 
636
		"}\n";
637
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0031", expectedUnitToString);
638
}
639
// Type
640
public void test0032() throws IOException {
641
	String source = "class A {\n" +
642
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String[]@NonEmpty[][] foo() @Marker {\n" +
643
					"    return null;\n" +
644
					"}\n" +
645
					"public <Integer, @Positive Integer, @Negative Integer, Integer> String[]@NonEmpty[][] bar () @Marker {\n" +
646
					"    return null;\n" +
647
					"}\n" +
648
					"}\n";
649
	String expectedUnitToString = 
650
		"class A {\n" + 
651
		"  A() {\n" + 
652
		"    super();\n" + 
653
		"  }\n" + 
654
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String[] @NonEmpty [][] foo() @Marker {\n" + 
655
		"    return null;\n" +
656
		"  }\n" + 
657
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>String[] @NonEmpty [][] bar() @Marker {\n" + 
658
		"    return null;\n" +
659
		"  }\n" + 
660
		"}\n";
661
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0032", expectedUnitToString);
662
}
663
//Type
664
public void test0033() throws IOException {
665
	String source = "class A {\n" +
666
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>[] @NonEmpty[][] foo() @Marker {\n" +
667
					"    return null;\n" +
668
					"}\n" +
669
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>[]@NonEmpty[][] bar () @Marker {\n" +
670
					"    return null;\n" +
671
					"}\n" +
672
					"}\n";
673
	String expectedUnitToString = 
674
		"class A {\n" + 
675
		"  A() {\n" + 
676
		"    super();\n" + 
677
		"  }\n" + 
678
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object>[] @NonEmpty [][] foo() @Marker {\n" + 
679
		"    return null;\n" +
680
		"  }\n" + 
681
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>[] @NonEmpty [][] bar() @Marker {\n" + 
682
		"    return null;\n" +
683
		"  }\n" + 
684
		"}\n";
685
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0033", expectedUnitToString);
686
}
687
// Type0 field declaration.
688
public void test0034() throws IOException {
689
	String source = "public class A {\n" +
690
					"    int[] f[];\n" +
691
					"    @Marker int k;\n" +
692
					"    float[] p[];\n" +
693
					"}\n";
694
	String expectedUnitToString = 
695
		"public class A {\n" + 
696
		"  int[][] f;\n" + 
697
		"  @Marker int k;\n" + 
698
		"  float[][] p;\n" + 
699
		"  public A() {\n" + 
700
		"    super();\n" + 
701
		"  }\n" + 
702
		"}\n";
703
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0034", expectedUnitToString);
704
}
705
//Type0 field declaration.
706
public void test0035() throws IOException {
707
	String source = "public class A {\n" +
708
					"    int[] f[];\n" +
709
					"    @Marker String k;\n" +
710
					"    float[] p[];\n" +
711
					"}\n";
712
	String expectedUnitToString = 
713
		"public class A {\n" + 
714
		"  int[][] f;\n" + 
715
		"  @Marker String k;\n" + 
716
		"  float[][] p;\n" + 
717
		"  public A() {\n" + 
718
		"    super();\n" + 
719
		"  }\n" + 
720
		"}\n";
721
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0035", expectedUnitToString);
722
}
723
//Type0 field declaration.
724
public void test0036() throws IOException {
725
	String source = "public class A {\n" +
726
					"    int[] f[];\n" +
727
					"    @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" +
728
					"    float[] p[];\n" +
729
					"}\n";
730
	String expectedUnitToString = 
731
		"public class A {\n" + 
732
		"  int[][] f;\n" + 
733
		"  @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" + 
734
		"  float[][] p;\n" + 
735
		"  public A() {\n" + 
736
		"    super();\n" + 
737
		"  }\n" + 
738
		"}\n";
739
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0036", expectedUnitToString);
740
}
741
//Type0 field declaration.
742
public void test0037() throws IOException {
743
	String source = "public class A {\n" +
744
					"    int[] f[];\n" +
745
					"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" +
746
					"    float[] p[];\n" +
747
					"}\n";
748
	String expectedUnitToString = 
749
		"public class A {\n" + 
750
		"  int[][] f;\n" + 
751
		"  @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" + 
752
		"  float[][] p;\n" + 
753
		"  public A() {\n" + 
754
		"    super();\n" + 
755
		"  }\n" + 
756
		"}\n";
757
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0037", expectedUnitToString);
758
}
759
//Type0 field declaration.
760
public void test0038() throws IOException {
761
	String source = "public class A {\n" +
762
					"    int[] f[];\n" +
763
					"    @Marker int[] @NonEmpty[][] k;\n" +
764
					"    float[] p[];\n" +
765
					"}\n";
766
	String expectedUnitToString = 
767
		"public class A {\n" + 
768
		"  int[][] f;\n" + 
769
		"  @Marker int[] @NonEmpty [][] k;\n" + 
770
		"  float[][] p;\n" + 
771
		"  public A() {\n" + 
772
		"    super();\n" + 
773
		"  }\n" + 
774
		"}\n";
775
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0038", expectedUnitToString);
776
}
777
//Type0 field declaration.
778
public void test0039() throws IOException {
779
	String source = "public class A {\n" +
780
					"    int[] f[];\n" +
781
					"    @Marker String[] @NonEmpty[][]k;\n" +
782
					"    float[] p[];\n" +
783
					"}\n";
784
	String expectedUnitToString = 
785
		"public class A {\n" + 
786
		"  int[][] f;\n" + 
787
		"  @Marker String[] @NonEmpty [][] k;\n" + 
788
		"  float[][] p;\n" + 
789
		"  public A() {\n" + 
790
		"    super();\n" + 
791
		"  }\n" + 
792
		"}\n";
793
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0039", expectedUnitToString);
794
}
795
//Type0 field declaration.
796
public void test0040() throws IOException {
797
	String source = "public class A {\n" +
798
					"    int[] f[];\n" +
799
					"    @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty[][] k;\n" +
800
					"    float[] p[];\n" +
801
					"}\n";
802
	String expectedUnitToString = 
803
		"public class A {\n" + 
804
		"  int[][] f;\n" + 
805
		"  @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] k;\n" + 
806
		"  float[][] p;\n" + 
807
		"  public A() {\n" + 
808
		"    super();\n" + 
809
		"  }\n" + 
810
		"}\n";
811
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0040", expectedUnitToString);
812
}
813
//Type0 field declaration.
814
public void test0041() throws IOException {
815
	String source = "public class A {\n" +
816
					"    int[] f[];\n" +
817
					"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] k;\n" +
818
					"    float[] p[];\n" +
819
					"}\n";
820
	String expectedUnitToString = 
821
		"public class A {\n" + 
822
		"  int[][] f;\n" + 
823
		"  @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] k;\n" + 
824
		"  float[][] p;\n" + 
825
		"  public A() {\n" + 
826
		"    super();\n" + 
827
		"  }\n" + 
828
		"}\n";
829
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0041", expectedUnitToString);
830
}
831
//Type0 MethodHeaderName.
832
public void test0042() throws IOException {
833
	String source = "public class A {\n" +
834
					"    public @Marker int foo() { return 0; }\n" +
835
					"    public int bar() { return 0; }\n" +
836
					"}\n";
837
	String expectedUnitToString = 
838
		"public class A {\n" + 
839
		"  public A() {\n" + 
840
		"    super();\n" + 
841
		"  }\n" + 
842
		"  public @Marker int foo() {\n" + 
843
		"    return 0;\n" + 
844
		"  }\n" + 
845
		"  public int bar() {\n" + 
846
		"    return 0;\n" + 
847
		"  }\n" + 
848
		"}\n";
849
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0042", expectedUnitToString);
850
}
851
//Type0 MethodHeaderName.
852
public void test0043() throws IOException {
853
	String source = "public class A {\n" +
854
					"    public @Marker String foo() { return null; }\n" +
855
					"    public String bar() { return null; }\n" +
856
					"}\n";
857
	String expectedUnitToString = 
858
		"public class A {\n" + 
859
		"  public A() {\n" + 
860
		"    super();\n" + 
861
		"  }\n" + 
862
		"  public @Marker String foo() {\n" + 
863
		"    return null;\n" + 
864
		"  }\n" + 
865
		"  public String bar() {\n" + 
866
		"    return null;\n" + 
867
		"  }\n" + 
868
		"}\n";
869
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0043", expectedUnitToString);
870
}
871
//Type0 MethodHeaderName.
872
public void test0044() throws IOException {
873
	String source = "public class A {\n" +
874
					"    public @Marker HashMap<@Positive Integer, @Negative Integer> foo() { return null; }\n" +
875
					"    public HashMap<@Positive Integer, @Negative Integer>  bar() { return null; }\n" +
876
					"}\n";
877
	String expectedUnitToString = 
878
		"public class A {\n" + 
879
		"  public A() {\n" + 
880
		"    super();\n" + 
881
		"  }\n" + 
882
		"  public @Marker HashMap<@Positive Integer, @Negative Integer> foo() {\n" + 
883
		"    return null;\n" + 
884
		"  }\n" + 
885
		"  public HashMap<@Positive Integer, @Negative Integer> bar() {\n" + 
886
		"    return null;\n" + 
887
		"  }\n" + 
888
		"}\n";
889
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0044", expectedUnitToString);
890
}
891
//Type0 MethodHeaderName.
892
public void test0045() throws IOException {
893
	String source = "public class A {\n" +
894
					"    public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() { return null; }\n" +
895
					"    public HashMap<@Positive Integer, @Negative Integer>.Iterator  bar() { return null; }\n" +
896
					"}\n";
897
	String expectedUnitToString = 
898
		"public class A {\n" + 
899
		"  public A() {\n" + 
900
		"    super();\n" + 
901
		"  }\n" + 
902
		"  public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() {\n" + 
903
		"    return null;\n" + 
904
		"  }\n" + 
905
		"  public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() {\n" + 
906
		"    return null;\n" + 
907
		"  }\n" + 
908
		"}\n";
909
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0045", expectedUnitToString);
910
}
911
//Type0 MethodHeaderName.
912
public void test0046() throws IOException {
913
	String source = "public class A {\n" +
914
					"    public @Marker int[] foo() @NonEmpty[][] { return 0; }\n" +
915
					"    public int[] @NonEmpty[][] bar() { return 0; }\n" +
916
					"}\n";
917
	String expectedUnitToString = 
918
		"public class A {\n" + 
919
		"  public A() {\n" + 
920
		"    super();\n" + 
921
		"  }\n" + 
922
		"  public @Marker int[] @NonEmpty [][] foo() {\n" + 
923
		"    return 0;\n" + 
924
		"  }\n" + 
925
		"  public int[] @NonEmpty [][] bar() {\n" + 
926
		"    return 0;\n" + 
927
		"  }\n" + 
928
		"}\n";
929
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0046", expectedUnitToString);
930
}
931
//Type0 MethodHeaderName.
932
public void test0047() throws IOException {
933
	String source = "public class A {\n" +
934
					"    public @Marker String[]  foo() @NonEmpty[][] { return null; }\n" +
935
					"    public String[] @NonEmpty[][] bar() { return null; }\n" +
936
					"}\n";
937
	String expectedUnitToString = 
938
		"public class A {\n" + 
939
		"  public A() {\n" + 
940
		"    super();\n" + 
941
		"  }\n" + 
942
		"  public @Marker String[] @NonEmpty [][] foo() {\n" + 
943
		"    return null;\n" + 
944
		"  }\n" + 
945
		"  public String[] @NonEmpty [][] bar() {\n" + 
946
		"    return null;\n" + 
947
		"  }\n" + 
948
		"}\n";
949
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0047", expectedUnitToString);
950
}
951
//Type0 MethodHeaderName.
952
public void test0048() throws IOException {
953
	String source = "public class A {\n" +
954
					"    public @Marker HashMap<@Positive Integer, @Negative Integer>[] foo() @NonEmpty[][] { return null; }\n" +
955
					"    public HashMap<@Positive Integer, @Negative Integer> [] @NonEmpty[][] bar() { return null; }\n" +
956
					"}\n";
957
	String expectedUnitToString = 
958
		"public class A {\n" + 
959
		"  public A() {\n" + 
960
		"    super();\n" + 
961
		"  }\n" + 
962
		"  public @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] foo() {\n" + 
963
		"    return null;\n" + 
964
		"  }\n" + 
965
		"  public HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] bar() {\n" + 
966
		"    return null;\n" + 
967
		"  }\n" + 
968
		"}\n";
969
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0048", expectedUnitToString);
970
}
971
//Type0 MethodHeaderName.
972
public void test0049() throws IOException {
973
	String source = "public class A {\n" +
974
					"    public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[]  foo() @NonEmpty[][] { return null; }\n" +
975
					"    public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] bar() { return null; }\n" +
976
					"}\n";
977
	String expectedUnitToString = 
978
		"public class A {\n" + 
979
		"  public A() {\n" + 
980
		"    super();\n" + 
981
		"  }\n" + 
982
		"  public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] foo() {\n" + 
983
		"    return null;\n" + 
984
		"  }\n" + 
985
		"  public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] bar() {\n" + 
986
		"    return null;\n" + 
987
		"  }\n" + 
988
		"}\n";
989
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0049", expectedUnitToString);
990
}
991
//Type0 local variable declaration
992
public void test0050() throws IOException {
993
	String source = "public class A {\n" +
994
					"    public void foo() {\n" +
995
					"        @Marker int p;\n" +
996
					"        int q;\n" + 
997
					"    }\n" +
998
					"}\n";
999
	String expectedUnitToString = 
1000
		"public class A {\n" + 
1001
		"  public A() {\n" + 
1002
		"    super();\n" + 
1003
		"  }\n" + 
1004
		"  public void foo() {\n" + 
1005
		"    @Marker int p;\n" + 
1006
		"    int q;\n" + 
1007
		"  }\n" + 
1008
		"}\n";
1009
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0050", expectedUnitToString);
1010
}
1011
//Type0 local variable declaration
1012
public void test0051() throws IOException {
1013
	String source = "public class A {\n" +
1014
					"    public void foo() {\n" +
1015
					"        @Marker String p;\n" +
1016
					"        String q;\n" + 
1017
					"    }\n" +
1018
					"}\n";
1019
	String expectedUnitToString = 
1020
		"public class A {\n" + 
1021
		"  public A() {\n" + 
1022
		"    super();\n" + 
1023
		"  }\n" + 
1024
		"  public void foo() {\n" + 
1025
		"    @Marker String p;\n" + 
1026
		"    String q;\n" + 
1027
		"  }\n" + 
1028
		"}\n";
1029
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0051", expectedUnitToString);
1030
}
1031
//Type0 local variable declaration
1032
public void test0052() throws IOException {
1033
	String source = "public class A {\n" +
1034
					"    public void foo() {\n" +
1035
					"        @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" +
1036
					"        HashMap<@Positive Integer, @Negative Integer> q;\n" + 
1037
					"    }\n" +
1038
					"}\n";
1039
	String expectedUnitToString = 
1040
		"public class A {\n" + 
1041
		"  public A() {\n" + 
1042
		"    super();\n" + 
1043
		"  }\n" + 
1044
		"  public void foo() {\n" + 
1045
		"    @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" + 
1046
		"    HashMap<@Positive Integer, @Negative Integer> q;\n" + 
1047
		"  }\n" + 
1048
		"}\n";
1049
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0052", expectedUnitToString);
1050
}
1051
//Type0 local variable declaration
1052
public void test0053() throws IOException {
1053
	String source = "public class A {\n" +
1054
					"    public void foo() {\n" +
1055
					"        @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" +
1056
					"        HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + 
1057
					"    }\n" +
1058
					"}\n";
1059
	String expectedUnitToString = 
1060
		"public class A {\n" + 
1061
		"  public A() {\n" + 
1062
		"    super();\n" + 
1063
		"  }\n" + 
1064
		"  public void foo() {\n" + 
1065
		"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" + 
1066
		"    HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + 
1067
		"  }\n" + 
1068
		"}\n";
1069
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0053", expectedUnitToString);
1070
}
1071
//Type0 local variable declaration
1072
public void test0054() throws IOException {
1073
	String source = "public class A {\n" +
1074
					"    public void foo() {\n" +
1075
					"        @Marker int[] @NonNull[] p @NonEmpty[][];\n" +
1076
					"        int[] @NonNull[] q @NonEmpty[][];\n" + 
1077
					"    }\n" +
1078
					"}\n";
1079
	String expectedUnitToString = 
1080
		"public class A {\n" + 
1081
		"  public A() {\n" + 
1082
		"    super();\n" + 
1083
		"  }\n" + 
1084
		"  public void foo() {\n" + 
1085
		"    @Marker int[] @NonNull [] @NonEmpty [][] p;\n" + 
1086
		"    int[] @NonNull [] @NonEmpty [][] q;\n" + 
1087
		"  }\n" + 
1088
		"}\n";
1089
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0054", expectedUnitToString);
1090
}
1091
//Type0 local variable declaration
1092
public void test0055() throws IOException {
1093
	String source = "public class A {\n" +
1094
					"    public void foo() {\n" +
1095
					"        @Marker String[] @NonNull[] p @NonEmpty[][];\n" +
1096
					"        String[] @NonNull[] q @NonEmpty[][];\n" + 
1097
					"    }\n" +
1098
					"}\n";
1099
	String expectedUnitToString = 
1100
		"public class A {\n" + 
1101
		"  public A() {\n" + 
1102
		"    super();\n" + 
1103
		"  }\n" + 
1104
		"  public void foo() {\n" + 
1105
		"    @Marker String[] @NonNull [] @NonEmpty [][] p;\n" + 
1106
		"    String[] @NonNull [] @NonEmpty [][] q;\n" + 
1107
		"  }\n" + 
1108
		"}\n";
1109
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0055", expectedUnitToString);
1110
}
1111
//Type0 local variable declaration
1112
public void test0056() throws IOException {
1113
	String source = "public class A {\n" +
1114
					"    public void foo() {\n" +
1115
					"        @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] p @NonEmpty[][];\n" +
1116
					"        HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] q @NonEmpty[][];\n" + 
1117
					"    }\n" +
1118
					"}\n";
1119
	String expectedUnitToString = 
1120
		"public class A {\n" + 
1121
		"  public A() {\n" + 
1122
		"    super();\n" + 
1123
		"  }\n" + 
1124
		"  public void foo() {\n" + 
1125
		"    @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] p;\n" + 
1126
		"    HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] q;\n" + 
1127
		"  }\n" + 
1128
		"}\n";
1129
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0056", expectedUnitToString);
1130
}
1131
//Type0 local variable declaration
1132
public void test0057() throws IOException {
1133
	String source = "public class A {\n" +
1134
					"    public void foo() {\n" +
1135
					"        @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] p @NonEmpty[][];\n" +
1136
					"        HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] @NonEmpty[][] 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 HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] p;\n" + 
1146
		"    HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] q;\n" + 
1147
		"  }\n" + 
1148
		"}\n";
1149
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0057", expectedUnitToString);
1150
}
1151
//Type0 foreach
1152
public void test0058() throws IOException {
1153
	String source = "public class A {\n" +
1154
					"    public void foo() {\n" +
1155
					"        String @NonNull[] @Marker[] s @Readonly[];\n" +
1156
					"    	 for (@Readonly String @NonNull[] si @Marker[] : s) {}\n" +
1157
					"    	 for (String @NonNull[] sii @Marker[] : s) {}\n" +
1158
					"    }\n" +
1159
					"}\n";
1160
	String expectedUnitToString = 
1161
		"public class A {\n" + 
1162
		"  public A() {\n" + 
1163
		"    super();\n" + 
1164
		"  }\n" + 
1165
		"  public void foo() {\n" + 
1166
		"    String @NonNull [] @Marker [] @Readonly [] s;\n" + 
1167
		"    for (@Readonly String @NonNull [] @Marker [] si : s) \n" + 
1168
		"      {\n" + 
1169
		"      }\n" + 
1170
		"    for (String @NonNull [] @Marker [] sii : s) \n" + 
1171
		"      {\n" + 
1172
		"      }\n" + 
1173
		"  }\n" + 
1174
		"}\n";
1175
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0058", expectedUnitToString);
1176
}
1177
//Type0 foreach
1178
public void test0059() throws IOException {
1179
	String source = "public class A {\n" +
1180
					"    public void foo() {\n" +
1181
					"        int @NonNull[] @Marker[] s @Readonly[];\n" +
1182
					"    	 for (@Readonly int @NonNull[] si @Marker[] : s) {}\n" +
1183
					"    	 for (int @NonNull[] sii @Marker[] : s) {}\n" +
1184
					"    }\n" +
1185
					"}\n";
1186
	String expectedUnitToString = 
1187
		"public class A {\n" + 
1188
		"  public A() {\n" + 
1189
		"    super();\n" + 
1190
		"  }\n" + 
1191
		"  public void foo() {\n" + 
1192
		"    int @NonNull [] @Marker [] @Readonly [] s;\n" + 
1193
		"    for (@Readonly int @NonNull [] @Marker [] si : s) \n" + 
1194
		"      {\n" + 
1195
		"      }\n" + 
1196
		"    for (int @NonNull [] @Marker [] sii : s) \n" + 
1197
		"      {\n" + 
1198
		"      }\n" + 
1199
		"  }\n" + 
1200
		"}\n";
1201
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0059", expectedUnitToString);
1202
}
1203
// cast expression
1204
public void test0060() throws IOException {
1205
	String source = "public class Clazz {\n" +
1206
					"public static void main(String[] args) {\n" +
1207
					"int x;\n" +
1208
					"x = (Integer)\n" +
1209
					"(@Readonly Object)\n" +
1210
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value=0)[][] )\n" +
1211
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0)[][] )\n" +
1212
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker[][] )\n" +
1213
					"(@Readonly Object)\n" +
1214
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value=0)[][] )\n" +
1215
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0)[][] )\n" +
1216
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker[][] )\n" +
1217
					"(@Readonly Object)\n" +
1218
					"(@Readonly String[] @Normal(Value=0)[][] )\n" +
1219
					"(@Readonly String[] @SingleMember(0)[][] )\n" +
1220
					"(@Readonly String[] @Marker[][] )\n" +
1221
					"(@Readonly Object)\n" +
1222
					"(@Readonly int[] @Normal(Value=0)[][] )\n" +
1223
					"(@Readonly int[] @SingleMember(0)[][] )\n" +
1224
					"(@Readonly int[] @Marker[][] )\n" +
1225
					"(@Readonly Object)\n" +
1226
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator)\n" +
1227
					"(@Readonly Object)\n" +
1228
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>)\n" +
1229
					"(@Readonly Object)\n" +
1230
					"(@ReadOnly String)\n" +
1231
					"(@Readonly Object)\n" +
1232
					"(@Readonly int) 10;\n" +
1233
					"}\n" +
1234
					"}\n";
1235
	String expectedUnitToString = 
1236
		"public class Clazz {\n" + 
1237
		"  public Clazz() {\n" + 
1238
		"    super();\n" + 
1239
		"  }\n" + 
1240
		"  public static void main(String[] args) {\n" + 
1241
		"    int x;\n" + 
1242
		"    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" + 
1243
		"  }\n" + 
1244
		"}\n";
1245
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0060", expectedUnitToString);
1246
}
1247
//cast expression
1248
public void test0061() throws IOException {
1249
	String source = "public class Clazz {\n" +
1250
					"public static void main(String[] args) {\n" +
1251
					"int x;\n" +
1252
					"x = (Integer)\n" +
1253
					"(Object)\n" +
1254
					"(@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value=0)[][] )\n" +
1255
					"(HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0)[][] )\n" +
1256
					"(@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker[][] )\n" +
1257
					"(Object)\n" +
1258
					"(@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value=0)[][] )\n" +
1259
					"(HashMap<Integer, @Negative Integer>[] @SingleMember(0)[][] )\n" +
1260
					"(@Readonly HashMap<@Positive Integer, Integer>[] @Marker[][] )\n" +
1261
					"(Object)\n" +
1262
					"(@Readonly String[] @Normal(Value=0)[][] )\n" +
1263
					"(String[] @SingleMember(0)[][] )\n" +
1264
					"(@Readonly String[] @Marker[][] )\n" +
1265
					"(Object)\n" +
1266
					"(@Readonly int[] @Normal(Value=0)[][] )\n" +
1267
					"(int[] @SingleMember(0)[][] )\n" +
1268
					"(@Readonly int[] @Marker[][] )\n" +
1269
					"(Object)\n" +
1270
					"(@Readonly HashMap<Integer, @Negative Integer>.Iterator)\n" +
1271
					"(Object)\n" +
1272
					"(@Readonly HashMap<@Positive Integer, Integer>)\n" +
1273
					"(Object)\n" +
1274
					"(@ReadOnly String)\n" +
1275
					"(Object)\n" +
1276
					"(@Readonly int) 10;\n" +
1277
					"}\n" +
1278
					"}\n";
1279
	String expectedUnitToString = 
1280
		"public class Clazz {\n" + 
1281
		"  public Clazz() {\n" + 
1282
		"    super();\n" + 
1283
		"  }\n" + 
1284
		"  public static void main(String[] args) {\n" + 
1285
		"    int x;\n" + 
1286
		"    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" + 
1287
		"  }\n" + 
1288
		"}\n";
1289
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0061", expectedUnitToString);
1290
}
1291
// instanceof checks 
1292
public void test0062() throws IOException {
1293
	String source = "public class Clazz {\n" +
1294
					"public static void main(Object o) {\n" +
1295
					"if (o instanceof @Readonly String) {\n" +
1296
					"} else if (o instanceof @Readonly int[] @NonEmpty[][] ) {\n" +
1297
					"} else if (o instanceof @Readonly String[] @NonEmpty[][] ) {\n" +
1298
					"} else if (o instanceof @Readonly HashMap<?,?>[] @NonEmpty[][] ) {\n" +
1299
					"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] ) {\n" +	
1300
					"} else if (o instanceof @Readonly HashMap<?,?>) {\n" +
1301
					"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) {\n" +
1302
					"}\n" +
1303
					"}\n" +
1304
					"}";
1305
	String expectedUnitToString = 
1306
		"public class Clazz {\n" + 
1307
		"  public Clazz() {\n" + 
1308
		"    super();\n" + 
1309
		"  }\n" + 
1310
		"  public static void main(Object o) {\n" + 
1311
		"    if ((o instanceof @Readonly String))\n" + 
1312
		"        {\n" + 
1313
		"        }\n" + 
1314
		"    else\n" + 
1315
		"        if ((o instanceof @Readonly int[] @NonEmpty [][]))\n" + 
1316
		"            {\n" + 
1317
		"            }\n" + 
1318
		"        else\n" + 
1319
		"            if ((o instanceof @Readonly String[] @NonEmpty [][]))\n" + 
1320
		"                {\n" + 
1321
		"                }\n" + 
1322
		"            else\n" + 
1323
		"                if ((o instanceof @Readonly HashMap<?, ?>[] @NonEmpty [][]))\n" + 
1324
		"                    {\n" + 
1325
		"                    }\n" + 
1326
		"                else\n" + 
1327
		"                    if ((o instanceof  @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][]))\n" + 
1328
		"                        {\n" + 
1329
		"                        }\n" + 
1330
		"                    else\n" + 
1331
		"                        if ((o instanceof @Readonly HashMap<?, ?>))\n" + 
1332
		"                            {\n" + 
1333
		"                            }\n" + 
1334
		"                        else\n" + 
1335
		"                            if ((o instanceof  @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator))\n" + 
1336
		"                                {\n" + 
1337
		"                                }\n" + 
1338
		"  }\n" + 
1339
		"}\n";
1340
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0062", expectedUnitToString);
1341
}
1342
// assorted unclassified 
1343
public void test0063() throws IOException {
1344
	String source = "import java.util.HashMap;\n" +
1345
					"import java.util.Map; \n" +  
1346
					"\n" +
1347
					"public class Clazz <@A M extends @B String, @C N extends @D Comparable> extends\n" +
1348
					"								@E Object implements @F Comparable <@G Object> {\n" +
1349
					"	\n" +
1350
					"  Clazz(char[] ...args) @H { \n" +   
1351
					"   }\n" +
1352
					"   \n" +
1353
					"  int @I[] f @J[], g, h[], i@K[];\n" +
1354
					"  int @L[][]@M[] f2; \n" +
1355
					"   \n" +
1356
					"  Clazz (int @N[] @O... a) @Q {}\n" +
1357
					" int @R[]@S[] aa() {}\n" +
1358
					" \n" +
1359
					" int @T[]@U[]@V[] a () @W[]@X[]@Y[] @Z { return null; }\n" +
1360
					"   \n" +
1361
					"  public void main(String @A[] @B ... args) @C throws @D Exception {\n" +
1362
					"  	\n" +
1363
					"       HashMap<@E String, @F String> b1;\n" +
1364
					"      \n" +
1365
					"     int b; b = (@G int) 10;\n" +
1366
					"      \n" +
1367
					"     char @H[]@I[] ch; ch = (@K char @L[]@M[])(@N char @O[]@P[]) null;\n" +
1368
					"      \n" +
1369
					"      int[] i; i = new @Q int @R[10];\n" +
1370
					"       \n" +
1371
					"      \n" +
1372
					"   Integer w; w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" +
1373
					"    throw new @V Exception(\"test\");\n" +
1374
					"    boolean c; c  = null instanceof @W String;\n" +
1375
					"	} \n" +
1376
					" public <@X X, @Y Y> void foo(X x, Y @Z... y) {  \n" +
1377
					"	\n" +
1378
					"}\n" +
1379
					" \n" +
1380
					" void foo(Map<? super @A Object, ? extends @B String> m){}\n" +
1381
					" public int compareTo(Object arg0) {\n" +
1382
					"     return 0;\n" +
1383
					" }\n" +
1384
					"\n" +
1385
					"}\n" +
1386
					"class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" +
1387
					"	\n" +
1388
					"  public Integer get(Integer integer) {\n" +
1389
					"       return null;\n" +
1390
					"   }\n" +
1391
					"}\n";
1392
					
1393
					
1394
	String expectedUnitToString = "import java.util.HashMap;\n" + 
1395
								  "import java.util.Map;\n" + 
1396
								  "public class Clazz<@A M extends @B String, @C N extends @D Comparable> extends @E Object implements @F Comparable<@G Object> {\n" + 
1397
								  "  int @I [] @J [] f;\n" + 
1398
								  "  int @I [] g;\n" + 
1399
								  "  int @I [][] h;\n" + 
1400
								  "  int @I [] @K [] i;\n" + 
1401
								  "  int @L [][] @M [] f2;\n" + 
1402
								  "  Clazz(char[]... args) @H {\n" + 
1403
								  "    super();\n" + 
1404
								  "  }\n" + 
1405
								  "  Clazz(int @N [] @O ... a) @Q {\n" + 
1406
								  "    super();\n" + 
1407
								  "  }\n" + 
1408
								  "  int @R [] @S [] aa() {\n" + 
1409
								  "  }\n" + 
1410
								  "  int @T [] @U [] @V [] @W [] @X [] @Y [] a() @Z {\n" + 
1411
								  "    return null;\n" + 
1412
								  "  }\n" + 
1413
								  "  public void main(String @A [] @B ... args) @C throws @D Exception {\n" + 
1414
								  "    HashMap<@E String, @F String> b1;\n" + 
1415
								  "    int b;\n" +
1416
								  "    b = (@G int) 10;\n" + 
1417
								  "    char @H [] @I [] ch;\n" +
1418
								  "    ch = (@K char @L [] @M []) (@N char @O [] @P []) null;\n" + 
1419
								  "    int[] i;\n" +
1420
								  "    i = new @Q int @R [10];\n" + 
1421
								  "    Integer w;\n" +
1422
								  "    w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" + 
1423
								  "    throw new @V Exception(\"test\");\n" + 
1424
								  "    boolean c;\n" +
1425
								  "    c = (null instanceof @W String);\n" + 
1426
								  "  }\n" + 
1427
								  "  public <@X X, @Y Y>void foo(X x, Y @Z ... y) {\n" + 
1428
								  "  }\n" + 
1429
								  "  void foo(Map<? super @A Object, ? extends @B String> m) {\n" + 
1430
								  "  }\n" + 
1431
								  "  public int compareTo(Object arg0) {\n" + 
1432
								  "    return 0;\n" + 
1433
								  "  }\n" + 
1434
								  "}\n" + 
1435
								  "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" + 
1436
								  "  X() {\n" + 
1437
								  "    super();\n" + 
1438
								  "  }\n" + 
1439
								  "  public Integer get(Integer integer) {\n" + 
1440
								  "    return null;\n" + 
1441
								  "  }\n" + 
1442
								  "}\n";
1443
	// indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
1444
	// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
1445
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0063", expectedUnitToString);
1446
}
1447
//assorted unclassified 
1448
public void test0064() throws IOException {
1449
	String source = "class X<T extends @E Object & @F Comparable<? super T>> {}\n";
1450
	String expectedUnitToString = "class X<T extends @E Object & @F Comparable<? super T>> {\n" + 
1451
								  "  X() {\n" + 
1452
								  "    super();\n" + 
1453
								  "  }\n" + 
1454
								  "}\n";
1455
	// indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
1456
	// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
1457
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test064", expectedUnitToString);
1458
}
1459
//type class literal expression
1460
public void test0065() throws IOException {
1461
	String source = "public class Clazz {\n" +
1462
					"public static void main(String[] args) {\n" +
1463
					"Class x;\n" +
1464
					"x = Integer.class;\n" +
1465
					"x = @Readonly Object.class;\n" +
1466
					"x = HashMap.Iterator[] @Normal(Value=0)[][].class;\n" +
1467
					"x = @Readonly HashMap.Iterator[] @SingleMember(0)[][].class;\n" +
1468
					"x = @Readonly HashMap.Iterator @Normal(Value=1)[] @Marker[] @Normal(Value=2)[].class;\n" +
1469
					"x = @Readonly Object.class;\n" +
1470
					"x = @Readonly String[] @Normal(Value=0)[][].class;\n" +
1471
					"x = @Readonly String[] @SingleMember(0)[][].class;\n" +
1472
					"x = @Readonly String[] @Marker[][].class;\n" +
1473
					"x = @Readonly Object.class;\n" +
1474
					"x = @Readonly int[][] @Normal(Value=0)[].class;\n" +
1475
					"x = @Readonly int @SingleMember(0)[][][].class;\n" +
1476
					"x = @Readonly int[] @Marker[][].class;\n" +
1477
					"x = @Readonly int.class;\n" +
1478
					"}\n" +
1479
					"}\n";
1480
	String expectedUnitToString = 
1481
		"public class Clazz {\n" + 
1482
		"  public Clazz() {\n" + 
1483
		"    super();\n" + 
1484
		"  }\n" + 
1485
		"  public static void main(String[] args) {\n" + 
1486
		"    Class x;\n" + 
1487
		"    x = Integer.class;\n" + 
1488
		"    x = @Readonly Object.class;\n" + 
1489
		"    x = HashMap.Iterator[] @Normal(Value = 0) [][].class;\n" + 
1490
		"    x = @Readonly HashMap.Iterator[] @SingleMember(0) [][].class;\n" + 
1491
		"    x = @Readonly HashMap.Iterator @Normal(Value = 1) [] @Marker [] @Normal(Value = 2) [].class;\n" + 
1492
		"    x = @Readonly Object.class;\n" + 
1493
		"    x = @Readonly String[] @Normal(Value = 0) [][].class;\n" + 
1494
		"    x = @Readonly String[] @SingleMember(0) [][].class;\n" + 
1495
		"    x = @Readonly String[] @Marker [][].class;\n" + 
1496
		"    x = @Readonly Object.class;\n" + 
1497
		"    x = @Readonly int[][] @Normal(Value = 0) [].class;\n" + 
1498
		"    x = @Readonly int @SingleMember(0) [][][].class;\n" + 
1499
		"    x = @Readonly int[] @Marker [][].class;\n" + 
1500
		"    x = @Readonly int.class;\n" + 
1501
		"  }\n" + 
1502
		"}\n";
1503
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0065", expectedUnitToString);
1504
}
1505
//type class literal expression
1506
public void test0066() throws IOException {
1507
	String source = "public class X {\n" + 
1508
			"	<T extends Y<@A String @C[][]@B[]> & Cloneable> void foo(T t) {}\n" + 
1509
			"}";
1510
	String expectedUnitToString = 
1511
		"public class X {\n" + 
1512
		"  public X() {\n" + 
1513
		"    super();\n" + 
1514
		"  }\n" + 
1515
		"  <T extends Y<@A String @C [][] @B []> & Cloneable>void foo(T t) {\n" + 
1516
		"  }\n" + 
1517
		"}\n";
1518
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0066", expectedUnitToString);
1519
}
1520
//check locations
1521
public void test0067() throws IOException {
1522
	String source = 
1523
		"public class X {\n" + 
1524
		"	@H String @E[] @F[] @G[] field;\n" + 
1525
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
1526
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
1527
		"}";
1528
	String expectedUnitToString = 
1529
		"public class X {\n" + 
1530
		"  @H String @E [] @F [] @G [] field;\n" + 
1531
		"  @A Map<@B String, @C List<@D Object>> field2;\n" + 
1532
		"  @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" + 
1533
		"  public X() {\n" + 
1534
		"    super();\n" + 
1535
		"  }\n" + 
1536
		"}\n";
1537
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0067", expectedUnitToString);
1538
}
1539
//check locations
1540
public void test0068() throws IOException {
1541
	String source = 
1542
		"public class X {\n" + 
1543
		"	@H String @E[] @F[] @G[] field;\n" + 
1544
		"}";
1545
	String expectedUnitToString = 
1546
		"public class X {\n" + 
1547
		"  @H String @E [] @F [] @G [] field;\n" + 
1548
		"  public X() {\n" + 
1549
		"    super();\n" + 
1550
		"  }\n" + 
1551
		"}\n";
1552
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1553
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0068", expectedUnitToString, visitor);
1554
	Map locations = visitor.getLocations();
1555
	assertEquals("Wrong size", 4, locations.size());
1556
	assertEquals("Wrong location", null, locations.get("@E"));
1557
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1558
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1559
	assertEquals("Wrong location", "{2}", locations.get("@H"));
1560
}
1561
//check locations
1562
public void test0069() throws IOException {
1563
	String source = 
1564
		"public class X {\n" + 
1565
		"	@A Map<@B String, @H String> field3;\n" + 
1566
		"}";
1567
	String expectedUnitToString = 
1568
		"public class X {\n" + 
1569
		"  @A Map<@B String, @H String> field3;\n" + 
1570
		"  public X() {\n" + 
1571
		"    super();\n" + 
1572
		"  }\n" + 
1573
		"}\n";
1574
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1575
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0069", expectedUnitToString, visitor);
1576
	Map locations = visitor.getLocations();
1577
	assertEquals("Wrong size", 3, locations.size());
1578
	assertEquals("Wrong location", null, locations.get("@A"));
1579
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1580
	assertEquals("Wrong location", "{1}", locations.get("@H"));
1581
}
1582
//check locations
1583
public void test0070() throws IOException {
1584
	String source = 
1585
		"public class X {\n" + 
1586
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
1587
		"}";
1588
	String expectedUnitToString = 
1589
		"public class X {\n" + 
1590
		"  @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" + 
1591
		"  public X() {\n" + 
1592
		"    super();\n" + 
1593
		"  }\n" + 
1594
		"}\n";
1595
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1596
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0070", expectedUnitToString, visitor);
1597
	Map locations = visitor.getLocations();
1598
	assertEquals("Wrong size", 6, locations.size());
1599
	assertEquals("Wrong location", null, locations.get("@A"));
1600
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1601
	assertEquals("Wrong location", "{1}", locations.get("@E"));
1602
	assertEquals("Wrong location", "{1,0}", locations.get("@F"));
1603
	assertEquals("Wrong location", "{1,1}", locations.get("@G"));
1604
	assertEquals("Wrong location", "{1,2}", locations.get("@H"));
1605
}
1606
//check locations
1607
public void test0071() throws IOException {
1608
	String source = 
1609
		"public class X {\n" + 
1610
		"	@A Map<@B String, @C List<@H String @E[][] @G[]>> field;\n" + 
1611
		"}";
1612
	String expectedUnitToString = 
1613
		"public class X {\n" + 
1614
		"  @A Map<@B String, @C List<@H String @E [][] @G []>> field;\n" + 
1615
		"  public X() {\n" + 
1616
		"    super();\n" + 
1617
		"  }\n" + 
1618
		"}\n";
1619
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1620
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0071", expectedUnitToString, visitor);
1621
	Map locations = visitor.getLocations();
1622
	assertEquals("Wrong size", 6, locations.size());
1623
	assertEquals("Wrong location", null, locations.get("@A"));
1624
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1625
	assertEquals("Wrong location", "{1}", locations.get("@C"));
1626
	assertEquals("Wrong location", "{1,0,2}", locations.get("@H"));
1627
	assertEquals("Wrong location", "{1,0}", locations.get("@E"));
1628
	assertEquals("Wrong location", "{1,0,1}", locations.get("@G"));
1629
}
1630
//check locations
1631
public void test0072() throws IOException {
1632
	String source = 
1633
		"public class X {\n" + 
1634
		"	@A Map<@B String, @C List<@H String @E[][] @G[]>>[] @I[] @J[] field;\n" + 
1635
		"}";
1636
	String expectedUnitToString = 
1637
		"public class X {\n" + 
1638
		"  @A Map<@B String, @C List<@H String @E [][] @G []>>[] @I [] @J [] field;\n" + 
1639
		"  public X() {\n" + 
1640
		"    super();\n" + 
1641
		"  }\n" + 
1642
		"}\n";
1643
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1644
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0072", expectedUnitToString, visitor);
1645
	Map locations = visitor.getLocations();
1646
	assertEquals("Wrong size", 8, locations.size());
1647
	assertEquals("Wrong location", "{0}", locations.get("@I"));
1648
	assertEquals("Wrong location", "{1}", locations.get("@J"));
1649
	assertEquals("Wrong location", "{2}", locations.get("@A"));
1650
	assertEquals("Wrong location", "{2,0}", locations.get("@B"));
1651
	assertEquals("Wrong location", "{2,1}", locations.get("@C"));
1652
	assertEquals("Wrong location", "{2,1,0,2}", locations.get("@H"));
1653
	assertEquals("Wrong location", "{2,1,0}", locations.get("@E"));
1654
	assertEquals("Wrong location", "{2,1,0,1}", locations.get("@G"));
1655
}
1656
//check locations
1657
public void test0073() throws IOException {
1658
	String source = 
1659
		"public class X {\n" + 
1660
		"	@A Map<@B String, @C List<@H String @E[][] @G[]>> @I[][] @J[] field;\n" + 
1661
		"}";
1662
	String expectedUnitToString = 
1663
		"public class X {\n" + 
1664
		"  @A Map<@B String, @C List<@H String @E [][] @G []>> @I [][] @J [] field;\n" + 
1665
		"  public X() {\n" + 
1666
		"    super();\n" + 
1667
		"  }\n" + 
1668
		"}\n";
1669
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1670
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0073", expectedUnitToString, visitor);
1671
	Map locations = visitor.getLocations();
1672
	assertEquals("Wrong size", 8, locations.size());
1673
	assertEquals("Wrong location", null, locations.get("@I"));
1674
	assertEquals("Wrong location", "{1}", locations.get("@J"));
1675
	assertEquals("Wrong location", "{2}", locations.get("@A"));
1676
	assertEquals("Wrong location", "{2,0}", locations.get("@B"));
1677
	assertEquals("Wrong location", "{2,1}", locations.get("@C"));
1678
	assertEquals("Wrong location", "{2,1,0,2}", locations.get("@H"));
1679
	assertEquals("Wrong location", "{2,1,0}", locations.get("@E"));
1680
	assertEquals("Wrong location", "{2,1,0,1}", locations.get("@G"));
1681
}
1682
//check locations
1683
public void test0074() throws IOException {
1684
	String source = 
1685
		"public class X {\n" + 
1686
		"	@A Map<@C List<@H String @E[][] @G[]>, String @B[] @D[]> @I[] @F[] @J[] field;\n" + 
1687
		"}";
1688
	String expectedUnitToString = 
1689
		"public class X {\n" + 
1690
		"  @A Map<@C List<@H String @E [][] @G []>, String @B [] @D []> @I [] @F [] @J [] field;\n" + 
1691
		"  public X() {\n" + 
1692
		"    super();\n" + 
1693
		"  }\n" + 
1694
		"}\n";
1695
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1696
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0074", expectedUnitToString, visitor);
1697
	Map locations = visitor.getLocations();
1698
	assertEquals("Wrong size", 10, locations.size());
1699
	assertEquals("Wrong location", null, locations.get("@I"));
1700
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1701
	assertEquals("Wrong location", "{1}", locations.get("@J"));
1702
	assertEquals("Wrong location", "{2}", locations.get("@A"));
1703
	assertEquals("Wrong location", "{2,0}", locations.get("@C"));
1704
	assertEquals("Wrong location", "{2,0,0}", locations.get("@E"));
1705
	assertEquals("Wrong location", "{2,0,0,1}", locations.get("@G"));
1706
	assertEquals("Wrong location", "{2,0,0,2}", locations.get("@H"));
1707
	assertEquals("Wrong location", "{2,1,0}", locations.get("@D"));
1708
	assertEquals("Wrong location", "{2,1}", locations.get("@B"));
1709
}
1710
//check locations
1711
public void test0075() throws IOException {
1712
	String source = 
1713
		"public class X {\n" + 
1714
		"	@A Map<@C List<@H String @E[][] @G[]>, @B List<String [] @D[]>> [] @I[] @F[] @J[] field;\n" + 
1715
		"}";
1716
	String expectedUnitToString = 
1717
		"public class X {\n" + 
1718
		"  @A Map<@C List<@H String @E [][] @G []>, @B List<String[] @D []>>[] @I [] @F [] @J [] field;\n" + 
1719
		"  public X() {\n" + 
1720
		"    super();\n" + 
1721
		"  }\n" + 
1722
		"}\n";
1723
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1724
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0075", expectedUnitToString, visitor);
1725
	Map locations = visitor.getLocations();
1726
	assertEquals("Wrong size", 10, locations.size());
1727
	assertEquals("Wrong location", "{0}", locations.get("@I"));
1728
	assertEquals("Wrong location", "{1}", locations.get("@F"));
1729
	assertEquals("Wrong location", "{2}", locations.get("@J"));
1730
	assertEquals("Wrong location", "{3}", locations.get("@A"));
1731
	assertEquals("Wrong location", "{3,0}", locations.get("@C"));
1732
	assertEquals("Wrong location", "{3,0,0}", locations.get("@E"));
1733
	assertEquals("Wrong location", "{3,0,0,1}", locations.get("@G"));
1734
	assertEquals("Wrong location", "{3,0,0,2}", locations.get("@H"));
1735
	assertEquals("Wrong location", "{3,1}", locations.get("@B"));
1736
	assertEquals("Wrong location", "{3,1,0,0}", locations.get("@D"));
1737
}
1738
//check locations
1739
public void test0076() throws IOException {
1740
	String source = 
1741
		"public class X {\n" + 
1742
		"	@A Map<@B String, @C List<@D Object>> field;\n" + 
1743
		"}";
1744
	String expectedUnitToString = 
1745
		"public class X {\n" + 
1746
		"  @A Map<@B String, @C List<@D Object>> field;\n" + 
1747
		"  public X() {\n" + 
1748
		"    super();\n" + 
1749
		"  }\n" + 
1750
		"}\n";
1751
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1752
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0076", expectedUnitToString, visitor);
1753
	Map locations = visitor.getLocations();
1754
	assertEquals("Wrong size", 4, locations.size());
1755
	assertEquals("Wrong location", null, locations.get("@A"));
1756
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1757
	assertEquals("Wrong location", "{1}", locations.get("@C"));
1758
	assertEquals("Wrong location", "{1,0}", locations.get("@D"));
1759
}
1760
//check locations
1761
public void test0077() throws IOException {
1762
	String source = 
1763
		"public class X {\n" + 
1764
		"	@H String @E[] @F[] @G[] field;\n" + 
1765
		"}";
1766
	String expectedUnitToString = 
1767
		"public class X {\n" + 
1768
		"  @H String @E [] @F [] @G [] field;\n" + 
1769
		"  public X() {\n" + 
1770
		"    super();\n" + 
1771
		"  }\n" + 
1772
		"}\n";
1773
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1774
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0077", expectedUnitToString, visitor);
1775
	Map locations = visitor.getLocations();
1776
	assertEquals("Wrong size", 4, locations.size());
1777
	assertEquals("Wrong location", null, locations.get("@E"));
1778
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1779
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1780
	assertEquals("Wrong location", "{2}", locations.get("@H"));
1781
}
1782
//check locations
1783
public void test0078() throws IOException {
1784
	String source = 
1785
		"public class X {\n" + 
1786
		"	@A Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" + 
1787
		"}";
1788
	String expectedUnitToString = 
1789
		"public class X {\n" + 
1790
		"  @A Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" + 
1791
		"  public X() {\n" + 
1792
		"    super();\n" + 
1793
		"  }\n" + 
1794
		"}\n";
1795
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1796
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0078", expectedUnitToString, visitor);
1797
	Map locations = visitor.getLocations();
1798
	assertEquals("Wrong size", 8, locations.size());
1799
	assertEquals("Wrong location", null, locations.get("@A"));
1800
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1801
	assertEquals("Wrong location", "{0,0,2}", locations.get("@C"));
1802
	assertEquals("Wrong location", "{0,0}", locations.get("@D"));
1803
	assertEquals("Wrong location", "{0,0,0}", locations.get("@E"));
1804
	assertEquals("Wrong location", "{0,0,1}", locations.get("@F"));
1805
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1806
	assertEquals("Wrong location", "{1,0}", locations.get("@H"));
1807
}
1808
//check locations
1809
public void test0079() throws IOException {
1810
	String source = 
1811
		"public class X {\n" + 
1812
		"	@A java.util.Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" + 
1813
		"}";
1814
	String expectedUnitToString = 
1815
		"public class X {\n" + 
1816
		"  @A java.util.Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" + 
1817
		"  public X() {\n" + 
1818
		"    super();\n" + 
1819
		"  }\n" + 
1820
		"}\n";
1821
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1822
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0079", expectedUnitToString, visitor);
1823
	Map locations = visitor.getLocations();
1824
	assertEquals("Wrong size", 8, locations.size());
1825
	assertEquals("Wrong location", null, locations.get("@A"));
1826
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1827
	assertEquals("Wrong location", "{0,0,2}", locations.get("@C"));
1828
	assertEquals("Wrong location", "{0,0}", locations.get("@D"));
1829
	assertEquals("Wrong location", "{0,0,0}", locations.get("@E"));
1830
	assertEquals("Wrong location", "{0,0,1}", locations.get("@F"));
1831
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1832
	assertEquals("Wrong location", "{1,0}", locations.get("@H"));
1833
}
1834
//check locations
1835
public void test0080() throws IOException {
1836
	String source = 
1837
		"public class X {\n" + 
1838
		"	@B Map<? extends Z, ? extends @A Z> field;\n" + 
1839
		"}";
1840
	String expectedUnitToString = 
1841
		"public class X {\n" + 
1842
		"  @B Map<? extends Z, ? extends @A Z> field;\n" + 
1843
		"  public X() {\n" + 
1844
		"    super();\n" + 
1845
		"  }\n" + 
1846
		"}\n";
1847
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1848
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0080", expectedUnitToString, visitor);
1849
	Map locations = visitor.getLocations();
1850
	assertEquals("Wrong size", 2, locations.size());
1851
	assertEquals("Wrong location", null, locations.get("@B"));
1852
	assertEquals("Wrong location", "{1}", locations.get("@A"));
1853
}
1854
//check locations
1855
public void test0081() throws IOException {
1856
	String source = 
1857
		"public class X {\n" + 
1858
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
1859
		"}";
1860
	String expectedUnitToString = 
1861
		"public class X {\n" + 
1862
		"  @H java.lang.String @E [] @F [] @G [] field;\n" + 
1863
		"  public X() {\n" + 
1864
		"    super();\n" + 
1865
		"  }\n" + 
1866
		"}\n";
1867
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1868
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0081", expectedUnitToString, visitor);
1869
	Map locations = visitor.getLocations();
1870
	assertEquals("Wrong size", 4, locations.size());
1871
	assertEquals("Wrong location", null, locations.get("@E"));
1872
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1873
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1874
	assertEquals("Wrong location", "{2}", locations.get("@H"));
1875
}
1876
//check locations
1877
public void test0082() throws IOException {
1878
	String source = 
1879
		"public class X {\n" + 
1880
		"	@A Map<@B java.lang.String, @H java.lang.String @E[] @F[] @G[]> field3;\n" + 
1881
		"}";
1882
	String expectedUnitToString = 
1883
		"public class X {\n" + 
1884
		"  @A Map<@B java.lang.String, @H java.lang.String @E [] @F [] @G []> field3;\n" + 
1885
		"  public X() {\n" + 
1886
		"    super();\n" + 
1887
		"  }\n" + 
1888
		"}\n";
1889
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1890
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0082", expectedUnitToString, visitor);
1891
	Map locations = visitor.getLocations();
1892
	assertEquals("Wrong size", 6, locations.size());
1893
	assertEquals("Wrong location", null, locations.get("@A"));
1894
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1895
	assertEquals("Wrong location", "{1}", locations.get("@E"));
1896
	assertEquals("Wrong location", "{1,0}", locations.get("@F"));
1897
	assertEquals("Wrong location", "{1,1}", locations.get("@G"));
1898
	assertEquals("Wrong location", "{1,2}", locations.get("@H"));
1899
}
1900
public void test0083() throws IOException {
1901
	String source =
1902
		"@Marker class A {}\n;" +
1903
		"@Marker class B extends @Marker A {}\n" +
1904
		"@Marker class C extends @Marker @SingleMember(0) A {}\n" +
1905
		"@Marker class D extends @Marker @SingleMember(0) @Normal(value = 0) A {}\n" +
1906
		"@Marker class E extends B {}\n;";
1907
1908
	String expectedUnitToString =
1909
		"@Marker class A {\n" +
1910
		"  A() {\n" +
1911
		"    super();\n" +
1912
		"  }\n" +
1913
		"}\n" +
1914
		"@Marker class B extends @Marker A {\n" +
1915
		"  B() {\n" +
1916
		"    super();\n" +
1917
		"  }\n" +
1918
		"}\n" +
1919
		"@Marker class C extends @Marker @SingleMember(0) A {\n" +
1920
		"  C() {\n" +
1921
		"    super();\n" +
1922
		"  }\n" +
1923
		"}\n" +
1924
		"@Marker class D extends @Marker @SingleMember(0) @Normal(value = 0) A {\n" +
1925
		"  D() {\n" +
1926
		"    super();\n" +
1927
		"  }\n" +
1928
		"}\n" +
1929
		"@Marker class E extends B {\n" +
1930
		"  E() {\n" +
1931
		"    super();\n" +
1932
		"  }\n" +
1933
		"}\n";
1934
	checkParse(source.toCharArray(), null, "test0083", expectedUnitToString);
1935
}
1936
1937
// To test Parser.consumeAdditionalBound() with Type annotations
1938
public void test0084() throws IOException {
1939
	String source =
1940
		"@Marker interface I<@Negative T> {}\n" +
1941
		"@SingleMember(0) interface J<@Positive T> {}\n" +
1942
		"@Marker class A implements I<@SingleMember(0) A>, J<@Marker A> {}\n" +
1943
		"@Normal(value = 1) class X<E extends @Positive A & @Marker I<A> & @Marker @SingleMember(1) J<@Readonly A>>  {\n" +
1944
		"}";
1945
	String expectedUnitToString =
1946
		"@Marker interface I<@Negative T> {\n" +
1947
		"}\n" +
1948
		"@SingleMember(0) interface J<@Positive T> {\n" +
1949
		"}\n" +
1950
		"@Marker class A implements I<@SingleMember(0) A>, J<@Marker A> {\n" +
1951
		"  A() {\n" +
1952
		"    super();\n" +
1953
		"  }\n" +
1954
		"}\n" +
1955
		"@Normal(value = 1) class X<E extends @Positive A & @Marker I<A> & @Marker @SingleMember(1) J<@Readonly A>> {\n" +
1956
		"  X() {\n" +
1957
		"    super();\n" +
1958
		"  }\n" +
1959
		"}\n";
1960
	checkParse(source.toCharArray(), null, "test0084", expectedUnitToString );
1961
}
1962
1963
// To test Parser.consumeAdditionalBound() with Type annotations
1964
public void test0085() throws IOException {
1965
	String source =
1966
		"import java.io.Serializable;\n" +
1967
		"\n" +
1968
		"@SingleMember(10) class X<T extends @Marker Serializable & @Normal(value = 10) Runnable, V extends @Marker T> {\n" +
1969
		"	@Negative T t;\n" +
1970
		"	@Marker X(@Readonly T t) {\n" +
1971
		"		this.t = t;\n" +
1972
		"	}\n" +
1973
		"	void foo() @Marker {\n" +
1974
		"		(this == null ? t : t).run();\n" +
1975
		"		((@Marker V) t).run();\n" +
1976
		"	}\n" +
1977
		"	public static void main(@Readonly String @Marker [] args) {\n" +
1978
		"		new @Marker  X<@Marker A, @Negative A>(new @Marker A()).foo();\n" +
1979
		"	}\n" +
1980
		"}\n" +
1981
		"@Marker class A implements @Marker Serializable, @SingleMember(1) Runnable {\n" +
1982
		"	public void run() {\n" +
1983
		"		System.out.print(\"AA\");\n" +
1984
		"	}\n" +
1985
		"}\n";
1986
	String expectedUnitToString =
1987
		"import java.io.Serializable;\n" +
1988
		"@SingleMember(10) class X<T extends @Marker Serializable & @Normal(value = 10) Runnable, V extends @Marker T> {\n" +
1989
		"  @Negative T t;\n" +
1990
		"  @Marker X(@Readonly T t) {\n" +
1991
		"    super();\n" +
1992
		"    this.t = t;\n" +
1993
		"  }\n" +
1994
		"  void foo() @Marker {\n" +
1995
		"    ((this == null) ? t : t).run();\n" +
1996
		"    (@Marker V) t.run();\n" +
1997
		"  }\n" +
1998
		"  public static void main(@Readonly String @Marker [] args) {\n" +
1999
		"    new @Marker X<@Marker A, @Negative A>(new @Marker A()).foo();\n" +
2000
		"  }\n" +
2001
		"}\n" +
2002
		"@Marker class A implements @Marker Serializable, @SingleMember(1) Runnable {\n" +
2003
		"  A() {\n" +
2004
		"    super();\n" +
2005
		"  }\n" +
2006
		"  public void run() {\n" +
2007
		"    System.out.print(\"AA\");\n" +
2008
		"  }\n" +
2009
		"}\n";
2010
	checkParse(source.toCharArray(), null, "test0085", expectedUnitToString );
2011
}
2012
2013
// To test Parser.classInstanceCreation() with type annotations
2014
public void test0086() throws IOException {
2015
	String source =
2016
		"class X {\n" +
2017
		"	@Marker X() {\n" +
2018
		"		System.out.print(\"new X created\");\n" +
2019
		"	}\n" +
2020
		"  	void f() throws @Marker InstantiationException {\n" +
2021
		"       X testX;\n" +
2022
		"		testX = new @Readonly @Negative X();\n" +
2023
		"		Double d;\n" +
2024
		"		d = new @Marker @Positive Double(1.1);\n" +
2025
		"     	throw new @Positive @Normal(value = 10) InstantiationException(\"test\");\n" +
2026
		"   }\n" +
2027
		"}";
2028
	String expectedUnitToString =
2029
		"class X {\n" +
2030
		"  @Marker X() {\n" +
2031
		"    super();\n" +
2032
		"    System.out.print(\"new X created\");\n" +
2033
		"  }\n" +
2034
		"  void f() throws @Marker InstantiationException {\n" +
2035
		"    X testX;\n" +
2036
		"    testX = new @Readonly @Negative X();\n" +
2037
		"    Double d;\n" +
2038
		"    d = new @Marker @Positive Double(1.1);\n" +
2039
		"    throw new @Positive @Normal(value = 10) InstantiationException(\"test\");\n" +
2040
		"  }\n" +
2041
		"}\n";
2042
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0086", expectedUnitToString );
2043
}
2044
2045
// To test Parser.classInstanceCreation() with type annotations
2046
public void test0087() throws IOException {
2047
	String source =
2048
		"class X {\n" +
2049
		"	@Marker X() {\n" +
2050
		"		System.out.print(\"new X created\");\n" +
2051
		"	}\n" +
2052
		"	@Marker class Inner {\n" +
2053
		"		@Normal(value = 10) Inner(){\n" +
2054
		"			System.out.print(\"X.Inner created\");\n" +
2055
		"		}\n" +
2056
		"	}\n" +
2057
		"	public String getString(){\n" +
2058
		"		return \"hello\";\n" +
2059
		"	}\n" +
2060
		"  	void f() @Marker {\n" +
2061
		"       String testString;\n" +
2062
		"		testString = new @Readonly @Negative X().getString();\n" +
2063
		"		X.Inner testInner;\n" +
2064
		"		testInner = new @Readonly X.Inner();\n" +
2065
		"		int i;\n" +
2066
		"		for(i = 0; i < 10; i++)\n" +
2067
		"			System.out.print(\"test\");\n" +
2068
		"   }\n" +
2069
		"}";
2070
	String expectedUnitToString =
2071
		"class X {\n" +
2072
		"  @Marker class Inner {\n" +
2073
		"    @Normal(value = 10) Inner() {\n" +
2074
		"      super();\n" +
2075
		"      System.out.print(\"X.Inner created\");\n" +
2076
		"    }\n" +
2077
		"  }\n" +
2078
		"  @Marker X() {\n" +
2079
		"    super();\n" +
2080
		"    System.out.print(\"new X created\");\n" +
2081
		"  }\n" +
2082
		"  public String getString() {\n" +
2083
		"    return \"hello\";\n" +
2084
		"  }\n" +
2085
		"  void f() @Marker {\n" +
2086
		"    String testString;\n" +
2087
		"    testString = new @Readonly @Negative X().getString();\n" +
2088
		"    X.Inner testInner;\n" +
2089
		"    testInner = new @Readonly X.Inner();\n" +
2090
		"    int i;\n" +
2091
		"    for (i = 0; (i < 10); i ++) \n" +
2092
		"      System.out.print(\"test\");\n" +
2093
		"  }\n" +
2094
		"}\n";
2095
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0087", expectedUnitToString );
2096
}
2097
2098
// To test Parser.classInstanceCreation() with type annotations
2099
public void test0088() throws IOException {
2100
	String source =
2101
		"import java.io.Serializable;\n" +
2102
		"class X {\n" +
2103
		"	public static void main(String[] args) {\n" +
2104
		"		new @Marker Serializable() {\n" +
2105
		"		};\n" +
2106
		"		new @Positive @Marker Serializable() {\n" +
2107
		"			public long serialVersion;\n" +
2108
		"		};\n" +
2109
		"	}\n" +
2110
		"}";
2111
	String expectedUnitToString =
2112
		"import java.io.Serializable;\n" +
2113
		"class X {\n" +
2114
		"  X() {\n" +
2115
		"    super();\n" +
2116
		"  }\n" +
2117
		"  public static void main(String[] args) {\n" +
2118
		"    new @Marker Serializable() {\n" +
2119
		"    };\n" +
2120
		"    new @Positive @Marker Serializable() {\n" +
2121
		"      public long serialVersion;\n" +
2122
		"    };\n" +
2123
		"  }\n" +
2124
		"}\n";
2125
	checkParse(source.toCharArray(), null, "test0088", expectedUnitToString );
2126
}
2127
2128
// To test Parser.classInstanceCreation() with type annotations
2129
public void test0089() throws IOException {
2130
	String source =
2131
		"import java.io.Serializable;\n" +
2132
		"class X<T>{\n" +
2133
		"	public void f() {\n" +
2134
		"		X testX;\n" +
2135
		"		testX = new @Marker @SingleMember(10) X<@Negative Integer>();\n" +
2136
		"		System.out.print(\"object created\");\n" +
2137
		"	}\n" +
2138
		"}";
2139
	String expectedUnitToString =
2140
		"import java.io.Serializable;\n" +
2141
		"class X<T> {\n" +
2142
		"  X() {\n" +
2143
		"    super();\n" +
2144
		"  }\n" +
2145
		"  public void f() {\n" +
2146
		"    X testX;\n" +
2147
		"    testX = new @Marker @SingleMember(10) X<@Negative Integer>();\n" +
2148
		"    System.out.print(\"object created\");\n" +
2149
		"  }\n" +
2150
		"}\n";
2151
	checkParse(source.toCharArray(), null, "test0089", expectedUnitToString );
2152
}
2153
2154
// To test Parser.classInstanceCreation() with type annotations
2155
public void test0090() throws IOException {
2156
	String source =
2157
		"class X <@Marker T extends @Readonly String> {\n" +
2158
		"    T foo(T t) {\n" +
2159
		"        return t;\n" +
2160
		"    }\n" +
2161
		"    public static void main(String[] args) {\n" +
2162
		"        new @Readonly X<String>().baz(\"SUCCESS\");\n" +	// Parser.classInstanceCreation called
2163
		"    }\n" +
2164
		"    void baz(final T t) {\n" +
2165
		"        new @Readonly @Marker Object() {\n" +	// Parser.classInstanceCreation called
2166
		"            void print() {\n" +
2167
		"            }\n" +
2168
		"        }.print();\n" +
2169
		"    }\n" +
2170
		"}\n";
2171
	String expectedUnitToString =
2172
		"class X<@Marker T extends @Readonly String> {\n" +
2173
		"  X() {\n" +
2174
		"    super();\n" +
2175
		"  }\n" +
2176
		"  T foo(T t) {\n" +
2177
		"    return t;\n" +
2178
		"  }\n" +
2179
		"  public static void main(String[] args) {\n" +
2180
		"    new @Readonly X<String>().baz(\"SUCCESS\");\n" +
2181
		"  }\n" +
2182
		"  void baz(final T t) {\n" +
2183
		"    new @Readonly @Marker Object() {\n" +
2184
		"  void print() {\n" +
2185
		"  }\n" +
2186
		"}.print();\n" +
2187
		"  }\n" +
2188
		"}\n";
2189
	checkParse(source.toCharArray(), null, "test0090", expectedUnitToString );
2190
}
2191
2192
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2193
public void test0091() throws IOException {
2194
	String source =
2195
		"class X <@Marker T extends @Readonly String> {\n" +
2196
		"    public static void main(String[] args) {\n" +
2197
		"		int [] x1;\n" +
2198
		"		x1 = new int @Marker @SingleMember(2) [] {-1, -2};\n" +
2199
		"       Integer [][] x2;\n" +
2200
		"		x2 = new @Positive Integer @Marker @SingleMember(3) [] @SingleMember(3) [] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};\n" +
2201
		"    }\n" +
2202
		"}\n";
2203
	String expectedUnitToString =
2204
		"class X<@Marker T extends @Readonly String> {\n" +
2205
		"  X() {\n" +
2206
		"    super();\n" +
2207
		"  }\n" +
2208
		"  public static void main(String[] args) {\n" +
2209
		"    int[] x1;\n" +
2210
		"    x1 = new int @Marker @SingleMember(2) []{(- 1), (- 2)};\n" +
2211
		"    Integer[][] x2;\n" +
2212
		"    x2 = new @Positive Integer @Marker @SingleMember(3) [] @SingleMember(3) []{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};\n" +
2213
		"  }\n" +
2214
		"}\n";
2215
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0091", expectedUnitToString );
2216
}
2217
2218
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2219
public void test0092() throws IOException {
2220
	String source =
2221
		"class X {\n" +
2222
		"	static class T {\n" +
2223
		"		public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2224
		"			return new @Readonly Object @Normal(value = 10) [] {this, T.this};\n" +
2225
		"		}\n" +
2226
		"	}\n" +
2227
		"}";
2228
	String expectedUnitToString =
2229
		"class X {\n" +
2230
		"  static class T {\n" +
2231
		"    T() {\n" +
2232
		"      super();\n" +
2233
		"    }\n" +
2234
		"    public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2235
		"      return new @Readonly Object @Normal(value = 10) []{this, T.this};\n" +
2236
		"    }\n" +
2237
		"  }\n" +
2238
		"  X() {\n" +
2239
		"    super();\n" +
2240
		"  }\n" +
2241
		"}\n";
2242
	checkParse(source.toCharArray(), null, "test0092", expectedUnitToString );
2243
}
2244
2245
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2246
public void test0093() throws IOException {
2247
	String source =
2248
		"class X {\n" +
2249
		"    public static void main(String[] args) {\n" +
2250
		"        java.util.Arrays.asList(new @Readonly Object @SingleMember(1) [] {\"1\"});\n" +
2251
		"    }\n" +
2252
		"}\n";
2253
	String expectedUnitToString =
2254
		"class X {\n" +
2255
		"  X() {\n" +
2256
		"    super();\n" +
2257
		"  }\n" +
2258
		"  public static void main(String[] args) {\n" +
2259
		"    java.util.Arrays.asList(new @Readonly Object @SingleMember(1) []{\"1\"});\n" +
2260
		"  }\n" +
2261
		"}\n";
2262
	checkParse(source.toCharArray(), null, "test0093", expectedUnitToString );
2263
}
2264
2265
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2266
public void test0094() throws IOException {
2267
	String source =
2268
		"class X {\n" +
2269
		"	public boolean test() {\n" +
2270
		"		String[] s;\n" +
2271
		"		s = foo(new @Marker String @SingleMember(1) []{\"hello\"});\n" +
2272
		"		return s != null;\n" +
2273
		"	}\n" +
2274
		"	public <@Marker F> F @SingleMember(1) [] foo(F[] f) {\n" +
2275
		"		return f;\n" +
2276
		"	}\n" +
2277
		"}";
2278
	String expectedUnitToString =
2279
		"class X {\n" +
2280
		"  X() {\n" +
2281
		"    super();\n" +
2282
		"  }\n" +
2283
		"  public boolean test() {\n" +
2284
		"    String[] s;\n" +
2285
		"    s = foo(new @Marker String @SingleMember(1) []{\"hello\"});\n" +
2286
		"    return (s != null);\n" +
2287
		"  }\n" +
2288
		"  public <@Marker F>F @SingleMember(1) [] foo(F[] f) {\n" +
2289
		"    return f;\n" +
2290
		"  }\n" +
2291
		"}\n";
2292
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0094", expectedUnitToString );
2293
}
2294
2295
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2296
public void test0095() throws IOException {
2297
	String source =
2298
		"import java.util.Arrays;\n" +
2299
		"import java.util.List;\n" +
2300
		"@Marker class Deejay {\n" +
2301
		"	@Marker class Counter<@Marker T> {}\n" +
2302
		"	public void f(String[] args) {\n" +
2303
		"		Counter<@Positive Integer> songCounter;\n" +
2304
		"		songCounter = new Counter<@Positive Integer>();\n" +
2305
		"		Counter<@Readonly String> genre;\n" +
2306
		"		genre = new Counter<@Readonly String>();\n" +
2307
		"		List<@Marker Counter<?>> list1;\n" +
2308
		"		list1 = Arrays.asList(new @Marker Counter<?> @Normal(value = 2) @Marker [] {songCounter, genre});\n" +
2309
		"	}\n" +
2310
		"}\n";
2311
	String expectedUnitToString =
2312
		"import java.util.Arrays;\n" +
2313
		"import java.util.List;\n" +
2314
		"@Marker class Deejay {\n" +
2315
		"  @Marker class Counter<@Marker T> {\n" +
2316
		"    Counter() {\n" +
2317
		"      super();\n" +
2318
		"    }\n" +
2319
		"  }\n" +
2320
		"  Deejay() {\n" +
2321
		"    super();\n" +
2322
		"  }\n" +
2323
		"  public void f(String[] args) {\n" +
2324
		"    Counter<@Positive Integer> songCounter;\n" +
2325
		"    songCounter = new Counter<@Positive Integer>();\n" +
2326
		"    Counter<@Readonly String> genre;\n" +
2327
		"    genre = new Counter<@Readonly String>();\n" +
2328
		"    List<@Marker Counter<?>> list1;\n" +
2329
		"    list1 = Arrays.asList(new @Marker Counter<?> @Normal(value = 2) @Marker []{songCounter, genre});\n" +
2330
		"  }\n" +
2331
		"}\n";
2332
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0095", expectedUnitToString );
2333
}
2334
2335
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2336
public void test0096() throws IOException {
2337
	String source =
2338
		"class X <@Marker T extends @Readonly String> {\n" +
2339
		"    public static void main(String[] args) {\n" +
2340
		"		int [] x1;\n" +
2341
		"		x1 = new int @Marker @SingleMember(10) [10];\n" +
2342
		"       Integer [][] x2;\n" +
2343
		"		x2 = new @Positive Integer @Marker [10] @Normal(value = 10) [10];\n" +
2344
		"		char[][] tokens;\n" +
2345
		"		tokens = new char @SingleMember(0) [0] @Normal(value = 10) @Marker [];\n" +
2346
		"    }\n" +
2347
		"}\n";
2348
	String expectedUnitToString =
2349
		"class X<@Marker T extends @Readonly String> {\n" +
2350
		"  X() {\n" +
2351
		"    super();\n" +
2352
		"  }\n" +
2353
		"  public static void main(String[] args) {\n" +
2354
		"    int[] x1;\n" +
2355
		"    x1 = new int @Marker @SingleMember(10) [10];\n" +
2356
		"    Integer[][] x2;\n" +
2357
		"    x2 = new @Positive Integer @Marker [10] @Normal(value = 10) [10];\n" +
2358
		"    char[][] tokens;\n" +
2359
		"    tokens = new char @SingleMember(0) [0] @Normal(value = 10) @Marker [];\n" +
2360
		"  }\n" +
2361
		"}\n";
2362
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0096", expectedUnitToString );
2363
}
2364
2365
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2366
public void test0097() throws IOException {
2367
	String source =
2368
		"class X {\n" +
2369
		"	public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2370
		"		return new @Readonly Object @Normal(value = 10) [10];\n" +
2371
		"	}\n" +
2372
		"}";
2373
	String expectedUnitToString =
2374
		"class X {\n" +
2375
		"  X() {\n" +
2376
		"    super();\n" +
2377
		"  }\n" +
2378
		"  public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2379
		"    return new @Readonly Object @Normal(value = 10) [10];\n" +
2380
		"  }\n" +
2381
		"}\n";
2382
	checkParse(source.toCharArray(), null, "test0097", expectedUnitToString );
2383
}
2384
2385
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2386
public void test0098() throws IOException {
2387
	String source =
2388
		"class X {\n" +
2389
		"	public boolean test() {\n" +
2390
		"		String[] s;\n" +
2391
		"		s = foo(new @Marker String @SingleMember(1) [10]);\n" +
2392
		"		return s != null;\n" +
2393
		"	}\n" +
2394
		"	public <@Marker F> F @SingleMember(1) [] foo(F[] f) {\n" +
2395
		"		return f;\n" +
2396
		"	}\n" +
2397
		"}";
2398
	String expectedUnitToString =
2399
		"class X {\n" +
2400
		"  X() {\n" +
2401
		"    super();\n" +
2402
		"  }\n" +
2403
		"  public boolean test() {\n" +
2404
		"    String[] s;\n" +
2405
		"    s = foo(new @Marker String @SingleMember(1) [10]);\n" +
2406
		"    return (s != null);\n" +
2407
		"  }\n" +
2408
		"  public <@Marker F>F @SingleMember(1) [] foo(F[] f) {\n" +
2409
		"    return f;\n" +
2410
		"  }\n" +
2411
		"}\n";
2412
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0098", expectedUnitToString );
2413
}
2414
2415
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2416
public void test0099() throws IOException {
2417
	String source =
2418
		"import java.util.Arrays;\n" +
2419
		"import java.util.List;\n" +
2420
		"class X<@Marker T> {\n" +
2421
		"	public void test() {\n" +
2422
		"		List<@Marker X<?>> a;\n" +
2423
		"		a = Arrays.asList(new @Marker X<?> @SingleMember(0) [0]);\n" +
2424
		"		String @Marker [] @SingleMember(1) [] x;\n" +
2425
		"		x = new @Readonly String @Normal(value = 5) [5] @SingleMember(1) [1];\n" +
2426
		"	}\n" +
2427
		"}";
2428
	String expectedUnitToString =
2429
		"import java.util.Arrays;\n" +
2430
		"import java.util.List;\n" +
2431
		"class X<@Marker T> {\n" +
2432
		"  X() {\n" +
2433
		"    super();\n" +
2434
		"  }\n" +
2435
		"  public void test() {\n" +
2436
		"    List<@Marker X<?>> a;\n" +
2437
		"    a = Arrays.asList(new @Marker X<?> @SingleMember(0) [0]);\n" +
2438
		"    String @Marker [] @SingleMember(1) [] x;\n" +
2439
		"    x = new @Readonly String @Normal(value = 5) [5] @SingleMember(1) [1];\n" +
2440
		"  }\n" +
2441
		"}\n";
2442
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0099", expectedUnitToString );
2443
}
2444
2445
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2446
public void test0100() throws IOException {
2447
	String source =
2448
		"import java.util.*;\n" +
2449
		"class X {\n" +
2450
		"    public Integer[] getTypes() {\n" +
2451
		"        List<@Positive Integer> list;\n" +
2452
		"		 list = new ArrayList<@Positive Integer>();\n" +
2453
		"        return list == null \n" +
2454
		"            ? new @Positive Integer @SingleMember(0) [0] \n" +
2455
		"            : list.toArray(new @Positive Integer @Marker [list.size()]);\n" +
2456
		"    }\n" +
2457
		"}";
2458
	String expectedUnitToString =
2459
		"import java.util.*;\n" +
2460
		"class X {\n" +
2461
		"  X() {\n" +
2462
		"    super();\n" +
2463
		"  }\n" +
2464
		"  public Integer[] getTypes() {\n" +
2465
		"    List<@Positive Integer> list;\n" +
2466
		"    list = new ArrayList<@Positive Integer>();\n" +
2467
		"    return ((list == null) ? new @Positive Integer @SingleMember(0) [0] : list.toArray(new @Positive Integer @Marker [list.size()]));\n" +
2468
		"  }\n" +
2469
		"}\n";
2470
	checkParse(source.toCharArray(), null, "test0100", expectedUnitToString );
2471
}
2472
2473
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2474
public void test0101() throws IOException {
2475
	String source =
2476
		"import java.util.*;\n" +
2477
		"\n" +
2478
		"@Marker class X {\n" +
2479
		"    Vector<Object> data;\n" +
2480
		"    public void t() {\n" +
2481
		"        Vector<@Readonly Object> v;\n" +
2482
		" 		 v = (@Marker @SingleMember(0) Vector<@Readonly Object>) data.elementAt(0);\n" +
2483
		"    }\n" +
2484
		"}\n";
2485
	String expectedUnitToString =
2486
		"import java.util.*;\n" +
2487
		"@Marker class X {\n" +
2488
		"  Vector<Object> data;\n" +
2489
		"  X() {\n" +
2490
		"    super();\n" +
2491
		"  }\n" +
2492
		"  public void t() {\n" +
2493
		"    Vector<@Readonly Object> v;\n" +
2494
		"    v = (@Marker @SingleMember(0) Vector<@Readonly Object>) data.elementAt(0);\n" +
2495
		"  }\n" +
2496
		"}\n";
2497
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0101", expectedUnitToString );
2498
}
2499
2500
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2501
// To test Parser.consumeClassHeaderExtends() with Type Annotations
2502
public void test0102() throws IOException {
2503
	String source =
2504
		"class X<E> {\n" +
2505
		"    X<@Readonly String> bar() {\n" +
2506
		"    	return (@Marker AX<@Readonly String>) new X<@Readonly String>();\n" +
2507
		"    }\n" +
2508
		"    X<@Readonly String> bar(Object o) {\n" +
2509
		"    	return (@Marker AX<@Readonly String>) o;\n" +
2510
		"    }\n" +
2511
		"    X<@Negative E> foo(Object o) {\n" +
2512
		"    	return (@Marker @Normal(value = 10) AX<@Negative E>) o;\n" +
2513
		"    }    \n" +
2514
		"    X<E> baz(Object o) {\n" +
2515
		"    	return (@Marker AX<E>) null;\n" +
2516
		"    }\n" +
2517
		"    X<String> baz2(BX bx) {\n" +
2518
		"    	return (@Marker @SingleMember(10) X<String>) bx;\n" +
2519
		"    }\n" +
2520
		"}\n" +
2521
		"@Normal(value = 1) class AX<@Marker F> extends @Marker X<@SingleMember(10)F> {}\n" +
2522
		"@Normal(value = 2) class BX extends @Marker @SingleMember(1) AX<@Readonly String> {}\n";
2523
	String expectedUnitToString =
2524
		"class X<E> {\n" +
2525
		"  X() {\n" +
2526
		"    super();\n" +
2527
		"  }\n" +
2528
		"  X<@Readonly String> bar() {\n" +
2529
		"    return (@Marker AX<@Readonly String>) new X<@Readonly String>();\n" +
2530
		"  }\n" +
2531
		"  X<@Readonly String> bar(Object o) {\n" +
2532
		"    return (@Marker AX<@Readonly String>) o;\n" +
2533
		"  }\n" +
2534
		"  X<@Negative E> foo(Object o) {\n" +
2535
		"    return (@Marker @Normal(value = 10) AX<@Negative E>) o;\n" +
2536
		"  }\n" +
2537
		"  X<E> baz(Object o) {\n" +
2538
		"    return (@Marker AX<E>) null;\n" +
2539
		"  }\n" +
2540
		"  X<String> baz2(BX bx) {\n" +
2541
		"    return (@Marker @SingleMember(10) X<String>) bx;\n" +
2542
		"  }\n" +
2543
		"}\n" +
2544
		"@Normal(value = 1) class AX<@Marker F> extends @Marker X<@SingleMember(10) F> {\n" +
2545
		"  AX() {\n" +
2546
		"    super();\n" +
2547
		"  }\n" +
2548
		"}\n" +
2549
		"@Normal(value = 2) class BX extends @Marker @SingleMember(1) AX<@Readonly String> {\n" +
2550
		"  BX() {\n" +
2551
		"    super();\n" +
2552
		"  }\n" +
2553
		"}\n";
2554
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0102", expectedUnitToString );
2555
}
2556
2557
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2558
public void test0103() throws IOException {
2559
	String source =
2560
		"import java.lang.reflect.Array;\n" +
2561
		"@Marker class X<@Readonly T> {\n" +
2562
		"	T @SingleMember(0) [] theArray;\n" +
2563
		"	public X(Class<T> clazz) {\n" +
2564
		"		theArray = (@Marker @SingleMember(0) T @Normal(value = 10) []) Array.newInstance(clazz, 10); // Compiler warning\n" +
2565
		"	}\n" +
2566
		"}";
2567
	String expectedUnitToString =
2568
		"import java.lang.reflect.Array;\n" +
2569
		"@Marker class X<@Readonly T> {\n" +
2570
		"  T @SingleMember(0) [] theArray;\n" +
2571
		"  public X(Class<T> clazz) {\n" +
2572
		"    super();\n" +
2573
		"    theArray = (@Marker @SingleMember(0) T @Normal(value = 10) []) Array.newInstance(clazz, 10);\n" +
2574
		"  }\n" +
2575
		"}\n";
2576
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0103", expectedUnitToString );
2577
}
2578
2579
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2580
public void test0104() throws IOException {
2581
	String source =
2582
		"import java.util.*;\n" +
2583
		"class X {\n" +
2584
		"    void method(Object o) {\n" +
2585
		"		 if (o instanceof String[]){\n" +
2586
		"			 String[] s;\n" +
2587
		"			 s = (@Marker @Readonly String @Marker []) o;\n" +
2588
		"		 }\n" +
2589
		"        if (o instanceof @Readonly List<?>[]) {\n" +
2590
		"            List<?>[] es;\n" +
2591
		"			 es = (@Marker List<?> @SingleMember(0) []) o;\n" +
2592
		"        }\n" +
2593
		"    }\n" +
2594
		"}";
2595
	String expectedUnitToString =
2596
		"import java.util.*;\n" +
2597
		"class X {\n" +
2598
		"  X() {\n" +
2599
		"    super();\n" +
2600
		"  }\n" +
2601
		"  void method(Object o) {\n" +
2602
		"    if ((o instanceof String[]))\n" +
2603
		"        {\n" +
2604
		"          String[] s;\n" +
2605
		"          s = (@Marker @Readonly String @Marker []) o;\n" +
2606
		"        }\n" +
2607
		"    if ((o instanceof @Readonly List<?>[]))\n" +
2608
		"        {\n" +
2609
		"          List<?>[] es;\n" +
2610
		"          es = (@Marker List<?> @SingleMember(0) []) o;\n" +
2611
		"        }\n" +
2612
		"  }\n" +
2613
		"}\n";
2614
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0104", expectedUnitToString );
2615
}
2616
2617
2618
// To test Parser.consumeCastExpressionWithPrimitiveType() with Type Annotations
2619
public void test0105() throws IOException {
2620
	String source =
2621
		"import java.util.HashMap;\n" +
2622
		"class X {\n" +
2623
		"	public static void main(String[] args) {\n" +
2624
		"		HashMap<Byte, Byte> subst;\n" +
2625
		"		subst = new HashMap<Byte, Byte>();\n" +
2626
		"		subst.put((@Marker byte)1, (@Positive byte)1);\n" +
2627
		"		if (1 + subst.get((@Positive @Normal(value = 10) byte)1) > 0.f) {\n" +
2628
		"			System.out.println(\"SUCCESS\");\n" +
2629
		"		}		\n" +
2630
		"	}\n" +
2631
		"}\n";
2632
	String expectedUnitToString =
2633
		"import java.util.HashMap;\n" +
2634
		"class X {\n" +
2635
		"  X() {\n" +
2636
		"    super();\n" +
2637
		"  }\n" +
2638
		"  public static void main(String[] args) {\n" +
2639
		"    HashMap<Byte, Byte> subst;\n" +
2640
		"    subst = new HashMap<Byte, Byte>();\n" +
2641
		"    subst.put((@Marker byte) 1, (@Positive byte) 1);\n" +
2642
		"    if (((1 + subst.get((@Positive @Normal(value = 10) byte) 1)) > 0.f))\n" +
2643
		"        {\n" +
2644
		"          System.out.println(\"SUCCESS\");\n" +
2645
		"        }\n" +
2646
		"  }\n" +
2647
		"}\n";
2648
	checkParse(source.toCharArray(), null, "test0105", expectedUnitToString );
2649
}
2650
2651
// To test Parser.consumeCastExpressionWithPrimitiveType() with Type Annotations
2652
public void test0106() throws IOException {
2653
	String source =
2654
		"class X{\n" +
2655
		"	private float x, y, z;\n" +
2656
		"	float magnitude () {\n" +
2657
		"		return (@Marker @Positive float) Math.sqrt((x*x) + (y*y) + (z*z));\n" +
2658
		"	}\n" +
2659
		"}\n";
2660
	String expectedUnitToString =
2661
		"class X {\n" +
2662
		"  private float x;\n" +
2663
		"  private float y;\n" +
2664
		"  private float z;\n" +
2665
		"  X() {\n" +
2666
		"    super();\n" +
2667
		"  }\n" +
2668
		"  float magnitude() {\n" +
2669
		"    return (@Marker @Positive float) Math.sqrt((((x * x) + (y * y)) + (z * z)));\n" +
2670
		"  }\n" +
2671
		"}\n";
2672
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0106", expectedUnitToString );
2673
}
2674
2675
// To test Parser.consumeCastExpressionWithQualifiedGenericsArray() with Type Annotations
2676
// Javac version b76 crashes on type annotations on type arguments to parameterized classes
2677
// in a qualified generic reference
2678
public void test0107() throws IOException {
2679
	String source =
2680
		"class C1<T> {\n" +
2681
		"	class C11 {	}\n" +
2682
		"	@Marker class C12 {\n" +
2683
		"		T t;\n" +
2684
		"		C1<@Readonly T>.C11 m() {\n" +
2685
		"			C1<@Readonly T>.C11[] ts;\n" +
2686
		"			ts = (@Marker C1<@Readonly T>.C11[]) new @Marker C1<?>.C11 @Normal(value = 5) [5];\n" +
2687
		"			return ts;\n" +
2688
		"		}\n" +
2689
		"	}\n" +
2690
		"}\n";
2691
	String expectedUnitToString =
2692
		"class C1<T> {\n" +
2693
		"  class C11 {\n" +
2694
		"    C11() {\n" +
2695
		"      super();\n" +
2696
		"    }\n" +
2697
		"  }\n" +
2698
		"  @Marker class C12 {\n" +
2699
		"    T t;\n" +
2700
		"    C12() {\n" +
2701
		"      super();\n" +
2702
		"    }\n" +
2703
		"    C1<@Readonly T>.C11 m() {\n" +
2704
		"      C1<@Readonly T>.C11[] ts;\n" +
2705
		"      ts = ( @Marker C1<@Readonly T>.C11[]) new  @Marker C1<?>.C11 @Normal(value = 5) [5];\n" +
2706
		"      return ts;\n" +
2707
		"    }\n" +
2708
		"  }\n" +
2709
		"  C1() {\n" +
2710
		"    super();\n" +
2711
		"  }\n" +
2712
		"}\n";
2713
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0107", expectedUnitToString );
2714
}
2715
2716
// To test Parser.consumeFormalParameter() with Type Annotations
2717
public void test0108() throws IOException {
2718
	String source =
2719
		"class X {\n" +
2720
		"	int field;" +
2721
		"	public void test(@Marker X x,@Positive int i){\n" +
2722
		"		x.field = i;\n" +
2723
		"	}\n" +
2724
		"	public static void main(@Readonly String args @Normal(10) []){" +
2725
		"		System.exit(0);\n" +
2726
		"	}\n" +
2727
		"}\n";
2728
	String expectedUnitToString =
2729
		"class X {\n" +
2730
		"  int field;\n" +
2731
		"  X() {\n" +
2732
		"    super();\n" +
2733
		"  }\n" +
2734
		"  public void test(@Marker X x, @Positive int i) {\n" +
2735
		"    x.field = i;\n" +
2736
		"  }\n" +
2737
		"  public static void main(@Readonly String @Normal(10) [] args) {\n" +
2738
		"    System.exit(0);\n" +
2739
		"  }\n" +
2740
		"}\n";
2741
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0108", expectedUnitToString );
2742
}
2743
2744
// To test Parser.consumeFormalParameter() with Type Annotations
2745
public void test0109() throws IOException {
2746
	String source =
2747
		"class X<@Marker T> {\n" +
2748
		"	T field;" +
2749
		"	public void test(@Marker @SingleMember(1) X<? extends @Marker Object> x,@Positive T i){\n" +
2750
		"	}\n" +
2751
		"}\n";
2752
	String expectedUnitToString =
2753
		"class X<@Marker T> {\n" +
2754
		"  T field;\n" +
2755
		"  X() {\n" +
2756
		"    super();\n" +
2757
		"  }\n" +
2758
		"  public void test(@Marker @SingleMember(1) X<? extends @Marker Object> x, @Positive T i) {\n" +
2759
		"  }\n" +
2760
		"}\n";
2761
	checkParse(source.toCharArray(), null, "test0109", expectedUnitToString );
2762
}
2763
2764
// To test Parser.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments()
2765
// with Type Annotations
2766
// Javac b76 crashes with type annotations in qualified class instance creation expression
2767
public void test0110() throws IOException {
2768
	String source =
2769
		"class X {\n" +
2770
		"	class MX {\n" +
2771
		"		@Marker <T> MX(T t){\n" +
2772
		"			System.out.println(t);\n" +
2773
		"		}\n" +
2774
		"	}\n" +
2775
		"	public static void main(String[] args) {\n" +
2776
		"		new @Marker @SingleMember(10) X().new <@Readonly String> @Marker MX(\"SUCCESS\");\n" +
2777
		"	}\n" +
2778
		"}\n";
2779
	String expectedUnitToString =
2780
		"class X {\n" +
2781
		"  class MX {\n" +
2782
		"    @Marker <T>MX(T t) {\n" +
2783
		"      super();\n" +
2784
		"      System.out.println(t);\n" +
2785
		"    }\n" +
2786
		"  }\n" +
2787
		"  X() {\n" +
2788
		"    super();\n" +
2789
		"  }\n" +
2790
		"  public static void main(String[] args) {\n" +
2791
		"    new @Marker @SingleMember(10) X().new <@Readonly String>@Marker MX(\"SUCCESS\");\n" +
2792
		"  }\n" +
2793
		"}\n";
2794
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0110", expectedUnitToString );
2795
}
2796
2797
// To test Parser.consumeClassInstanceCreationExpressionWithTypeArguments()
2798
// with Type Annotations
2799
public void test0111() throws IOException {
2800
	String source =
2801
		"class X {\n" +
2802
		"	public <T> X(T t){\n" +
2803
		"		System.out.println(t);\n" +
2804
		"	}\n" +
2805
		"	public static void main(String[] args) {\n" +
2806
		"		new <@Readonly String> @Marker @SingleMember(0) X(\"SUCCESS\");\n" +
2807
		"	}\n" +
2808
		"}\n";
2809
	String expectedUnitToString =
2810
		"class X {\n" +
2811
		"  public <T>X(T t) {\n" +
2812
		"    super();\n" +
2813
		"    System.out.println(t);\n" +
2814
		"  }\n" +
2815
		"  public static void main(String[] args) {\n" +
2816
		"    new <@Readonly String>@Marker @SingleMember(0) X(\"SUCCESS\");\n" +
2817
		"  }\n" +
2818
		"}\n";
2819
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0111", expectedUnitToString );
2820
}
2821
2822
// To test Parser.consumeEnhancedForStatementHeaderInit() with Type Annotations
2823
public void test0112() throws IOException {
2824
	String source =
2825
		"import java.util.*;\n" +
2826
		"class X {\n" +
2827
		"   List list() { return null; }\n" +
2828
		"   void m2() { for (@SingleMember(10) Iterator<@Marker X> i = list().iterator(); i.hasNext();); }\n" +
2829
		"	void m3() {\n" +
2830
		"		Integer [] array;\n" +
2831
		"		array = new Integer [] {1, 2, 3};\n" +
2832
		"		List<List<X>> xList;\n" +
2833
		"		xList = null;\n" +
2834
		"		for(@Positive @SingleMember(10) Integer i: array) {}\n" +
2835
		"		for(@Marker @Normal(value = 5) List<@Readonly X> x: xList) {}\n" +
2836
		"	}" +
2837
		"}\n";
2838
	String expectedUnitToString =
2839
		"import java.util.*;\n" +
2840
		"class X {\n" +
2841
		"  X() {\n" +
2842
		"    super();\n" +
2843
		"  }\n" +
2844
		"  List list() {\n" +
2845
		"    return null;\n" +
2846
		"  }\n" +
2847
		"  void m2() {\n" +
2848
		"    for (@SingleMember(10) Iterator<@Marker X> i = list().iterator();; i.hasNext(); ) \n" +
2849
		"      ;\n" +
2850
		"  }\n" +
2851
		"  void m3() {\n" +
2852
		"    Integer[] array;\n" +
2853
		"    array = new Integer[]{1, 2, 3};\n" +
2854
		"    List<List<X>> xList;\n" +
2855
		"    xList = null;\n" +
2856
		"    for (@Positive @SingleMember(10) Integer i : array) \n" +
2857
		"      {\n" +
2858
		"      }\n" +
2859
		"    for (@Marker @Normal(value = 5) List<@Readonly X> x : xList) \n" +
2860
		"      {\n" +
2861
		"      }\n" +
2862
		"  }\n" +
2863
		"}\n";
2864
	checkParse(CHECK_ALL & ~CHECK_COMPLETION_PARSER & ~CHECK_SELECTION_PARSER & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0112", expectedUnitToString );
2865
	expectedUnitToString =
2866
		"import java.util.*;\n" +
2867
		"class X {\n" +
2868
		"  X() {\n" +
2869
		"    super();\n" +
2870
		"  }\n" +
2871
		"  List list() {\n" +
2872
		"    return null;\n" +
2873
		"  }\n" +
2874
		"  void m2() {\n" +
2875
		"    for (@SingleMember(10) Iterator<@Marker X> i;; i.hasNext(); ) \n" +
2876
		"      ;\n" +
2877
		"  }\n" +
2878
		"  void m3() {\n" +
2879
		"    Integer[] array;\n" +
2880
		"    array = new Integer[]{1, 2, 3};\n" +
2881
		"    List<List<X>> xList;\n" +
2882
		"    xList = null;\n" +
2883
		"    for (@Positive @SingleMember(10) Integer i : array) \n" +
2884
		"      {\n" +
2885
		"      }\n" +
2886
		"    for (@Marker @Normal(value = 5) List<@Readonly X> x : xList) \n" +
2887
		"      {\n" +
2888
		"      }\n" +
2889
		"  }\n" +
2890
		"}\n";
2891
	checkParse(CHECK_COMPLETION_PARSER & CHECK_SELECTION_PARSER, source.toCharArray(), null, "test0112", expectedUnitToString );
2892
}
2893
2894
// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations
2895
public void test0113() throws IOException {
2896
	String source =
2897
		"@Marker class X {\n" +
2898
		"  void f() @Normal(value = 5) {\n" +
2899
		"    new @Marker @SingleMember(10) Object() {\n" +
2900
		"      void foo(){\n" +
2901
		"        System.out.println(\"test\");\n" +
2902
		"      }\n" +
2903
		"    }.foo();\n" +
2904
		"  }\n" +
2905
		"}";
2906
	String expectedUnitToString =
2907
		"@Marker class X {\n" +
2908
		"  X() {\n" +
2909
		"    super();\n" +
2910
		"  }\n" +
2911
		"  void f() @Normal(value = 5) {\n" +
2912
		"    new @Marker @SingleMember(10) Object() {\n" +
2913
		"  void foo() {\n" +
2914
		"    System.out.println(\"test\");\n" +
2915
		"  }\n" +
2916
		"}.foo();\n" +
2917
		"  }\n" +
2918
		"}\n";
2919
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0113", expectedUnitToString );
2920
}
2921
2922
// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations
2923
public void test0114() throws IOException {
2924
	String source =
2925
		"class Toplevel2{\n" +
2926
		"    public boolean foo(){\n" +
2927
		"    Toplevel2 o;\n" +
2928
		"	 o = new @Marker @Normal(value = 5) Toplevel2() { \n" +
2929
		"              public boolean foo() {  return false; }  // no copy in fact\n" +
2930
		"              };\n" +
2931
		"    return o.foo();\n" +
2932
		"  }\n" +
2933
		"}";
2934
	String expectedUnitToString =
2935
		"class Toplevel2 {\n" +
2936
		"  Toplevel2() {\n" +
2937
		"    super();\n" +
2938
		"  }\n" +
2939
		"  public boolean foo() {\n" +
2940
		"    Toplevel2 o;\n" +
2941
		"    o = new @Marker @Normal(value = 5) Toplevel2() {\n" +
2942
		"  public boolean foo() {\n" +
2943
		"    return false;\n" +
2944
		"  }\n" +
2945
		"};\n" +
2946
		"    return o.foo();\n" +
2947
		"  }\n" +
2948
		"}\n";
2949
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0114", expectedUnitToString );
2950
}
2951
2952
// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations
2953
public void test0115() throws IOException {
2954
	String source =
2955
		"class X <T> {\n" +
2956
		"    T foo(T t) {\n" +
2957
		"        System.out.println(t);\n" +
2958
		"        return t;\n" +
2959
		"    }\n" +
2960
		"    public static void main(String @Normal(value =  5) [] args) {\n" +
2961
		"        new @Marker X<@SingleMember(10) @Normal(value = 5) XY>() {\n" +
2962
		"            void run() {\n" +
2963
		"                foo(new @Marker XY());\n" +
2964
		"            }\n" +
2965
		"        }.run();\n" +
2966
		"    }\n" +
2967
		"}\n" +
2968
		"@Marker class XY {\n" +
2969
		"    public String toString() {\n" +
2970
		"        return \"SUCCESS\";\n" +
2971
		"    }\n" +
2972
		"}\n";
2973
	String expectedUnitToString =
2974
		"class X<T> {\n" +
2975
		"  X() {\n" +
2976
		"    super();\n" +
2977
		"  }\n" +
2978
		"  T foo(T t) {\n" +
2979
		"    System.out.println(t);\n" +
2980
		"    return t;\n" +
2981
		"  }\n" +
2982
		"  public static void main(String @Normal(value = 5) [] args) {\n" +
2983
		"    new @Marker X<@SingleMember(10) @Normal(value = 5) XY>() {\n" +
2984
		"  void run() {\n" +
2985
		"    foo(new @Marker XY());\n" +
2986
		"  }\n" +
2987
		"}.run();\n" +
2988
		"  }\n" +
2989
		"}\n" +
2990
		"@Marker class XY {\n" +
2991
		"  XY() {\n" +
2992
		"    super();\n" +
2993
		"  }\n" +
2994
		"  public String toString() {\n" +
2995
		"    return \"SUCCESS\";\n" +
2996
		"  }\n" +
2997
		"}\n";
2998
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0115", expectedUnitToString );
2999
}
3000
3001
// To test Parser.consumeInsideCastExpressionLL1() with Type Annotations
3002
public void test0116() throws IOException {
3003
	String source =
3004
		"class X{\n" +
3005
		"  public void test1(){\n" +
3006
		"    throw (@Marker Error) null; \n" +
3007
		"  }  \n" +
3008
		"  public void test2(){\n" +
3009
		"    String s;\n" +
3010
		"	 s = (@Marker @SingleMember(10) String) null;\n" +
3011
		"	 byte b;\n" +
3012
		"	 b = 0;\n" +
3013
		"	 Byte i;\n" +
3014
		"	 i = (@Positive Byte) b;\n" +
3015
		"  }  \n" +
3016
		"  public void test3(java.io.Serializable name) {\n" +
3017
		"     Object temp;\n" +
3018
		"	  temp = (Object)name;\n" +
3019
		"     System.out.println( (String)temp );\n" +
3020
		"  }\n" +
3021
		"}";
3022
	String expectedUnitToString =
3023
		"class X {\n" +
3024
		"  X() {\n" +
3025
		"    super();\n" +
3026
		"  }\n" +
3027
		"  public void test1() {\n" +
3028
		"    throw (@Marker Error) null;\n" +
3029
		"  }\n" +
3030
		"  public void test2() {\n" +
3031
		"    String s;\n" +
3032
		"    s = (@Marker @SingleMember(10) String) null;\n" +
3033
		"    byte b;\n" +
3034
		"    b = 0;\n" +
3035
		"    Byte i;\n" +
3036
		"    i = (@Positive Byte) b;\n" +
3037
		"  }\n" +
3038
		"  public void test3(java.io.Serializable name) {\n" +
3039
		"    Object temp;\n" +
3040
		"    temp = (Object) name;\n" +
3041
		"    System.out.println((String) temp);\n" +
3042
		"  }\n" +
3043
		"}\n";
3044
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0116", expectedUnitToString );
3045
}
3046
3047
// To test Parser.consumeInstanceOfExpression() with Type Annotations
3048
public void test0117() throws IOException {
3049
	String source =
3050
		"import java.util.*;\n" +
3051
		"class X <@NonNull T>{\n" +
3052
		" 	public void test1(Object obj) @Marker {\n" +
3053
		"   	if(obj instanceof @Marker @NonNull X) {\n" +
3054
		"		 	X newX;\n" +
3055
		"		 	newX = (@NonNull X) obj;\n" +
3056
		"	 }\n" +
3057
		"   }\n" +
3058
		"	@NonNull T foo(@NonNull T t) @Marker {\n" +
3059
		"       if (t instanceof @NonNull @Marker List<?> @Normal(value = 10) []) {\n" +
3060
		"           List<?> @SingleMember (10) [] es;\n" +
3061
		"			es = (@Marker List<?> @SingleMember(10) []) t;\n" +
3062
		"       }\n" +
3063
		"		if (t instanceof @Marker @Normal(value = 5) X<?>) {\n" +
3064
		"			return t;\n" +
3065
		"		}\n" +
3066
		"		return t;\n" +
3067
		"	}\n" +
3068
		"}";
3069
	String expectedUnitToString =
3070
		"import java.util.*;\n" +
3071
		"class X<@NonNull T> {\n" +
3072
		"  X() {\n" +
3073
		"    super();\n" +
3074
		"  }\n" +
3075
		"  public void test1(Object obj) @Marker {\n" +
3076
		"    if ((obj instanceof @Marker @NonNull X))\n" +
3077
		"        {\n" +
3078
		"          X newX;\n" +
3079
		"          newX = (@NonNull X) obj;\n" +
3080
		"        }\n" +
3081
		"  }\n" +
3082
		"  @NonNull T foo(@NonNull T t) @Marker {\n" +
3083
		"    if ((t instanceof @NonNull @Marker List<?> @Normal(value = 10) []))\n" +
3084
		"        {\n" +
3085
		"          List<?> @SingleMember(10) [] es;\n" +
3086
		"          es = (@Marker List<?> @SingleMember(10) []) t;\n" +
3087
		"        }\n" +
3088
		"    if ((t instanceof @Marker @Normal(value = 5) X<?>))\n" +
3089
		"        {\n" +
3090
		"          return t;\n" +
3091
		"        }\n" +
3092
		"    return t;\n" +
3093
		"  }\n" +
3094
		"}\n";
3095
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER , source.toCharArray(), null, "test0117", expectedUnitToString );
3096
}
3097
3098
// To test Parser.consumeInstanceOfExpressionWithName() with Type Annotations
3099
public void test0118() throws IOException {
3100
	String source =
3101
		"class Outer<E> {\n" +
3102
		"  Inner inner;\n" +
3103
		"  class Inner {\n" +
3104
		"    E e;\n" +
3105
		"    @NonNull E getOtherElement(Object other) @Marker {\n" +
3106
		"      if (!(other instanceof @Marker @SingleMember(10) Outer<?>.Inner))\n" +
3107
		"       throw new @Marker IllegalArgumentException(String.valueOf(other));\n" +
3108
		"      Inner that;\n" +
3109
		"	   that = (@Marker Inner) other;\n" +
3110
		"      return that.e;\n" +
3111
		"    }\n" +
3112
		"  }\n" +
3113
		"}";
3114
	String expectedUnitToString =
3115
		"class Outer<E> {\n" +
3116
		"  class Inner {\n" +
3117
		"    E e;\n" +
3118
		"    Inner() {\n" +
3119
		"      super();\n" +
3120
		"    }\n" +
3121
		"    @NonNull E getOtherElement(Object other) @Marker {\n" +
3122
		"      if ((! (other instanceof  @Marker @SingleMember(10) Outer<?>.Inner)))\n" +
3123
		"          throw new @Marker IllegalArgumentException(String.valueOf(other));\n" +
3124
		"      Inner that;\n" +
3125
		"      that = (@Marker Inner) other;\n" +
3126
		"      return that.e;\n" +
3127
		"    }\n" +
3128
		"  }\n" +
3129
		"  Inner inner;\n" +
3130
		"  Outer() {\n" +
3131
		"    super();\n" +
3132
		"  }\n" +
3133
		"}\n";
3134
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER , source.toCharArray(), null, "test0118", expectedUnitToString );
3135
}
3136
3137
// To test Parser.consumeTypeArgument() with Type Annotations
3138
public void test0119() throws IOException {
3139
	String source =
3140
		"class X<@SingleMember(1) Xp1 extends @Readonly String, @NonNull Xp2 extends @NonNull Comparable>  extends @Marker XS<@SingleMember(10) Xp2> {\n" +
3141
		"\n" +
3142
		"    public static void main(String @Marker [] args) {\n" +
3143
		"        Integer w;\n" +
3144
		"        w = new @Marker X<@Readonly @SingleMember(10) String,@Positive Integer>().get(new @Positive Integer(12));\n" +
3145
		"        System.out.println(\"SUCCESS\");\n" +
3146
		"	 }\n" +
3147
		"    Xp2 get(Xp2 t) @Marker {\n" +
3148
		"        System.out.print(\"{X::get}\");\n" +
3149
		"        return super.get(t);\n" +
3150
		"    }\n" +
3151
		"}\n" +
3152
		"@Marker class XS <@NonNull XSp1> {\n" +
3153
		"    XSp1 get(XSp1 t) @Marker {\n" +
3154
		"		 @NonNull @SingleMember(10) Y.M mObject;\n" +
3155
		"		 mObject = new @SingleMember(10) @NonNull Y.M();\n" +
3156
		"        System.out.print(\"{XS::get}\");\n" +
3157
		"        return t;\n" +
3158
		"    }\n" +
3159
		"}\n" +
3160
		"class X2<T,E>{}\n" +
3161
		"@Marker class Y extends @Marker X2<@NonNull Y.M, @NonNull @SingleMember(1) Y.N> {\n" +
3162
		"	static class M{}\n" +
3163
		"	static class N extends M{}\n" +
3164
		"}\n";
3165
	String expectedUnitToString =
3166
		"class X<@SingleMember(1) Xp1 extends @Readonly String, @NonNull Xp2 extends @NonNull Comparable> extends @Marker XS<@SingleMember(10) Xp2> {\n" +
3167
		"  X() {\n" +
3168
		"    super();\n" +
3169
		"  }\n" +
3170
		"  public static void main(String @Marker [] args) {\n" +
3171
		"    Integer w;\n" +
3172
		"    w = new @Marker X<@Readonly @SingleMember(10) String, @Positive Integer>().get(new @Positive Integer(12));\n" +
3173
		"    System.out.println(\"SUCCESS\");\n" +
3174
		"  }\n" +
3175
		"  Xp2 get(Xp2 t) @Marker {\n" +
3176
		"    System.out.print(\"{X::get}\");\n" +
3177
		"    return super.get(t);\n" +
3178
		"  }\n" +
3179
		"}\n" +
3180
		"@Marker class XS<@NonNull XSp1> {\n" +
3181
		"  XS() {\n" +
3182
		"    super();\n" +
3183
		"  }\n" +
3184
		"  XSp1 get(XSp1 t) @Marker {\n" +
3185
		"    @NonNull @SingleMember(10) Y.M mObject;\n" +
3186
		"    mObject = new @SingleMember(10) @NonNull Y.M();\n" +
3187
		"    System.out.print(\"{XS::get}\");\n" +
3188
		"    return t;\n" +
3189
		"  }\n" +
3190
		"}\n" +
3191
		"class X2<T, E> {\n" +
3192
		"  X2() {\n" +
3193
		"    super();\n" +
3194
		"  }\n" +
3195
		"}\n" +
3196
		"@Marker class Y extends @Marker X2<@NonNull Y.M, @NonNull @SingleMember(1) Y.N> {\n" +
3197
		"  static class M {\n" +
3198
		"    M() {\n" +
3199
		"      super();\n" +
3200
		"    }\n" +
3201
		"  }\n" +
3202
		"  static class N extends M {\n" +
3203
		"    N() {\n" +
3204
		"      super();\n" +
3205
		"    }\n" +
3206
		"  }\n" +
3207
		"  Y() {\n" +
3208
		"    super();\n" +
3209
		"  }\n" +
3210
		"}\n";
3211
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0119", expectedUnitToString );
3212
}
3213
3214
// To test Parser.consumeTypeArgument() with Type Annotations
3215
public void test0120() throws IOException {
3216
	String source =
3217
		"class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" +
3218
		"}\n" +
3219
		"class Y {\n" +
3220
		"	@Marker X<int @Marker [], short @SingleMember(1) [] @Marker [], long[] @NonNull [][], float[] @Marker [] @Normal(value = 5) [][], double[][]@Marker [] @SingleMember(10) [][], boolean[][][][][][], char[] @Marker [][][][][][], Object[][]@Marker [] @SingleMember(10) [] @Normal(value = 5) [][][][][]> x;\n" +
3221
		"}\n";
3222
	String expectedUnitToString =
3223
		"class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" +
3224
		"  X() {\n" +
3225
		"    super();\n" +
3226
		"  }\n" +
3227
		"}\n" +
3228
		"class Y {\n" +
3229
		"  @Marker X<int @Marker [], short @SingleMember(1) [] @Marker [], long[] @NonNull [][], float[] @Marker [] @Normal(value = 5) [][], double[][] @Marker [] @SingleMember(10) [][], boolean[][][][][][], char[] @Marker [][][][][][], Object[][] @Marker [] @SingleMember(10) [] @Normal(value = 5) [][][][][]> x;\n" +
3230
		"  Y() {\n" +
3231
		"    super();\n" +
3232
		"  }\n" +
3233
		"}\n";
3234
	checkParse(source.toCharArray(), null, "test0120", expectedUnitToString );
3235
}
3236
3237
// To test Parser.consumeTypeArgumentReferenceType1() with Type Annotations
3238
public void test0121() throws IOException {
3239
	String source =
3240
		"@Marker class X <@NonNull T> {\n" +
3241
		"    protected T t;\n" +
3242
		"    @Marker X(@NonNull T t) {\n" +
3243
		"        this.t = t;\n" +
3244
		"    }\n" +
3245
		"    public static void main(String[] args) {\n" +
3246
		"	  X<@Marker X<@Readonly @NonNull String>> xs;\n" +
3247
		"	  xs = new @Marker X<@Marker X<@Readonly @NonNull String>>(new @Marker X<@Readonly @NonNull @SingleMember(10) String>(\"SUCCESS\"));\n" +
3248
		"	  System.out.println(xs.t.t);\n" +
3249
		"    }\n" +
3250
		"}\n";
3251
	String expectedUnitToString =
3252
		"@Marker class X<@NonNull T> {\n" +
3253
		"  protected T t;\n" +
3254
		"  @Marker X(@NonNull T t) {\n" +
3255
		"    super();\n" +
3256
		"    this.t = t;\n" +
3257
		"  }\n" +
3258
		"  public static void main(String[] args) {\n" +
3259
		"    X<@Marker X<@Readonly @NonNull String>> xs;\n" +
3260
		"    xs = new @Marker X<@Marker X<@Readonly @NonNull String>>(new @Marker X<@Readonly @NonNull @SingleMember(10) String>(\"SUCCESS\"));\n" +
3261
		"    System.out.println(xs.t.t);\n" +
3262
		"  }\n" +
3263
		"}\n";
3264
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0121", expectedUnitToString );
3265
}
3266
3267
// To test Parser.consumeTypeParameter1WithExtendsAndBounds() and Parser.consumeWildcardBoundsSuper() with
3268
// Type Annotations
3269
public void test0122() throws IOException {
3270
	String source =
3271
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable<@Marker Foo1> {\n" +
3272
		"	public int compareTo(Foo1 arg0) {\n" +
3273
		"		return 0;\n" +
3274
		"	}\n" +
3275
		"}\n" +
3276
		"class Foo1 {}\n" +
3277
		"@Marker class X<@NonNull T extends @NonNull @Normal (value = 5) Object & @Marker Comparable<? super @NonNull T>> {\n" +
3278
		"    public static void main(String[] args) {\n" +
3279
		"        new @Marker @SingleMember(10) X<@Marker Foo>();\n" +
3280
		"    }\n" +
3281
		"}\n";
3282
	String expectedUnitToString =
3283
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable<@Marker Foo1> {\n" +
3284
		"  Foo() {\n" +
3285
		"    super();\n" +
3286
		"  }\n" +
3287
		"  public int compareTo(Foo1 arg0) {\n" +
3288
		"    return 0;\n" +
3289
		"  }\n" +
3290
		"}\n" +
3291
		"class Foo1 {\n" +
3292
		"  Foo1() {\n" +
3293
		"    super();\n" +
3294
		"  }\n" +
3295
		"}\n" +
3296
		"@Marker class X<@NonNull T extends @NonNull @Normal(value = 5) Object & @Marker Comparable<? super @NonNull T>> {\n" +
3297
		"  X() {\n" +
3298
		"    super();\n" +
3299
		"  }\n" +
3300
		"  public static void main(String[] args) {\n" +
3301
		"    new @Marker @SingleMember(10) X<@Marker Foo>();\n" +
3302
		"  }\n" +
3303
		"}\n";
3304
	checkParse(source.toCharArray(), null, "test0122", expectedUnitToString );
3305
}
3306
3307
// To test Parser.consumeTypeParameter1WithExtendsAndBounds() with Type Annotations
3308
public void test0123() throws IOException {
3309
	String source =
3310
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable {\n" +
3311
		"	public int compareTo(Object arg0) {\n" +
3312
		"		return 0;\n" +
3313
		"	}\n" +
3314
		"}\n" +
3315
		"class Foo1 {}\n" +
3316
		"@Marker class X<@NonNull T extends @NonNull @Normal (value = 5) Object & @Marker Comparable, @NonNull V extends @Readonly Object> {\n" +
3317
		"    public static void main(String[] args) {\n" +
3318
		"        new @Marker @SingleMember(10) X<@Marker Foo, @SingleMember(0) Foo1>();\n" +
3319
		"		 Class <@NonNull Foo> c;\n" +
3320
		"		 c = @Readonly @NonNull Foo.class;\n" +
3321
		"    }\n" +
3322
		"}\n";
3323
	String expectedUnitToString =
3324
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable {\n" +
3325
		"  Foo() {\n" +
3326
		"    super();\n" +
3327
		"  }\n" +
3328
		"  public int compareTo(Object arg0) {\n" +
3329
		"    return 0;\n" +
3330
		"  }\n" +
3331
		"}\n" +
3332
		"class Foo1 {\n" +
3333
		"  Foo1() {\n" +
3334
		"    super();\n" +
3335
		"  }\n" +
3336
		"}\n" +
3337
		"@Marker class X<@NonNull T extends @NonNull @Normal(value = 5) Object & @Marker Comparable, @NonNull V extends @Readonly Object> {\n" +
3338
		"  X() {\n" +
3339
		"    super();\n" +
3340
		"  }\n" +
3341
		"  public static void main(String[] args) {\n" +
3342
		"    new @Marker @SingleMember(10) X<@Marker Foo, @SingleMember(0) Foo1>();\n" +
3343
		"    Class<@NonNull Foo> c;\n" +
3344
		"    c = @Readonly @NonNull Foo.class;\n" +
3345
		"  }\n" +
3346
		"}\n";
3347
	checkParse(source.toCharArray(), null, "test0123", expectedUnitToString );
3348
}
3349
3350
// To test type annotations on static class member access in a declaration
3351
public void test0124() throws IOException {
3352
	String source =
3353
		"@Marker class Foo {\n" +
3354
		"	static @Marker @SingleMember(0) class Foo1 {}\n" +
3355
		"   public static void main(String[] args) {\n" +
3356
		"       @Marker @Normal(value = 5) Foo.Foo1 foo1Object;\n" +
3357
		"		foo1Object = new @Marker @Normal(value = 5) Foo.Foo1();\n" +
3358
		"		Class <@NonNull Foo.Foo1> c;\n" +
3359
		"		c = @Readonly @NonNull Foo.Foo1.class;\n" +
3360
		"    }\n" +
3361
		"}\n";
3362
	String expectedUnitToString =
3363
		"@Marker class Foo {\n" +
3364
		"  static @Marker @SingleMember(0) class Foo1 {\n" +
3365
		"    Foo1() {\n" +
3366
		"      super();\n" +
3367
		"    }\n" +
3368
		"  }\n" +
3369
		"  Foo() {\n" +
3370
		"    super();\n" +
3371
		"  }\n" +
3372
		"  public static void main(String[] args) {\n" +
3373
		"    @Marker @Normal(value = 5) Foo.Foo1 foo1Object;\n" +
3374
		"    foo1Object = new @Marker @Normal(value = 5) Foo.Foo1();\n" +
3375
		"    Class<@NonNull Foo.Foo1> c;\n" +
3376
		"    c = @Readonly @NonNull Foo.Foo1.class;\n" +
3377
		"  }\n" +
3378
		"}\n";
3379
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0124", expectedUnitToString );
3380
}
3381
//To test type annotations on static class member access in a declaration
3382
public void test0125() throws IOException {
3383
	String source =
3384
		"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> {}";
3385
	String expectedUnitToString =
3386
		"public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> {\n" + 
3387
		"  public X() {\n" + 
3388
		"    super();\n" + 
3389
		"  }\n" + 
3390
		"}\n";
3391
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0125", expectedUnitToString );
3392
}
3393
//To test type annotations on static class member access in a declaration
3394
public void test0126() throws IOException {
3395
	String source =
3396
		"public class X {\n" +
3397
		"	@A(\"Hello, World!\") @B @C('(') String@E[] @D[] f;\n" +
3398
		"}";
3399
	String expectedUnitToString =
3400
		"public class X {\n" + 
3401
		"  @A(\"Hello, World!\") @B @C(\'(\') String @E [] @D [] f;\n" + 
3402
		"  public X() {\n" + 
3403
		"    super();\n" + 
3404
		"  }\n" + 
3405
		"}\n";
3406
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0126", expectedUnitToString );
3407
}
3408
//To test type annotations on static class member access in a declaration
3409
public void test0127() throws IOException {
3410
	String source =
3411
		"public class X {\n" +
3412
		"	@A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> f;\n" +
3413
		"}";
3414
	String expectedUnitToString =
3415
		"public class X {\n" + 
3416
		"  @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> f;\n" + 
3417
		"  public X() {\n" + 
3418
		"    super();\n" + 
3419
		"  }\n" + 
3420
		"}\n";
3421
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0127", expectedUnitToString );
3422
}
3423
//type class literal expression
3424
public void test0128() throws IOException {
3425
	String source = 
3426
	"public class X {\n" + 
3427
	"	public boolean foo(String s) {\n" + 
3428
	"		return (s instanceof @C('_') Object[]);\n" + 
3429
	"	}\n" + 
3430
	"	public Object foo1(String s) {\n" + 
3431
	"		return new @B(3) @A(\"new Object\") Object[] {};\n" + 
3432
	"	}\n" + 
3433
	"	public Class foo2(String s) {\n" + 
3434
	"		return @B(4) Object[].class;\n" + 
3435
	"	}\n" + 
3436
	"	public Class foo3(String s) {\n" + 
3437
	"		return @A(\"int class literal\")  @B(5) int[].class;\n" + 
3438
	"	}\n" + 
3439
	"}";
3440
	String expectedUnitToString = 
3441
		"public class X {\n" + 
3442
		"  public X() {\n" + 
3443
		"    super();\n" + 
3444
		"  }\n" + 
3445
		"  public boolean foo(String s) {\n" + 
3446
		"    return (s instanceof @C(\'_\') Object[]);\n" + 
3447
		"  }\n" + 
3448
		"  public Object foo1(String s) {\n" + 
3449
		"    return new @B(3) @A(\"new Object\") Object[]{};\n" + 
3450
		"  }\n" + 
3451
		"  public Class foo2(String s) {\n" + 
3452
		"    return @B(4) Object[].class;\n" + 
3453
		"  }\n" + 
3454
		"  public Class foo3(String s) {\n" + 
3455
		"    return @A(\"int class literal\") @B(5) int[].class;\n" + 
3456
		"  }\n" + 
3457
		"}\n";
3458
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0128", expectedUnitToString );
3459
}
3460
//instanceof checks 
3461
public void test0129() throws IOException {
3462
	String source = "public class Clazz {\n" +
3463
					"public static void main(Object o) {\n" +
3464
					"if (o instanceof @Readonly String) {\n" +
3465
					"}\n" +
3466
					"}\n" +
3467
					"}";
3468
	String expectedUnitToString = 
3469
		"public class Clazz {\n" + 
3470
		"  public Clazz() {\n" + 
3471
		"    super();\n" + 
3472
		"  }\n" + 
3473
		"  public static void main(Object o) {\n" + 
3474
		"    if ((o instanceof @Readonly String))\n" + 
3475
		"        {\n" + 
3476
		"        }\n" + 
3477
		"  }\n" + 
3478
		"}\n";
3479
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0129", expectedUnitToString);
3480
}
3481
//instanceof checks 
3482
public void test0130() throws IOException {
3483
	String source = "public class Clazz {\n" +
3484
					"public static void foo() {\n" +
3485
					"	if (o instanceof @Readonly String[]) {}" +
3486
					"}\n" +
3487
					"}";
3488
	String expectedUnitToString = 
3489
		"public class Clazz {\n" + 
3490
		"  public Clazz() {\n" + 
3491
		"    super();\n" + 
3492
		"  }\n" + 
3493
		"  public static void foo() {\n" + 
3494
		"    if ((o instanceof @Readonly String[]))\n" + 
3495
		"        {\n" + 
3496
		"        }\n" + 
3497
		"  }\n" + 
3498
		"}\n";
3499
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3500
}
3501
//cast
3502
public void test0131() throws IOException {
3503
	String source =
3504
		"public class X {\n" + 
3505
		"	public void foo(Object o) {\n" + 
3506
		"		if (o instanceof String[][]) {\n" +
3507
		"			String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" +
3508
		"			System.out.println(tab.length);\n" +
3509
		"		}\n" + 
3510
		"		System.out.println(o);\n" +
3511
		"	}\n" + 
3512
		"}";
3513
	String expectedUnitToString = 
3514
		"public class X {\n" + 
3515
		"  public X() {\n" + 
3516
		"    super();\n" + 
3517
		"  }\n" + 
3518
		"  public void foo(Object o) {\n" + 
3519
		"    if ((o instanceof String[][]))\n" + 
3520
		"        {\n" + 
3521
		"          String[][] tab = (@C(\'_\') @B(3) String[] @A []) o;\n" + 
3522
		"          System.out.println(tab.length);\n" + 
3523
		"        }\n" + 
3524
		"    System.out.println(o);\n" + 
3525
		"  }\n" + 
3526
		"}\n";
3527
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3528
}
3529
//cast
3530
public void test0132() throws IOException {
3531
	String source =
3532
		"public class X {\n" + 
3533
		"	public void foo(Object o) {\n" + 
3534
		"		if (o instanceof String[][]) {\n" +
3535
		"			String[][] tab = (@C('_') @B(3) String@D[] @A[]) o;\n" +
3536
		"			System.out.println(tab.length);\n" +
3537
		"		}\n" + 
3538
		"		System.out.println(o);\n" +
3539
		"	}\n" + 
3540
		"}";
3541
	String expectedUnitToString = 
3542
		"public class X {\n" + 
3543
		"  public X() {\n" + 
3544
		"    super();\n" + 
3545
		"  }\n" + 
3546
		"  public void foo(Object o) {\n" + 
3547
		"    if ((o instanceof String[][]))\n" + 
3548
		"        {\n" + 
3549
		"          String[][] tab = (@C(\'_\') @B(3) String @D [] @A []) o;\n" + 
3550
		"          System.out.println(tab.length);\n" + 
3551
		"        }\n" + 
3552
		"    System.out.println(o);\n" + 
3553
		"  }\n" + 
3554
		"}\n";
3555
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3556
}
3557
//generic type arguments in a generic method invocation
3558
public void test0133() throws IOException {
3559
	String source =
3560
		"public class X {\n" +
3561
		"	static <T, U> T foo(T t, U u) {\n" +
3562
		"		return t;\n" +
3563
		"	}\n" +
3564
		"	public static void main(String[] args) {\n" +
3565
		"		System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
3566
		"	}\n" +
3567
		"}\n";
3568
	String expectedUnitToString = 
3569
		"public class X {\n" + 
3570
		"  public X() {\n" + 
3571
		"    super();\n" + 
3572
		"  }\n" + 
3573
		"  static <T, U>T foo(T t, U u) {\n" + 
3574
		"    return t;\n" + 
3575
		"  }\n" + 
3576
		"  public static void main(String[] args) {\n" + 
3577
		"    System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + 
3578
		"  }\n" + 
3579
		"}\n";
3580
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3581
}
3582
//generic type arguments in a generic method invocation
3583
public void test0134() throws IOException {
3584
	String source =
3585
		"public class X {\n" +
3586
		"\n" +
3587
		"	<T, U> T foo(T t, U u) {\n" +
3588
		"		return t;\n" +
3589
		"	}\n" +
3590
		"	public static void main(String[] args) {\n" +
3591
		"		X x = new X();\n" +
3592
		"		System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
3593
		"	}\n" +
3594
		"}\n";
3595
	String expectedUnitToString = 
3596
		"public class X {\n" + 
3597
		"  public X() {\n" + 
3598
		"    super();\n" + 
3599
		"  }\n" + 
3600
		"  <T, U>T foo(T t, U u) {\n" + 
3601
		"    return t;\n" + 
3602
		"  }\n" + 
3603
		"  public static void main(String[] args) {\n" +
3604
		"    X x = new X();\n" +
3605
		"    System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + 
3606
		"  }\n" + 
3607
		"}\n";
3608
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3609
}
3610
//generic type arguments in a generic constructor invocation
3611
public void test0135() throws IOException {
3612
	String source =
3613
		"public class X {\n" +
3614
		"	<T, U> X(T t, U u) {\n" +
3615
		"	}\n" +
3616
		"	public static void main(String[] args) {\n" +
3617
		"		X x = new <@D() @A(value = \"hello\") String, @B X> X();\n" +
3618
		"		System.out.println(x);\n" +
3619
		"	}\n" +
3620
		"}\n";
3621
	String expectedUnitToString = 
3622
		"public class X {\n" + 
3623
		"  <T, U>X(T t, U u) {\n" + 
3624
		"    super();\n" + 
3625
		"  }\n" + 
3626
		"  public static void main(String[] args) {\n" + 
3627
		"    X x = new <@D() @A(value = \"hello\") String, @B X>X();\n" + 
3628
		"    System.out.println(x);\n" + 
3629
		"  }\n" + 
3630
		"}\n";
3631
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3632
}
3633
}
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java (-2 / +6 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for Bug 331872 - [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
14
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for Bug 331872 - [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
Lines 551-557 Link Here
551
555
552
// https://bugs.eclipse.org/331872 -  [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
556
// https://bugs.eclipse.org/331872 -  [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
553
public void test018() throws Exception {
557
public void test018() throws Exception {
554
	if (this.complianceLevel < ClassFileConstants.JDK1_5)
558
	if (new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_5)
555
		return;
559
		return;
556
	this.runNegativeTest(
560
	this.runNegativeTest(
557
		new String[] {
561
		new String[] {
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-12 / +16 lines)
Lines 4-9 Link Here
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 *
11
 *
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 12682-12688 Link Here
12682
		new String[] {
12686
		new String[] {
12683
				"X1.java",
12687
				"X1.java",
12684
				"public class X1 {\n" +
12688
				"public class X1 {\n" +
12685
				"	Zork;\n" +
12689
				"	Zork z;\n" +
12686
				"}\n",
12690
				"}\n",
12687
				"org/eclipse/jdt/annotation/NonNull.java",
12691
				"org/eclipse/jdt/annotation/NonNull.java",
12688
				NONNULL_ANNOTATION_CONTENT,
12692
				NONNULL_ANNOTATION_CONTENT,
Lines 12697-12713 Link Here
12697
		+ " -warn:+nullAnnot -warn:+null -missingNullDefault -proc:none -d \"" + OUTPUT_DIR + "\"",
12701
		+ " -warn:+nullAnnot -warn:+null -missingNullDefault -proc:none -d \"" + OUTPUT_DIR + "\"",
12698
		"",
12702
		"",
12699
		"----------\n" + 
12703
		"----------\n" + 
12700
		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X1.java (at line 1)\n" + 
12704
				"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X1.java (at line 1)\n" + 
12701
		"	public class X1 {\n" + 
12705
				"	public class X1 {\n" + 
12702
		"	             ^^\n" + 
12706
				"	             ^^\n" + 
12703
		"A default nullness annotation has not been specified for the type X1\n" + 
12707
				"A default nullness annotation has not been specified for the type X1\n" + 
12704
		"----------\n" + 
12708
				"----------\n" + 
12705
		"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X1.java (at line 2)\n" + 
12709
				"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X1.java (at line 2)\n" + 
12706
		"	Zork;\n" + 
12710
				"	Zork z;\n" + 
12707
		"	^^^^\n" + 
12711
				"	^^^^\n" + 
12708
		"Syntax error on token \"Zork\", VariableDeclarator expected after this token\n" + 
12712
				"Zork cannot be resolved to a type\n" + 
12709
		"----------\n" + 
12713
				"----------\n" + 
12710
		"2 problems (1 error, 1 warning)", 
12714
				"2 problems (1 error, 1 warning)", 
12711
		true);
12715
		true);
12712
}
12716
}
12713
12717
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (+10 lines)
Lines 526-531 Link Here
526
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
526
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
527
		expectedProblemAttributes.put("IllegalUnderscorePosition", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
527
		expectedProblemAttributes.put("IllegalUnderscorePosition", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
528
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
528
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
529
		expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
529
		expectedProblemAttributes.put("IllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
530
		expectedProblemAttributes.put("IllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
530
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
531
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
531
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
532
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 587-592 Link Here
587
		expectedProblemAttributes.put("InvalidHighSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
588
		expectedProblemAttributes.put("InvalidHighSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
588
		expectedProblemAttributes.put("InvalidInput", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
589
		expectedProblemAttributes.put("InvalidInput", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
589
		expectedProblemAttributes.put("InvalidLowSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
590
		expectedProblemAttributes.put("InvalidLowSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
591
		expectedProblemAttributes.put("InvalidLocationForModifiers", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
590
		expectedProblemAttributes.put("InvalidNullToSynchronized", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
592
		expectedProblemAttributes.put("InvalidNullToSynchronized", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
591
		expectedProblemAttributes.put("InvalidOctal", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
593
		expectedProblemAttributes.put("InvalidOctal", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
592
		expectedProblemAttributes.put("InvalidOperator", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
594
		expectedProblemAttributes.put("InvalidOperator", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
Lines 605-611 Link Here
605
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
607
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
606
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
608
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
607
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
609
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
610
		expectedProblemAttributes.put("InvalidUsageOfReceiverAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
608
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
611
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
612
		expectedProblemAttributes.put("InvalidUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
609
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
613
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
610
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
614
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
611
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
615
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
Lines 701-706 Link Here
701
		expectedProblemAttributes.put("MethodRequiresBody", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
705
		expectedProblemAttributes.put("MethodRequiresBody", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
702
		expectedProblemAttributes.put("MethodReturnsVoid", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
706
		expectedProblemAttributes.put("MethodReturnsVoid", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
703
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
707
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
708
		expectedProblemAttributes.put("MisplacedTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
704
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
709
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
705
		expectedProblemAttributes.put("MissingDefaultCase", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
710
		expectedProblemAttributes.put("MissingDefaultCase", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
706
		expectedProblemAttributes.put("MissingEnclosingInstance", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
711
		expectedProblemAttributes.put("MissingEnclosingInstance", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 1232-1237 Link Here
1232
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", SKIP);
1237
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", SKIP);
1233
		expectedProblemAttributes.put("IllegalUnderscorePosition", SKIP);
1238
		expectedProblemAttributes.put("IllegalUnderscorePosition", SKIP);
1234
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", SKIP);
1239
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", SKIP);
1240
		expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", SKIP);
1235
		expectedProblemAttributes.put("IllegalVararg", SKIP);
1241
		expectedProblemAttributes.put("IllegalVararg", SKIP);
1236
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", SKIP);
1242
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", SKIP);
1237
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", SKIP);
1243
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", SKIP);
Lines 1293-1298 Link Here
1293
		expectedProblemAttributes.put("InvalidHighSurrogate", SKIP);
1299
		expectedProblemAttributes.put("InvalidHighSurrogate", SKIP);
1294
		expectedProblemAttributes.put("InvalidInput", SKIP);
1300
		expectedProblemAttributes.put("InvalidInput", SKIP);
1295
		expectedProblemAttributes.put("InvalidLowSurrogate", SKIP);
1301
		expectedProblemAttributes.put("InvalidLowSurrogate", SKIP);
1302
		expectedProblemAttributes.put("InvalidLocationForModifiers", SKIP);
1296
		expectedProblemAttributes.put("InvalidNullToSynchronized", SKIP);
1303
		expectedProblemAttributes.put("InvalidNullToSynchronized", SKIP);
1297
		expectedProblemAttributes.put("InvalidOctal", SKIP);
1304
		expectedProblemAttributes.put("InvalidOctal", SKIP);
1298
		expectedProblemAttributes.put("InvalidOperator", SKIP);
1305
		expectedProblemAttributes.put("InvalidOperator", SKIP);
Lines 1311-1317 Link Here
1311
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP);
1318
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP);
1312
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP);
1319
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP);
1313
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP);
1320
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP);
1321
		expectedProblemAttributes.put("InvalidUsageOfReceiverAnnotations", SKIP);
1314
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP);
1322
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP);
1323
		expectedProblemAttributes.put("InvalidUsageOfTypeAnnotations", SKIP);
1315
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", SKIP);
1324
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", SKIP);
1316
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", SKIP);
1325
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", SKIP);
1317
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", SKIP);
1326
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", SKIP);
Lines 1407-1412 Link Here
1407
		expectedProblemAttributes.put("MethodRequiresBody", SKIP);
1416
		expectedProblemAttributes.put("MethodRequiresBody", SKIP);
1408
		expectedProblemAttributes.put("MethodReturnsVoid", SKIP);
1417
		expectedProblemAttributes.put("MethodReturnsVoid", SKIP);
1409
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST));
1418
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST));
1419
		expectedProblemAttributes.put("MisplacedTypeAnnotations", SKIP);
1410
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", SKIP);
1420
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", SKIP);
1411
		expectedProblemAttributes.put("MissingDefaultCase", new ProblemAttributes(JavaCore.COMPILER_PB_SWITCH_MISSING_DEFAULT_CASE));
1421
		expectedProblemAttributes.put("MissingDefaultCase", new ProblemAttributes(JavaCore.COMPILER_PB_SWITCH_MISSING_DEFAULT_CASE));
1412
		expectedProblemAttributes.put("MissingEnclosingInstance", SKIP);
1422
		expectedProblemAttributes.put("MissingEnclosingInstance", SKIP);
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestMixed.java (-45 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 14-20 Link Here
14
14
15
import junit.framework.Test;
15
import junit.framework.Test;
16
16
17
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
18
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
17
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
19
18
20
public class JavadocTestMixed extends JavadocTest {
19
public class JavadocTestMixed extends JavadocTest {
Lines 779-827 Link Here
779
					+ "		return \"\";\n"
778
					+ "		return \"\";\n"
780
					+ "	}\n"
779
					+ "	}\n"
781
					+ "}\n" },
780
					+ "}\n" },
782
					this.complianceLevel < ClassFileConstants.JDK1_5
781
					"----------\n" + 
783
					? "----------\n"
782
					"1. ERROR in test\\X.java (at line 23)\n" + 
784
						+ "1. ERROR in test\\X.java (at line 23)\n"
783
					"	}\n" + 
785
						+ "	}\n"
784
					"	^\n" + 
786
						+ "	^\n"
785
					"Syntax error, insert \"}\" to complete ClassBody\n" + 
787
						+ "Syntax error, insert \"}\" to complete ClassBody\n"
786
					"----------\n" + 
788
						+ "----------\n"
787
					"2. ERROR in test\\X.java (at line 26)\n" + 
789
						+ "2. ERROR in test\\X.java (at line 26)\n"
788
					"	* @param list Valid param tag\n" + 
790
						+ "	* @param list Valid param tag\n"
789
					"	         ^^^^\n" + 
791
						+ "	         ^^^^\n"
790
					"Javadoc: Parameter list is not declared\n" + 
792
						+ "Javadoc: Parameter list is not declared\n"
791
					"----------\n" + 
793
						+ "----------\n"
792
					"3. ERROR in test\\X.java (at line 33)\n" + 
794
						+ "3. ERROR in test\\X.java (at line 33)\n"
793
					"	public String foo(java.util.Vector ) {\n" + 
795
						+ "	public String foo(java.util.Vector ) {\n"
794
					"	                            ^^^^^^\n" + 
796
						+ "	                            ^^^^^^\n"
795
					"Syntax error, insert \"VariableDeclaratorId\" to complete FormalParameterList\n" + 
797
						+ "Syntax error on token \"Vector\", VariableDeclaratorId expected after this token\n"
796
					"----------\n" + 
798
						+ "----------\n"
797
					"4. ERROR in test\\X.java (at line 36)\n" + 
799
						+ "4. ERROR in test\\X.java (at line 36)\n"
798
					"	}\n" + 
800
						+ "	}\n"
799
					"	^\n" + 
801
						+ "	^\n"
800
					"Syntax error on token \"}\", delete this token\n" + 
802
						+ "Syntax error on token \"}\", delete this token\n"
801
					"----------\n");						
803
						+ "----------\n"
804
					: "----------\n"
805
						+ "1. ERROR in test\\X.java (at line 23)\n"
806
						+ "	}\n"
807
						+ "	^\n"
808
						+ "Syntax error, insert \"}\" to complete ClassBody\n"
809
						+ "----------\n"
810
						+ "2. ERROR in test\\X.java (at line 26)\n"
811
						+ "	* @param list Valid param tag\n"
812
						+ "	         ^^^^\n"
813
						+ "Javadoc: Parameter list is not declared\n"
814
						+ "----------\n"
815
						+ "3. ERROR in test\\X.java (at line 33)\n"
816
						+ "	public String foo(java.util.Vector ) {\n"
817
						+ "	                           ^\n"
818
						+ "Syntax error on token \".\", ... expected\n"
819
						+ "----------\n"
820
						+ "4. ERROR in test\\X.java (at line 36)\n"
821
						+ "	}\n"
822
						+ "	^\n"
823
						+ "Syntax error on token \"}\", delete this token\n"
824
						+ "----------\n");
825
	}
802
	}
826
803
827
	public void test040() {
804
	public void test040() {
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java (+927 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.tests.compiler.regression;
16
17
import junit.framework.Test;
18
19
public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
20
21
	static { 
22
//		TESTS_NUMBERS = new int [] { 35 };
23
	}
24
	public static Class testClass() {
25
		return NegativeTypeAnnotationTest.class;
26
	}
27
	public static Test suite() {
28
		return buildMinimalComplianceTestSuite(testClass(), F_1_7);
29
	}
30
	public NegativeTypeAnnotationTest(String testName){
31
		super(testName);
32
	}
33
	public void test001() throws Exception {
34
		this.runNegativeTest(
35
				new String[] {
36
					"X.java",
37
					"public class X extends @Marker2 Object {}",
38
				},
39
				"----------\n" + 
40
				"1. ERROR in X.java (at line 1)\n" + 
41
				"	public class X extends @Marker2 Object {}\n" + 
42
				"	                        ^^^^^^^\n" + 
43
				"Marker2 cannot be resolved to a type\n" + 
44
				"----------\n");
45
	}
46
	public void test002() throws Exception {
47
		this.runNegativeTest(
48
				new String[] {
49
					"X.java",
50
					"import java.io.Serializable;\n" +
51
					"public class X implements @Marker2 Serializable {\n" +
52
					"	private static final long serialVersionUID = 1L;\n" +
53
					"}",
54
				},
55
				"----------\n" + 
56
				"1. ERROR in X.java (at line 2)\n" + 
57
				"	public class X implements @Marker2 Serializable {\n" + 
58
				"	                           ^^^^^^^\n" + 
59
				"Marker2 cannot be resolved to a type\n" + 
60
				"----------\n");
61
	}
62
	public void test003() throws Exception {
63
		this.runNegativeTest(
64
				new String[] {
65
					"X.java",
66
					"public class X extends @Marker Object {}",
67
				},
68
				"----------\n" + 
69
				"1. ERROR in X.java (at line 1)\n" + 
70
				"	public class X extends @Marker Object {}\n" + 
71
				"	                        ^^^^^^\n" + 
72
				"Marker cannot be resolved to a type\n" + 
73
				"----------\n");
74
	}
75
	public void test004() throws Exception {
76
		this.runNegativeTest(
77
				new String[] {
78
					"X.java",
79
					"public class X<@Marker T> {}",
80
				},
81
				"----------\n" + 
82
				"1. ERROR in X.java (at line 1)\n" + 
83
				"	public class X<@Marker T> {}\n" + 
84
				"	                ^^^^^^\n" + 
85
				"Marker cannot be resolved to a type\n" + 
86
				"----------\n");
87
	}
88
	public void test005() throws Exception {
89
		this.runNegativeTest(
90
				new String[] {
91
					"X.java",
92
					"public class X<@Marker T> {}",
93
				},
94
				"----------\n" + 
95
				"1. ERROR in X.java (at line 1)\n" + 
96
				"	public class X<@Marker T> {}\n" + 
97
				"	                ^^^^^^\n" + 
98
				"Marker cannot be resolved to a type\n" + 
99
				"----------\n");
100
	}
101
	public void test006() throws Exception {
102
		this.runNegativeTest(
103
			new String[] {
104
				"Y.java",
105
				"class Y {}\n",
106
				"X.java",
107
				"public class X extends @A(id=\"Hello, World!\") @B @C('(') Y {\n" + 
108
				"}",
109
		},
110
		"----------\n" + 
111
		"1. ERROR in X.java (at line 1)\n" + 
112
		"	public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + 
113
		"	                        ^\n" + 
114
		"A cannot be resolved to a type\n" + 
115
		"----------\n" + 
116
		"2. ERROR in X.java (at line 1)\n" + 
117
		"	public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + 
118
		"	                                               ^\n" + 
119
		"B cannot be resolved to a type\n" + 
120
		"----------\n" + 
121
		"3. ERROR in X.java (at line 1)\n" + 
122
		"	public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + 
123
		"	                                                  ^\n" + 
124
		"C cannot be resolved to a type\n" + 
125
		"----------\n");
126
	}
127
	public void test007() throws Exception {
128
		this.runNegativeTest(
129
			new String[] {
130
				"I.java",
131
				"interface I {}\n",
132
				"J.java",
133
				"interface J {}\n",
134
				"X.java",
135
				"public class X implements @A(id=\"Hello, World!\") I, @B @C('(') J {}",
136
		},
137
		"----------\n" + 
138
		"1. ERROR in X.java (at line 1)\n" + 
139
		"	public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + 
140
		"	                           ^\n" + 
141
		"A cannot be resolved to a type\n" + 
142
		"----------\n" + 
143
		"2. ERROR in X.java (at line 1)\n" + 
144
		"	public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + 
145
		"	                                                     ^\n" + 
146
		"B cannot be resolved to a type\n" + 
147
		"----------\n" + 
148
		"3. ERROR in X.java (at line 1)\n" + 
149
		"	public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + 
150
		"	                                                        ^\n" + 
151
		"C cannot be resolved to a type\n" + 
152
		"----------\n");
153
	}
154
	// class literal
155
	public void test008() throws Exception {
156
		this.runNegativeTest(
157
			new String[] {
158
				"I.java",
159
				"interface I {}\n",
160
				"J.java",
161
				"interface J {}\n",
162
				"X.java",
163
				"public class X {\n" + 
164
				"	public boolean foo(String s) {\n" + 
165
				"		return (s instanceof @C('_') Object);\n" + 
166
				"	}\n" + 
167
				"	public Object foo1(String s) {\n" + 
168
				"		return new @B(3) @A(\"new Object\") Object();\n" + 
169
				"	}\n" + 
170
				"	public Class<?> foo2(String s) {\n" + 
171
				"		return @B(4) Object.class;\n" + 
172
				"	}\n" + 
173
				"	public Class<?> foo3(String s) {\n" + 
174
				"		return @A(\"int class literal\")  @B(5) int.class;\n" + 
175
				"	}\n" + 
176
				"}",
177
		},
178
		"----------\n" + 
179
		"1. ERROR in X.java (at line 3)\n" + 
180
		"	return (s instanceof @C(\'_\') Object);\n" + 
181
		"	                      ^\n" + 
182
		"C cannot be resolved to a type\n" + 
183
		"----------\n" + 
184
		"2. ERROR in X.java (at line 6)\n" + 
185
		"	return new @B(3) @A(\"new Object\") Object();\n" + 
186
		"	            ^\n" + 
187
		"B cannot be resolved to a type\n" + 
188
		"----------\n" + 
189
		"3. ERROR in X.java (at line 6)\n" + 
190
		"	return new @B(3) @A(\"new Object\") Object();\n" + 
191
		"	                  ^\n" + 
192
		"A cannot be resolved to a type\n" + 
193
		"----------\n" + 
194
		"4. ERROR in X.java (at line 9)\n" + 
195
		"	return @B(4) Object.class;\n" + 
196
		"	        ^\n" + 
197
		"B cannot be resolved to a type\n" + 
198
		"----------\n" + 
199
		"5. ERROR in X.java (at line 12)\n" + 
200
		"	return @A(\"int class literal\")  @B(5) int.class;\n" + 
201
		"	        ^\n" + 
202
		"A cannot be resolved to a type\n" + 
203
		"----------\n" + 
204
		"6. ERROR in X.java (at line 12)\n" + 
205
		"	return @A(\"int class literal\")  @B(5) int.class;\n" + 
206
		"	                                 ^\n" + 
207
		"B cannot be resolved to a type\n" + 
208
		"----------\n");
209
	}
210
	// class literal generic and array
211
	public void test009() throws Exception {
212
		this.runNegativeTest(
213
			new String[] {
214
				"I.java",
215
				"interface I {}\n",
216
				"J.java",
217
				"interface J {}\n",
218
				"X.java",
219
				"public class X {\n" + 
220
				"	public boolean foo(Object o) {\n" + 
221
				"		return (o instanceof @C('_') Object[]);\n" + 
222
				"	}\n" + 
223
				"	public Object foo1(String s) {\n" + 
224
				"		return new @B(3) @A(\"new Object\") Object[] {};\n" + 
225
				"	}\n" + 
226
				"	public Class<?> foo2(String s) {\n" + 
227
				"		return @B(4) Object[].class;\n" + 
228
				"	}\n" + 
229
				"	public Class<?> foo3(String s) {\n" + 
230
				"		return @A(\"int class literal\")  @B(5) int[].class;\n" + 
231
				"	}\n" + 
232
				"}",
233
		},
234
		"----------\n" + 
235
		"1. ERROR in X.java (at line 3)\n" + 
236
		"	return (o instanceof @C(\'_\') Object[]);\n" + 
237
		"	                      ^\n" + 
238
		"C cannot be resolved to a type\n" + 
239
		"----------\n" + 
240
		"2. ERROR in X.java (at line 6)\n" + 
241
		"	return new @B(3) @A(\"new Object\") Object[] {};\n" + 
242
		"	            ^\n" + 
243
		"B cannot be resolved to a type\n" + 
244
		"----------\n" + 
245
		"3. ERROR in X.java (at line 6)\n" + 
246
		"	return new @B(3) @A(\"new Object\") Object[] {};\n" + 
247
		"	                  ^\n" + 
248
		"A cannot be resolved to a type\n" + 
249
		"----------\n" + 
250
		"4. ERROR in X.java (at line 9)\n" + 
251
		"	return @B(4) Object[].class;\n" + 
252
		"	        ^\n" + 
253
		"B cannot be resolved to a type\n" + 
254
		"----------\n" + 
255
		"5. ERROR in X.java (at line 12)\n" + 
256
		"	return @A(\"int class literal\")  @B(5) int[].class;\n" + 
257
		"	        ^\n" + 
258
		"A cannot be resolved to a type\n" + 
259
		"----------\n" + 
260
		"6. ERROR in X.java (at line 12)\n" + 
261
		"	return @A(\"int class literal\")  @B(5) int[].class;\n" + 
262
		"	                                 ^\n" + 
263
		"B cannot be resolved to a type\n" + 
264
		"----------\n");
265
	}
266
	public void test010() throws Exception {
267
		this.runNegativeTest(
268
			new String[] {
269
				"Y.java",
270
				"class Y<T> {}\n",
271
				"X.java",
272
				"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String> {\n" + 
273
				"}",
274
		},
275
		"----------\n" + 
276
		"1. ERROR in X.java (at line 1)\n" + 
277
		"	public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + 
278
		"	                        ^\n" + 
279
		"A cannot be resolved to a type\n" + 
280
		"----------\n" + 
281
		"2. ERROR in X.java (at line 1)\n" + 
282
		"	public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + 
283
		"	                                              ^\n" + 
284
		"B cannot be resolved to a type\n" + 
285
		"----------\n" + 
286
		"3. ERROR in X.java (at line 1)\n" + 
287
		"	public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + 
288
		"	                                                 ^\n" + 
289
		"C cannot be resolved to a type\n" + 
290
		"----------\n");
291
	}
292
	public void test011() throws Exception {
293
		this.runNegativeTest(
294
			new String[] {
295
				"I.java",
296
				"interface I<T> {}\n",
297
				"J.java",
298
				"interface J<T> {}\n",
299
				"X.java",
300
				"public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C('(') Integer> {}",
301
		},
302
		"----------\n" + 
303
		"1. ERROR in X.java (at line 1)\n" + 
304
		"	public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C(\'(\') Integer> {}\n" + 
305
		"	                             ^\n" + 
306
		"A cannot be resolved to a type\n" + 
307
		"----------\n" + 
308
		"2. ERROR in X.java (at line 1)\n" + 
309
		"	public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C(\'(\') Integer> {}\n" + 
310
		"	                                                           ^\n" + 
311
		"B cannot be resolved to a type\n" + 
312
		"----------\n" + 
313
		"3. ERROR in X.java (at line 1)\n" + 
314
		"	public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C(\'(\') Integer> {}\n" + 
315
		"	                                                                ^\n" + 
316
		"C cannot be resolved to a type\n" + 
317
		"----------\n");
318
	}
319
	// throws
320
	public void test012() throws Exception {
321
		this.runNegativeTest(
322
			new String[] {
323
				"E.java",
324
				"class E extends RuntimeException {\n" +
325
				"	private static final long serialVersionUID = 1L;\n" +
326
				"}\n",
327
				"E1.java",
328
				"class E1 extends RuntimeException {\n" +
329
				"	private static final long serialVersionUID = 1L;\n" +
330
				"}\n",
331
				"E2.java",
332
				"class E2 extends RuntimeException {\n" +
333
				"	private static final long serialVersionUID = 1L;\n" +
334
				"}\n",
335
				"X.java",
336
				"public class X {\n" +
337
				"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C('(') E2 {}\n" +
338
				"}",
339
		},
340
		"----------\n" + 
341
		"1. ERROR in X.java (at line 2)\n" + 
342
		"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + 
343
		"	                   ^\n" + 
344
		"A cannot be resolved to a type\n" + 
345
		"----------\n" + 
346
		"2. ERROR in X.java (at line 2)\n" + 
347
		"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + 
348
		"	                                              ^\n" + 
349
		"B cannot be resolved to a type\n" + 
350
		"----------\n" + 
351
		"3. ERROR in X.java (at line 2)\n" + 
352
		"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + 
353
		"	                                                 ^\n" + 
354
		"C cannot be resolved to a type\n" + 
355
		"----------\n");
356
	}
357
	// method receiver
358
	public void test013() throws Exception {
359
		this.runNegativeTest(
360
			new String[] {
361
				"X.java",
362
				"public class X {\n" + 
363
				"	void foo() @B(3) {}\n" + 
364
				"}",
365
		},
366
		"----------\n" + 
367
		"1. ERROR in X.java (at line 2)\n" + 
368
		"	void foo() @B(3) {}\n" + 
369
		"	            ^\n" + 
370
		"B cannot be resolved to a type\n" + 
371
		"----------\n");
372
	}
373
	// method return type
374
	public void test014() throws Exception {
375
		this.runNegativeTest(
376
			new String[] {
377
				"X.java",
378
				"public class X {\n" + 
379
				"	@B(3) int foo() {\n" +
380
				"		return 1;\n" +
381
				"	}\n" + 
382
				"}",
383
		},
384
		"----------\n" + 
385
		"1. ERROR in X.java (at line 2)\n" + 
386
		"	@B(3) int foo() {\n" + 
387
		"	 ^\n" + 
388
		"B cannot be resolved to a type\n" + 
389
		"----------\n");
390
	}
391
	// field type
392
	public void test015() throws Exception {
393
		this.runNegativeTest(
394
			new String[] {
395
				"X.java",
396
				"public class X {\n" + 
397
				"	@B(3) int field;\n" +
398
				"}",
399
		},
400
		"----------\n" + 
401
		"1. ERROR in X.java (at line 2)\n" + 
402
		"	@B(3) int field;\n" + 
403
		"	 ^\n" + 
404
		"B cannot be resolved to a type\n" + 
405
		"----------\n");
406
	}
407
	// method parameter
408
	public void test016() throws Exception {
409
		this.runNegativeTest(
410
			new String[] {
411
				"X.java",
412
				"public class X {\n" + 
413
				"	int foo(@B(3) String s) {\n" +
414
				"		return s.length();\n" +
415
				"	}\n" + 
416
				"}",
417
		},
418
		"----------\n" + 
419
		"1. ERROR in X.java (at line 2)\n" + 
420
		"	int foo(@B(3) String s) {\n" + 
421
		"	         ^\n" + 
422
		"B cannot be resolved to a type\n" + 
423
		"----------\n");
424
	}
425
	// method parameter generic or array
426
	public void test017() throws Exception {
427
		this.runNegativeTest(
428
			new String[] {
429
				"X.java",
430
				"public class X {\n" + 
431
				"	int foo(String @B(3) [] s) {\n" +
432
				"		return s.length;\n" +
433
				"	}\n" + 
434
				"}",
435
		},
436
		"----------\n" + 
437
		"1. ERROR in X.java (at line 2)\n" + 
438
		"	int foo(String @B(3) [] s) {\n" + 
439
		"	                ^\n" + 
440
		"B cannot be resolved to a type\n" + 
441
		"----------\n");
442
	}
443
	// field type generic or array
444
	public void test018() throws Exception {
445
		this.runNegativeTest(
446
			new String[] {
447
				"X.java",
448
				"public class X {\n" + 
449
				"	int @B(3) [] field;\n" +
450
				"}",
451
		},
452
		"----------\n" + 
453
		"1. ERROR in X.java (at line 2)\n" + 
454
		"	int @B(3) [] field;\n" + 
455
		"	     ^\n" + 
456
		"B cannot be resolved to a type\n" + 
457
		"----------\n");
458
	}
459
	// class type parameter
460
	public void test019() throws Exception {
461
		this.runNegativeTest(
462
			new String[] {
463
				"X.java",
464
				"public class X<@A @B(3) T> {}",
465
		},
466
		"----------\n" + 
467
		"1. ERROR in X.java (at line 1)\n" + 
468
		"	public class X<@A @B(3) T> {}\n" + 
469
		"	                ^\n" + 
470
		"A cannot be resolved to a type\n" + 
471
		"----------\n" + 
472
		"2. ERROR in X.java (at line 1)\n" + 
473
		"	public class X<@A @B(3) T> {}\n" + 
474
		"	                   ^\n" + 
475
		"B cannot be resolved to a type\n" + 
476
		"----------\n");
477
	}
478
	// method type parameter
479
	public void test020() throws Exception {
480
		this.runNegativeTest(
481
			new String[] {
482
				"X.java",
483
				"public class X {\n" + 
484
				"	<@A @B(3) T> void foo(T t) {}\n" + 
485
				"}",
486
		},
487
		"----------\n" + 
488
		"1. ERROR in X.java (at line 2)\n" + 
489
		"	<@A @B(3) T> void foo(T t) {}\n" + 
490
		"	  ^\n" + 
491
		"A cannot be resolved to a type\n" + 
492
		"----------\n" + 
493
		"2. ERROR in X.java (at line 2)\n" + 
494
		"	<@A @B(3) T> void foo(T t) {}\n" + 
495
		"	     ^\n" + 
496
		"B cannot be resolved to a type\n" + 
497
		"----------\n");
498
	}
499
	// class type parameter bound
500
	public void test021() throws Exception {
501
		this.runNegativeTest(
502
			new String[] {
503
				"Z.java",
504
				"public class Z {}",
505
				"X.java",
506
				"public class X<T extends @A Z & @B(3) Cloneable> {}",
507
		},
508
		"----------\n" + 
509
		"1. ERROR in X.java (at line 1)\n" + 
510
		"	public class X<T extends @A Z & @B(3) Cloneable> {}\n" + 
511
		"	                          ^\n" + 
512
		"A cannot be resolved to a type\n" + 
513
		"----------\n" + 
514
		"2. ERROR in X.java (at line 1)\n" + 
515
		"	public class X<T extends @A Z & @B(3) Cloneable> {}\n" + 
516
		"	                                 ^\n" + 
517
		"B cannot be resolved to a type\n" + 
518
		"----------\n");
519
	}
520
	// class type parameter bound generic or array
521
	public void test022() throws Exception {
522
		this.runNegativeTest(
523
			new String[] {
524
				"Y.java",
525
				"public class Y<T> {}",
526
				"X.java",
527
				"public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}",
528
		},
529
		"----------\n" + 
530
		"1. ERROR in X.java (at line 1)\n" + 
531
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
532
		"	                            ^\n" + 
533
		"A cannot be resolved to a type\n" + 
534
		"----------\n" + 
535
		"2. ERROR in X.java (at line 1)\n" + 
536
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
537
		"	                                      ^\n" + 
538
		"C cannot be resolved to a type\n" + 
539
		"----------\n" + 
540
		"3. ERROR in X.java (at line 1)\n" + 
541
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
542
		"	                                            ^\n" + 
543
		"B cannot be resolved to a type\n" + 
544
		"----------\n" + 
545
		"4. ERROR in X.java (at line 1)\n" + 
546
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
547
		"	                                                    ^\n" + 
548
		"B cannot be resolved to a type\n" + 
549
		"----------\n");
550
	}
551
	// method type parameter bound
552
	public void test023() throws Exception {
553
		this.runNegativeTest(
554
			new String[] {
555
				"Z.java",
556
				"public class Z {}",
557
				"X.java",
558
				"public class X {\n" +
559
				"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" +
560
				"}",
561
		},
562
		"----------\n" + 
563
		"1. ERROR in X.java (at line 2)\n" + 
564
		"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + 
565
		"	            ^\n" + 
566
		"A cannot be resolved to a type\n" + 
567
		"----------\n" + 
568
		"2. ERROR in X.java (at line 2)\n" + 
569
		"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + 
570
		"	                   ^\n" + 
571
		"B cannot be resolved to a type\n" + 
572
		"----------\n");
573
	}
574
	// class type parameter bound generic or array
575
	public void test024() throws Exception {
576
		this.runNegativeTest(
577
			new String[] {
578
				"Z.java",
579
				"public class Z {}",
580
				"Y.java",
581
				"public class Y<T> {}",
582
				"X.java",
583
				"public class X {\n" +
584
				"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" +
585
				"}",
586
		},
587
		"----------\n" + 
588
		"1. ERROR in X.java (at line 2)\n" + 
589
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
590
		"	              ^\n" + 
591
		"A cannot be resolved to a type\n" + 
592
		"----------\n" + 
593
		"2. ERROR in X.java (at line 2)\n" + 
594
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
595
		"	                   ^\n" + 
596
		"C cannot be resolved to a type\n" + 
597
		"----------\n" + 
598
		"3. ERROR in X.java (at line 2)\n" + 
599
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
600
		"	                         ^\n" + 
601
		"B cannot be resolved to a type\n" + 
602
		"----------\n" + 
603
		"4. ERROR in X.java (at line 2)\n" + 
604
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
605
		"	                                 ^\n" + 
606
		"B cannot be resolved to a type\n" + 
607
		"----------\n");
608
	}
609
	// local variable + generic or array
610
	public void test025() throws Exception {
611
		this.runNegativeTest(
612
			new String[] {
613
				"X.java",
614
				"public class X {\n" + 
615
				"	void foo(String s) {\n" + 
616
				"		@C int i;\n" + 
617
				"		@A String [] @B(3)[] tab = new String[][] {};\n" + 
618
				"		if (tab != null) {\n" + 
619
				"			i = 0;\n" + 
620
				"			System.out.println(i + tab.length);\n" + 
621
				"		} else {\n" + 
622
				"			System.out.println(tab.length);\n" + 
623
				"		}\n" + 
624
				"		i = 4;\n" + 
625
				"		System.out.println(-i + tab.length);\n" + 
626
				"	}\n" + 
627
				"}",
628
		},
629
		"----------\n" + 
630
		"1. ERROR in X.java (at line 3)\n" + 
631
		"	@C int i;\n" + 
632
		"	 ^\n" + 
633
		"C cannot be resolved to a type\n" + 
634
		"----------\n" + 
635
		"2. ERROR in X.java (at line 4)\n" + 
636
		"	@A String [] @B(3)[] tab = new String[][] {};\n" + 
637
		"	 ^\n" + 
638
		"A cannot be resolved to a type\n" + 
639
		"----------\n" + 
640
		"3. ERROR in X.java (at line 4)\n" + 
641
		"	@A String [] @B(3)[] tab = new String[][] {};\n" + 
642
		"	              ^\n" + 
643
		"B cannot be resolved to a type\n" + 
644
		"----------\n");
645
	}
646
	// type argument constructor call
647
	public void test026() throws Exception {
648
		this.runNegativeTest(
649
			new String[] {
650
				"X.java",
651
				"public class X {\n" + 
652
				"	<T> X(T t) {\n" + 
653
				"	}\n" + 
654
				"	public Object foo() {\n" + 
655
				"		X x = new <@A @B(1) String>X(null);\n" + 
656
				"		return x;\n" + 
657
				"	}\n" + 
658
				"}",
659
		},
660
		"----------\n" + 
661
		"1. ERROR in X.java (at line 5)\n" + 
662
		"	X x = new <@A @B(1) String>X(null);\n" + 
663
		"	            ^\n" + 
664
		"A cannot be resolved to a type\n" + 
665
		"----------\n" + 
666
		"2. ERROR in X.java (at line 5)\n" + 
667
		"	X x = new <@A @B(1) String>X(null);\n" + 
668
		"	               ^\n" + 
669
		"B cannot be resolved to a type\n" + 
670
		"----------\n");
671
	}
672
	// type argument constructor call generic or array
673
	public void test027() throws Exception {
674
		this.runNegativeTest(
675
			new String[] {
676
				"X.java",
677
				"public class X {\n" + 
678
				"	<T> X(T t) {\n" + 
679
				"	}\n" + 
680
				"	public Object foo() {\n" + 
681
				"		X x = new <@A @B(1) String>X(null);\n" + 
682
				"		return x;\n" + 
683
				"	}\n" + 
684
				"}",
685
		},
686
		"----------\n" + 
687
		"1. ERROR in X.java (at line 5)\n" + 
688
		"	X x = new <@A @B(1) String>X(null);\n" + 
689
		"	            ^\n" + 
690
		"A cannot be resolved to a type\n" + 
691
		"----------\n" + 
692
		"2. ERROR in X.java (at line 5)\n" + 
693
		"	X x = new <@A @B(1) String>X(null);\n" + 
694
		"	               ^\n" + 
695
		"B cannot be resolved to a type\n" + 
696
		"----------\n");
697
	}
698
	// type argument method call and generic or array
699
	public void test028() throws Exception {
700
		this.runNegativeTest(
701
			new String[] {
702
				"X.java",
703
				"public class X {\n" +
704
				"\n" +
705
				"	static <T, U> T foo(T t, U u) {\n" +
706
				"		return t;\n" +
707
				"	}\n" +
708
				"	public static void main(String[] args) {\n" +
709
				"		System.out.println(X.<@A @B(1) String[], @C('-') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" +
710
				"	}\n" +
711
				"}\n",
712
		},
713
		"----------\n" + 
714
		"1. ERROR in X.java (at line 7)\n" + 
715
		"	System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + 
716
		"	                       ^\n" + 
717
		"A cannot be resolved to a type\n" + 
718
		"----------\n" + 
719
		"2. ERROR in X.java (at line 7)\n" + 
720
		"	System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + 
721
		"	                          ^\n" + 
722
		"B cannot be resolved to a type\n" + 
723
		"----------\n" + 
724
		"3. ERROR in X.java (at line 7)\n" + 
725
		"	System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + 
726
		"	                                          ^\n" + 
727
		"C cannot be resolved to a type\n" + 
728
		"----------\n");
729
	}
730
	public void test029() throws Exception {
731
		this.runNegativeTest(
732
				new String[] {
733
					"X.java",
734
					"public class X extends @Marker2 Object {}",
735
				},
736
				"----------\n" + 
737
				"1. ERROR in X.java (at line 1)\n" + 
738
				"	public class X extends @Marker2 Object {}\n" + 
739
				"	                        ^^^^^^^\n" + 
740
				"Marker2 cannot be resolved to a type\n" + 
741
				"----------\n");
742
	}
743
	public void test030() throws Exception {
744
		this.runNegativeTest(
745
				new String[] {
746
					"X.java",
747
					"import java.io.Serializable;\n" +
748
					"public class X implements @Marker2 Serializable {\n" +
749
					"	private static final long serialVersionUID = 1L;\n" +
750
					"}",
751
				},
752
				"----------\n" + 
753
				"1. ERROR in X.java (at line 2)\n" + 
754
				"	public class X implements @Marker2 Serializable {\n" + 
755
				"	                           ^^^^^^^\n" + 
756
				"Marker2 cannot be resolved to a type\n" + 
757
				"----------\n");
758
	}
759
	public void test031() throws Exception {
760
		this.runNegativeTest(
761
				new String[] {
762
					"Marker.java",
763
					"import java.lang.annotation.Target;\n" + 
764
					"import static java.lang.annotation.ElementType.*;\n" + 
765
					"@Target(TYPE_USE)\n" + 
766
					"@interface Marker {}",
767
					"X.java",
768
					"public class X<@Marker T> {}",
769
				},
770
				"----------\n" + 
771
				"1. ERROR in X.java (at line 1)\n" + 
772
				"	public class X<@Marker T> {}\n" + 
773
				"	               ^^^^^^^\n" + 
774
				"The annotation @Marker is disallowed for this location\n" + 
775
				"----------\n");
776
	}
777
	public void test032() throws Exception {
778
		this.runNegativeTest(
779
				new String[] {
780
					"Marker.java",
781
					"@interface Marker {}",
782
					"X.java",
783
					"public class X<@Marker T> {}",
784
				},
785
				"----------\n" + 
786
				"1. ERROR in X.java (at line 1)\n" + 
787
				"	public class X<@Marker T> {}\n" + 
788
				"	               ^^^^^^^\n" + 
789
				"The annotation @Marker is disallowed for this location\n" + 
790
				"----------\n");
791
	}
792
	public void test033() throws Exception {
793
		this.runNegativeTest(
794
				new String[] {
795
					"Marker.java",
796
					"@interface Marker {}",
797
					"Y.java",
798
					"public class Y {}",
799
					"X.java",
800
					"public class X extends @Marker Y {}",
801
				},
802
				"----------\n" + 
803
				"1. ERROR in X.java (at line 1)\n" + 
804
				"	public class X extends @Marker Y {}\n" + 
805
				"	                       ^^^^^^^\n" + 
806
				"The annotation @Marker is disallowed for this location\n" + 
807
				"----------\n");
808
	}
809
	// check locations
810
	public void test034() throws Exception {
811
		this.runNegativeTest(
812
			new String[] {
813
				"X.java",
814
				"import java.util.Map;\n" +
815
				"import java.util.List;\n" +
816
				"public class X {\n" + 
817
				"	@H String @E[] @F[] @G[] field;\n" + 
818
				"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
819
				"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
820
				"}",
821
		},
822
		"----------\n" + 
823
		"1. ERROR in X.java (at line 4)\n" + 
824
		"	@H String @E[] @F[] @G[] field;\n" + 
825
		"	 ^\n" + 
826
		"H cannot be resolved to a type\n" + 
827
		"----------\n" + 
828
		"2. ERROR in X.java (at line 4)\n" + 
829
		"	@H String @E[] @F[] @G[] field;\n" + 
830
		"	           ^\n" + 
831
		"E cannot be resolved to a type\n" + 
832
		"----------\n" + 
833
		"3. ERROR in X.java (at line 4)\n" + 
834
		"	@H String @E[] @F[] @G[] field;\n" + 
835
		"	                ^\n" + 
836
		"F cannot be resolved to a type\n" + 
837
		"----------\n" + 
838
		"4. ERROR in X.java (at line 4)\n" + 
839
		"	@H String @E[] @F[] @G[] field;\n" + 
840
		"	                     ^\n" + 
841
		"G cannot be resolved to a type\n" + 
842
		"----------\n" + 
843
		"5. ERROR in X.java (at line 5)\n" + 
844
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
845
		"	 ^\n" + 
846
		"A cannot be resolved to a type\n" + 
847
		"----------\n" + 
848
		"6. ERROR in X.java (at line 5)\n" + 
849
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
850
		"	        ^\n" + 
851
		"B cannot be resolved to a type\n" + 
852
		"----------\n" + 
853
		"7. ERROR in X.java (at line 5)\n" + 
854
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
855
		"	                   ^\n" + 
856
		"C cannot be resolved to a type\n" + 
857
		"----------\n" + 
858
		"8. ERROR in X.java (at line 5)\n" + 
859
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
860
		"	                           ^\n" + 
861
		"D cannot be resolved to a type\n" + 
862
		"----------\n" + 
863
		"9. ERROR in X.java (at line 6)\n" + 
864
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
865
		"	 ^\n" + 
866
		"A cannot be resolved to a type\n" + 
867
		"----------\n" + 
868
		"10. ERROR in X.java (at line 6)\n" + 
869
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
870
		"	        ^\n" + 
871
		"B cannot be resolved to a type\n" + 
872
		"----------\n" + 
873
		"11. ERROR in X.java (at line 6)\n" + 
874
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
875
		"	                   ^\n" + 
876
		"H cannot be resolved to a type\n" + 
877
		"----------\n" + 
878
		"12. ERROR in X.java (at line 6)\n" + 
879
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
880
		"	                             ^\n" + 
881
		"E cannot be resolved to a type\n" + 
882
		"----------\n" + 
883
		"13. ERROR in X.java (at line 6)\n" + 
884
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
885
		"	                                  ^\n" + 
886
		"F cannot be resolved to a type\n" + 
887
		"----------\n" + 
888
		"14. ERROR in X.java (at line 6)\n" + 
889
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
890
		"	                                       ^\n" + 
891
		"G cannot be resolved to a type\n" + 
892
		"----------\n");
893
	}
894
	// check locations
895
	public void test035() throws Exception {
896
		this.runNegativeTest(
897
			new String[] {
898
				"X.java",
899
				"import java.util.Map;\n" +
900
				"import java.util.List;\n" +
901
				"public class X {\n" + 
902
				"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
903
				"}",
904
		},
905
		"----------\n" + 
906
		"1. ERROR in X.java (at line 4)\n" + 
907
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
908
		"	 ^\n" + 
909
		"H cannot be resolved to a type\n" + 
910
		"----------\n" + 
911
		"2. ERROR in X.java (at line 4)\n" + 
912
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
913
		"	                     ^\n" + 
914
		"E cannot be resolved to a type\n" + 
915
		"----------\n" + 
916
		"3. ERROR in X.java (at line 4)\n" + 
917
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
918
		"	                          ^\n" + 
919
		"F cannot be resolved to a type\n" + 
920
		"----------\n" + 
921
		"4. ERROR in X.java (at line 4)\n" + 
922
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
923
		"	                               ^\n" + 
924
		"G cannot be resolved to a type\n" + 
925
		"----------\n");
926
	}
927
}
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java (-1 / +5 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java (+2292 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.tests.compiler.regression;
16
17
import java.io.File;
18
19
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
20
21
import junit.framework.Test;
22
23
public class TypeAnnotationTest extends AbstractRegressionTest {
24
25
	static {
26
//		TESTS_NUMBERS = new int [] { 40 };
27
	}
28
	public static Class testClass() {
29
		return TypeAnnotationTest.class;
30
	}
31
	public static Test suite() {
32
		return buildMinimalComplianceTestSuite(testClass(), F_1_7);
33
	}
34
	public TypeAnnotationTest(String testName){
35
		super(testName);
36
	}
37
	// superclass
38
	public void test001() throws Exception {
39
		this.runConformTest(
40
				new String[] {
41
					"Marker.java",
42
					"import java.lang.annotation.Target;\n" + 
43
					"import static java.lang.annotation.ElementType.*;\n" + 
44
					"@Target(TYPE_USE)\n" + 
45
					"@interface Marker {}",
46
					"X.java",
47
					"public class X extends @Marker Object {}",
48
				},
49
				"");
50
		String expectedOutput =
51
			"  RuntimeInvisibleTypeAnnotations: \n" + 
52
			"    #17 @Marker(\n" + 
53
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
54
			"      type index = -1\n" + 
55
			"    )\n";
56
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
57
	}
58
	// type parameter
59
	public void test002() throws Exception {
60
		this.runConformTest(
61
				new String[] {
62
					"Marker.java",
63
					"import java.lang.annotation.Target;\n" + 
64
					"import static java.lang.annotation.ElementType.*;\n" + 
65
					"@Target(TYPE_PARAMETER)\n" + 
66
					"@interface Marker {}",
67
					"X.java",
68
					"public class X<@Marker T> {}",
69
				},
70
				"");
71
		String expectedOutput =
72
			"  RuntimeInvisibleTypeAnnotations: \n" + 
73
			"    #21 @Marker(\n" + 
74
			"      target type = 0x22 CLASS_TYPE_PARAMETER\n" + 
75
			"      type parameter index = 0\n" + 
76
			"    )\n";
77
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
78
	}
79
	// superclass
80
	public void test003() throws Exception {
81
		this.runConformTest(
82
			new String[] {
83
				"A.java",
84
				"import java.lang.annotation.Target;\n" + 
85
				"import static java.lang.annotation.ElementType.*;\n" + 
86
				"import java.lang.annotation.Retention;\n" + 
87
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
88
				"@Target(TYPE_USE)\n" + 
89
				"@Retention(RUNTIME)\n" + 
90
				"@interface A {\n" + 
91
				"	String id() default \"default\";\n" + 
92
				"}\n",
93
				"B.java",
94
				"import java.lang.annotation.Target;\n" + 
95
				"import static java.lang.annotation.ElementType.*;\n" + 
96
				"import java.lang.annotation.Retention;\n" + 
97
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
98
				"@Target(TYPE_USE)\n" + 
99
				"@Retention(CLASS)\n" + 
100
				"@interface B {\n" + 
101
				"	int value() default -1;\n" + 
102
				"}",
103
				"C.java",
104
				"import java.lang.annotation.Target;\n" + 
105
				"import static java.lang.annotation.ElementType.*;\n" + 
106
				"import java.lang.annotation.Retention;\n" + 
107
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
108
				"@Target(TYPE_USE)\n" + 
109
				"@Retention(RUNTIME)\n" + 
110
				"@interface C {\n" + 
111
				"	char value() default '-';\n" + 
112
				"}\n",
113
				"Y.java",
114
				"class Y {}\n",
115
				"X.java",
116
				"public class X extends @A(id=\"Hello, World!\") @B @C('(') Y {\n" + 
117
				"}",
118
		},
119
		"");
120
		String expectedOutput =
121
			"  RuntimeVisibleTypeAnnotations: \n" + 
122
			"    #19 @A(\n" + 
123
			"      #20 id=\"Hello, World!\" (constant type)\n" + 
124
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
125
			"      type index = -1\n" + 
126
			"    )\n" + 
127
			"    #22 @C(\n" + 
128
			"      #23 value=\'(\' (constant type)\n" + 
129
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
130
			"      type index = -1\n" + 
131
			"    )\n" + 
132
			"  RuntimeInvisibleTypeAnnotations: \n" + 
133
			"    #17 @B(\n" + 
134
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
135
			"      type index = -1\n" + 
136
			"    )\n";
137
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
138
	}
139
	// super interfaces
140
	public void test004() throws Exception {
141
		this.runConformTest(
142
			new String[] {
143
				"A.java",
144
				"import java.lang.annotation.Target;\n" + 
145
				"import static java.lang.annotation.ElementType.*;\n" + 
146
				"import java.lang.annotation.Retention;\n" + 
147
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
148
				"@Target(TYPE_USE)\n" + 
149
				"@Retention(RUNTIME)\n" + 
150
				"@interface A {\n" + 
151
				"	String id() default \"default\";\n" + 
152
				"}\n",
153
				"B.java",
154
				"import java.lang.annotation.Target;\n" + 
155
				"import static java.lang.annotation.ElementType.*;\n" + 
156
				"import java.lang.annotation.Retention;\n" + 
157
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
158
				"@Target(TYPE_USE)\n" + 
159
				"@Retention(CLASS)\n" + 
160
				"@interface B {\n" + 
161
				"	int value() default -1;\n" + 
162
				"}",
163
				"C.java",
164
				"import java.lang.annotation.Target;\n" + 
165
				"import static java.lang.annotation.ElementType.*;\n" + 
166
				"import java.lang.annotation.Retention;\n" + 
167
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
168
				"@Target(TYPE_USE)\n" + 
169
				"@Retention(RUNTIME)\n" + 
170
				"@interface C {\n" + 
171
				"	char value() default '-';\n" + 
172
				"}\n",
173
				"I.java",
174
				"interface I {}\n",
175
				"J.java",
176
				"interface J {}\n",
177
				"X.java",
178
				"public class X implements @A(id=\"Hello, World!\") I, @B @C('(') J {}",
179
		},
180
		"");
181
		String expectedOutput =
182
			"  RuntimeVisibleTypeAnnotations: \n" + 
183
			"    #23 @A(\n" + 
184
			"      #24 id=\"Hello, World!\" (constant type)\n" + 
185
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
186
			"      type index = 0\n" + 
187
			"    )\n" + 
188
			"    #26 @C(\n" + 
189
			"      #27 value=\'(\' (constant type)\n" + 
190
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
191
			"      type index = 1\n" + 
192
			"    )\n" + 
193
			"  RuntimeInvisibleTypeAnnotations: \n" + 
194
			"    #21 @B(\n" + 
195
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
196
			"      type index = 1\n" + 
197
			"    )\n";
198
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
199
	}
200
	// class literal
201
	public void test005() throws Exception {
202
		this.runConformTest(
203
			new String[] {
204
				"A.java",
205
				"import java.lang.annotation.Target;\n" + 
206
				"import static java.lang.annotation.ElementType.*;\n" + 
207
				"import java.lang.annotation.Retention;\n" + 
208
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
209
				"@Target(TYPE_USE)\n" + 
210
				"@Retention(RUNTIME)\n" + 
211
				"@interface A {\n" + 
212
				"	String value() default \"default\";\n" + 
213
				"}\n",
214
				"B.java",
215
				"import java.lang.annotation.Target;\n" + 
216
				"import static java.lang.annotation.ElementType.*;\n" + 
217
				"import java.lang.annotation.Retention;\n" + 
218
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
219
				"@Target(TYPE_USE)\n" + 
220
				"@Retention(CLASS)\n" + 
221
				"@interface B {\n" + 
222
				"	int value() default -1;\n" + 
223
				"}",
224
				"C.java",
225
				"import java.lang.annotation.Target;\n" + 
226
				"import static java.lang.annotation.ElementType.*;\n" + 
227
				"import java.lang.annotation.Retention;\n" + 
228
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
229
				"@Target(TYPE_USE)\n" + 
230
				"@Retention(RUNTIME)\n" + 
231
				"@interface C {\n" + 
232
				"	char value() default '-';\n" + 
233
				"}\n",
234
				"I.java",
235
				"interface I {}\n",
236
				"J.java",
237
				"interface J {}\n",
238
				"X.java",
239
				"public class X {\n" + 
240
				"	public boolean foo(String s) {\n" + 
241
				"		boolean b = (s instanceof @C('_') Object);\n" + 
242
				"		Object o = new @B(3) @A(\"new Object\") Object();\n" + 
243
				"		Class<?> c = @B(4) Object.class;\n" + 
244
				"		Class<?> c2 = @A(\"int class literal\")  @B(5) int.class;\n" + 
245
				"		System.out.println(o.toString() + c.toString() + c2.toString());\n" + 
246
				"		return b;\n" + 
247
				"	}\n" + 
248
				"}",
249
		},
250
		"");
251
		String expectedOutput =
252
			"    RuntimeVisibleTypeAnnotations: \n" + 
253
			"      #73 @C(\n" + 
254
			"        #68 value=\'_\' (constant type)\n" + 
255
			"        target type = 0x2 TYPE_INSTANCEOF\n" + 
256
			"        offset = 1\n" + 
257
			"      )\n" + 
258
			"      #75 @A(\n" + 
259
			"        #68 value=\"new Object\" (constant type)\n" + 
260
			"        target type = 0x4 OBJECT_CREATION\n" + 
261
			"        offset = 5\n" + 
262
			"      )\n" + 
263
			"      #75 @A(\n" + 
264
			"        #68 value=\"int class literal\" (constant type)\n" + 
265
			"        target type = 0x1e CLASS_LITERAL\n" + 
266
			"        offset = 17\n" + 
267
			"      )\n" + 
268
			"    RuntimeInvisibleTypeAnnotations: \n" + 
269
			"      #67 @B(\n" + 
270
			"        #68 value=(int) 3 (constant type)\n" + 
271
			"        target type = 0x4 OBJECT_CREATION\n" + 
272
			"        offset = 5\n" + 
273
			"      )\n" + 
274
			"      #67 @B(\n" + 
275
			"        #68 value=(int) 4 (constant type)\n" + 
276
			"        target type = 0x1e CLASS_LITERAL\n" + 
277
			"        offset = 13\n" + 
278
			"      )\n" + 
279
			"      #67 @B(\n" + 
280
			"        #68 value=(int) 5 (constant type)\n" + 
281
			"        target type = 0x1e CLASS_LITERAL\n" + 
282
			"        offset = 17\n" + 
283
			"      )\n";
284
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
285
	}
286
	// class literal generic and array
287
	public void test006() throws Exception {
288
		this.runConformTest(
289
			new String[] {
290
				"A.java",
291
				"import java.lang.annotation.Target;\n" + 
292
				"import static java.lang.annotation.ElementType.*;\n" + 
293
				"import java.lang.annotation.Retention;\n" + 
294
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
295
				"@Target(TYPE_USE)\n" + 
296
				"@Retention(RUNTIME)\n" + 
297
				"@interface A {\n" + 
298
				"	String value() default \"default\";\n" + 
299
				"}\n",
300
				"B.java",
301
				"import java.lang.annotation.Target;\n" + 
302
				"import static java.lang.annotation.ElementType.*;\n" + 
303
				"import java.lang.annotation.Retention;\n" + 
304
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
305
				"@Target(TYPE_USE)\n" + 
306
				"@Retention(CLASS)\n" + 
307
				"@interface B {\n" + 
308
				"	int value() default -1;\n" + 
309
				"}",
310
				"C.java",
311
				"import java.lang.annotation.Target;\n" + 
312
				"import static java.lang.annotation.ElementType.*;\n" + 
313
				"import java.lang.annotation.Retention;\n" + 
314
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
315
				"@Target(TYPE_USE)\n" + 
316
				"@Retention(RUNTIME)\n" + 
317
				"@interface C {\n" + 
318
				"	char value() default '-';\n" + 
319
				"}\n",
320
				"I.java",
321
				"interface I {}\n",
322
				"J.java",
323
				"interface J {}\n",
324
				"X.java",
325
				"public class X {\n" + 
326
				"	public boolean foo(Object o) {\n" + 
327
				"		boolean b = (o instanceof @C('_') Object[]);\n" + 
328
				"		Object o1 = new @B(3) @A(\"new Object\") Object[] {};\n" + 
329
				"		Class<?> c = @B(4) Object[].class;\n" + 
330
				"		Class<?> c2 = @A(\"int class literal\")  @B(5) int[].class;\n" + 
331
				"		System.out.println(o1.toString() + c.toString() + c2.toString());\n" + 
332
				"		return b;\n" + 
333
				"	}\n" + 
334
				"}",
335
		},
336
		"");
337
		String expectedOutput =
338
			"    RuntimeVisibleTypeAnnotations: \n" + 
339
			"      #70 @C(\n" + 
340
			"        #66 value=\'_\' (constant type)\n" + 
341
			"        target type = 0x2 TYPE_INSTANCEOF\n" + 
342
			"        offset = 1\n" + 
343
			"      )\n" + 
344
			"      #72 @A(\n" + 
345
			"        #66 value=\"int class literal\" (constant type)\n" + 
346
			"        target type = 0x1e CLASS_LITERAL\n" + 
347
			"        offset = 14\n" + 
348
			"      )\n" + 
349
			"    RuntimeInvisibleTypeAnnotations: \n" + 
350
			"      #65 @B(\n" + 
351
			"        #66 value=(int) 4 (constant type)\n" + 
352
			"        target type = 0x1e CLASS_LITERAL\n" + 
353
			"        offset = 10\n" + 
354
			"      )\n" + 
355
			"      #65 @B(\n" + 
356
			"        #66 value=(int) 5 (constant type)\n" + 
357
			"        target type = 0x1e CLASS_LITERAL\n" + 
358
			"        offset = 14\n" + 
359
			"      )\n";
360
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
361
	}
362
	// parameterized superclass
363
	public void test007() throws Exception {
364
		this.runConformTest(
365
			new String[] {
366
				"A.java",
367
				"import java.lang.annotation.Target;\n" + 
368
				"import static java.lang.annotation.ElementType.*;\n" + 
369
				"import java.lang.annotation.Retention;\n" + 
370
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
371
				"@Target(TYPE_USE)\n" + 
372
				"@Retention(RUNTIME)\n" + 
373
				"@interface A {\n" + 
374
				"	String value() default \"default\";\n" + 
375
				"}\n",
376
				"B.java",
377
				"import java.lang.annotation.Target;\n" + 
378
				"import static java.lang.annotation.ElementType.*;\n" + 
379
				"import java.lang.annotation.Retention;\n" + 
380
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
381
				"@Target(TYPE_USE)\n" + 
382
				"@Retention(CLASS)\n" + 
383
				"@interface B {\n" + 
384
				"	int value() default -1;\n" + 
385
				"}",
386
				"C.java",
387
				"import java.lang.annotation.Target;\n" + 
388
				"import static java.lang.annotation.ElementType.*;\n" + 
389
				"import java.lang.annotation.Retention;\n" + 
390
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
391
				"@Target(TYPE_USE)\n" + 
392
				"@Retention(RUNTIME)\n" + 
393
				"@interface C {\n" + 
394
				"	char value() default '-';\n" + 
395
				"}\n",
396
				"Y.java",
397
				"class Y<T> {}\n",
398
				"X.java",
399
				"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String> {\n" + 
400
				"}",
401
		},
402
		"");
403
		String expectedOutput =
404
			"  RuntimeVisibleTypeAnnotations: \n" + 
405
			"    #21 @A(\n" + 
406
			"      #22 value=\"Hello, World!\" (constant type)\n" + 
407
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
408
			"      type index = -1\n" + 
409
			"    )\n" + 
410
			"    #24 @C(\n" + 
411
			"      #22 value=\'(\' (constant type)\n" + 
412
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
413
			"      type index = -1\n" + 
414
			"      locations = {0}\n" + 
415
			"    )\n" + 
416
			"  RuntimeInvisibleTypeAnnotations: \n" + 
417
			"    #19 @B(\n" + 
418
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
419
			"      type index = -1\n" + 
420
			"      locations = {0}\n" + 
421
			"    )\n";
422
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
423
	}
424
	public void test008() throws Exception {
425
		this.runConformTest(
426
			new String[] {
427
				"A.java",
428
				"import java.lang.annotation.Target;\n" + 
429
				"import static java.lang.annotation.ElementType.*;\n" + 
430
				"import java.lang.annotation.Retention;\n" + 
431
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
432
				"@Target(TYPE_USE)\n" + 
433
				"@Retention(RUNTIME)\n" + 
434
				"@interface A {\n" + 
435
				"	String value() default \"default\";\n" + 
436
				"}\n",
437
				"B.java",
438
				"import java.lang.annotation.Target;\n" + 
439
				"import static java.lang.annotation.ElementType.*;\n" + 
440
				"import java.lang.annotation.Retention;\n" + 
441
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
442
				"@Target(TYPE_USE)\n" + 
443
				"@Retention(CLASS)\n" + 
444
				"@interface B {\n" + 
445
				"	int value() default -1;\n" + 
446
				"}",
447
				"C.java",
448
				"import java.lang.annotation.Target;\n" + 
449
				"import static java.lang.annotation.ElementType.*;\n" + 
450
				"import java.lang.annotation.Retention;\n" + 
451
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
452
				"@Target(TYPE_USE)\n" + 
453
				"@Retention(RUNTIME)\n" + 
454
				"@interface C {\n" + 
455
				"	char value() default '-';\n" + 
456
				"}\n",
457
				"I.java",
458
				"interface I<T> {}\n",
459
				"J.java",
460
				"interface J<U,T> {}\n",
461
				"X.java",
462
				"public class X implements I<@A(\"Hello, World!\") String>, @B J<String, @C('(') Integer> {}",
463
		},
464
		"");
465
		String expectedOutput =
466
			"  RuntimeVisibleTypeAnnotations: \n" + 
467
			"    #25 @A(\n" + 
468
			"      #26 value=\"Hello, World!\" (constant type)\n" + 
469
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
470
			"      type index = 0\n" + 
471
			"      locations = {0}\n" + 
472
			"    )\n" + 
473
			"    #28 @C(\n" + 
474
			"      #26 value=\'(\' (constant type)\n" + 
475
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
476
			"      type index = 1\n" + 
477
			"      locations = {1}\n" + 
478
			"    )\n" + 
479
			"  RuntimeInvisibleTypeAnnotations: \n" + 
480
			"    #23 @B(\n" + 
481
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
482
			"      type index = 1\n" + 
483
			"    )\n";
484
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
485
	}
486
	// throws
487
	public void test009() throws Exception {
488
		this.runConformTest(
489
			new String[] {
490
				"A.java",
491
				"import java.lang.annotation.Target;\n" + 
492
				"import static java.lang.annotation.ElementType.*;\n" + 
493
				"import java.lang.annotation.Retention;\n" + 
494
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
495
				"@Target(TYPE_USE)\n" + 
496
				"@Retention(RUNTIME)\n" + 
497
				"@interface A {\n" + 
498
				"	String value() default \"default\";\n" + 
499
				"}\n",
500
				"B.java",
501
				"import java.lang.annotation.Target;\n" + 
502
				"import static java.lang.annotation.ElementType.*;\n" + 
503
				"import java.lang.annotation.Retention;\n" + 
504
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
505
				"@Target(TYPE_USE)\n" + 
506
				"@Retention(CLASS)\n" + 
507
				"@interface B {\n" + 
508
				"	int value() default -1;\n" + 
509
				"}",
510
				"C.java",
511
				"import java.lang.annotation.Target;\n" + 
512
				"import static java.lang.annotation.ElementType.*;\n" + 
513
				"import java.lang.annotation.Retention;\n" + 
514
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
515
				"@Target(TYPE_USE)\n" + 
516
				"@Retention(RUNTIME)\n" + 
517
				"@interface C {\n" + 
518
				"	char value() default '-';\n" + 
519
				"}\n",
520
				"E.java",
521
				"class E extends RuntimeException {\n" +
522
				"	private static final long serialVersionUID = 1L;\n" +
523
				"}\n",
524
				"E1.java",
525
				"class E1 extends RuntimeException {\n" +
526
				"	private static final long serialVersionUID = 1L;\n" +
527
				"}\n",
528
				"E2.java",
529
				"class E2 extends RuntimeException {\n" +
530
				"	private static final long serialVersionUID = 1L;\n" +
531
				"}\n",
532
				"X.java",
533
				"public class X {\n" +
534
				"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C('(') E2 {}\n" +
535
				"}",
536
		},
537
		"");
538
		String expectedOutput =
539
			"    RuntimeVisibleTypeAnnotations: \n" + 
540
			"      #25 @A(\n" + 
541
			"        #26 value=\"Hello, World!\" (constant type)\n" + 
542
			"        target type = 0x16 THROWS\n" + 
543
			"        throws index = 0\n" + 
544
			"      )\n" + 
545
			"      #28 @C(\n" + 
546
			"        #26 value=\'(\' (constant type)\n" + 
547
			"        target type = 0x16 THROWS\n" + 
548
			"        throws index = 2\n" + 
549
			"      )\n" + 
550
			"    RuntimeInvisibleTypeAnnotations: \n" + 
551
			"      #23 @B(\n" + 
552
			"        target type = 0x16 THROWS\n" + 
553
			"        throws index = 2\n" + 
554
			"      )\n";
555
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
556
	}
557
	// method receiver
558
	public void test010() throws Exception {
559
		this.runConformTest(
560
			new String[] {
561
				"A.java",
562
				"import java.lang.annotation.Target;\n" + 
563
				"import static java.lang.annotation.ElementType.*;\n" + 
564
				"import java.lang.annotation.Retention;\n" + 
565
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
566
				"@Target(TYPE_USE)\n" + 
567
				"@Retention(RUNTIME)\n" + 
568
				"@interface A {\n" + 
569
				"	String value() default \"default\";\n" + 
570
				"}\n",
571
				"B.java",
572
				"import java.lang.annotation.Target;\n" + 
573
				"import static java.lang.annotation.ElementType.*;\n" + 
574
				"import java.lang.annotation.Retention;\n" + 
575
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
576
				"@Target(TYPE_USE)\n" + 
577
				"@Retention(CLASS)\n" + 
578
				"@interface B {\n" + 
579
				"	int value() default -1;\n" + 
580
				"}",
581
				"X.java",
582
				"public class X {\n" + 
583
				"	void foo() @B(3) {}\n" + 
584
				"}",
585
		},
586
		"");
587
		String expectedOutput =
588
			"    RuntimeInvisibleTypeAnnotations: \n" + 
589
			"      #16 @B(\n" + 
590
			"        #17 value=(int) 3 (constant type)\n" + 
591
			"        target type = 0x6 METHOD_RECEIVER\n" + 
592
			"      )\n";
593
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
594
	}
595
	// method return type
596
	public void test011() throws Exception {
597
		this.runConformTest(
598
			new String[] {
599
				"A.java",
600
				"import java.lang.annotation.Target;\n" + 
601
				"import static java.lang.annotation.ElementType.*;\n" + 
602
				"import java.lang.annotation.Retention;\n" + 
603
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
604
				"@Target(TYPE_USE)\n" + 
605
				"@Retention(RUNTIME)\n" + 
606
				"@interface A {\n" + 
607
				"	String value() default \"default\";\n" + 
608
				"}\n",
609
				"B.java",
610
				"import java.lang.annotation.Target;\n" + 
611
				"import static java.lang.annotation.ElementType.*;\n" + 
612
				"import java.lang.annotation.Retention;\n" + 
613
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
614
				"@Target(TYPE_USE)\n" + 
615
				"@Retention(CLASS)\n" + 
616
				"@interface B {\n" + 
617
				"	int value() default -1;\n" + 
618
				"}",
619
				"X.java",
620
				"public class X {\n" + 
621
				"	@B(3) @A(value=\"test\") int foo() {\n" +
622
				"		return 1;\n" +
623
				"	}\n" + 
624
				"}",
625
		},
626
		"");
627
		String expectedOutput =
628
			"    RuntimeVisibleTypeAnnotations: \n" + 
629
			"      #21 @A(\n" + 
630
			"        #18 value=\"test\" (constant type)\n" + 
631
			"        target type = 0xa METHOD_RETURN_TYPE\n" + 
632
			"      )\n" + 
633
			"    RuntimeInvisibleTypeAnnotations: \n" + 
634
			"      #17 @B(\n" + 
635
			"        #18 value=(int) 3 (constant type)\n" + 
636
			"        target type = 0xa METHOD_RETURN_TYPE\n" + 
637
			"      )\n";
638
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
639
	}
640
	// field type
641
	public void test012() throws Exception {
642
		this.runConformTest(
643
			new String[] {
644
				"A.java",
645
				"import java.lang.annotation.Target;\n" + 
646
				"import static java.lang.annotation.ElementType.*;\n" + 
647
				"import java.lang.annotation.Retention;\n" + 
648
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
649
				"@Target(TYPE_USE)\n" + 
650
				"@Retention(RUNTIME)\n" + 
651
				"@interface A {\n" + 
652
				"	String value() default \"default\";\n" + 
653
				"}\n",
654
				"B.java",
655
				"import java.lang.annotation.Target;\n" + 
656
				"import static java.lang.annotation.ElementType.*;\n" + 
657
				"import java.lang.annotation.Retention;\n" + 
658
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
659
				"@Target(TYPE_USE)\n" + 
660
				"@Retention(CLASS)\n" + 
661
				"@interface B {\n" + 
662
				"	int value() default -1;\n" + 
663
				"}",
664
				"X.java",
665
				"public class X {\n" + 
666
				"	@B(3) @A int field;\n" +
667
				"}",
668
		},
669
		"");
670
		String expectedOutput =
671
			"    RuntimeVisibleTypeAnnotations: \n" + 
672
			"      #12 @A(\n" + 
673
			"        target type = 0xe FIELD\n" + 
674
			"      )\n" + 
675
			"    RuntimeInvisibleTypeAnnotations: \n" + 
676
			"      #8 @B(\n" + 
677
			"        #9 value=(int) 3 (constant type)\n" + 
678
			"        target type = 0xe FIELD\n" + 
679
			"      )\n";
680
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
681
	}
682
	// method parameter
683
	public void test013() throws Exception {
684
		this.runConformTest(
685
			new String[] {
686
				"B.java",
687
				"import java.lang.annotation.Target;\n" + 
688
				"import static java.lang.annotation.ElementType.*;\n" + 
689
				"import java.lang.annotation.Retention;\n" + 
690
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
691
				"@Target(TYPE_USE)\n" + 
692
				"@Retention(CLASS)\n" + 
693
				"@interface B {\n" + 
694
				"	int value() default -1;\n" + 
695
				"}",
696
				"X.java",
697
				"public class X {\n" + 
698
				"	int foo(@B(3) String s) {\n" +
699
				"		return s.length();\n" +
700
				"	}\n" + 
701
				"}",
702
		},
703
		"");
704
		String expectedOutput =
705
			"    RuntimeInvisibleTypeAnnotations: \n" + 
706
			"      #25 @B(\n" + 
707
			"        #26 value=(int) 3 (constant type)\n" + 
708
			"        target type = 0xc METHOD_PARAMETER\n" + 
709
			"        method parameter index = 0\n" + 
710
			"      )\n";
711
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
712
	}
713
	// method parameter generic or array
714
	public void test014() throws Exception {
715
		this.runConformTest(
716
			new String[] {
717
				"A.java",
718
				"import java.lang.annotation.Target;\n" + 
719
				"import static java.lang.annotation.ElementType.*;\n" + 
720
				"import java.lang.annotation.Retention;\n" + 
721
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
722
				"@Target(TYPE_USE)\n" + 
723
				"@Retention(RUNTIME)\n" + 
724
				"@interface A {\n" + 
725
				"	String value() default \"default\";\n" + 
726
				"}\n",
727
				"B.java",
728
				"import java.lang.annotation.Target;\n" + 
729
				"import static java.lang.annotation.ElementType.*;\n" + 
730
				"import java.lang.annotation.Retention;\n" + 
731
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
732
				"@Target(TYPE_USE)\n" + 
733
				"@Retention(CLASS)\n" + 
734
				"@interface B {\n" + 
735
				"	int value() default -1;\n" + 
736
				"}",
737
				"X.java",
738
				"public class X {\n" + 
739
				"	int foo(String @A [] @B(3) [] s) {\n" +
740
				"		return s.length;\n" +
741
				"	}\n" + 
742
				"}",
743
		},
744
		"");
745
		String expectedOutput =
746
			"    RuntimeVisibleTypeAnnotations: \n" + 
747
			"      #23 @A(\n" + 
748
			"        target type = 0xc METHOD_PARAMETER\n" + 
749
			"        method parameter index = 0\n" + 
750
			"      )\n" + 
751
			"    RuntimeInvisibleTypeAnnotations: \n" + 
752
			"      #19 @B(\n" + 
753
			"        #20 value=(int) 3 (constant type)\n" + 
754
			"        target type = 0xd METHOD_PARAMETER_GENERIC_OR_ARRAY\n" + 
755
			"        method parameter index = 0\n" + 
756
			"        locations = {0}\n" + 
757
			"      )\n";
758
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
759
	}
760
	// field type generic or array
761
	public void test015() throws Exception {
762
		this.runConformTest(
763
			new String[] {
764
				"A.java",
765
				"import java.lang.annotation.Target;\n" + 
766
				"import static java.lang.annotation.ElementType.*;\n" + 
767
				"import java.lang.annotation.Retention;\n" + 
768
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
769
				"@Target(TYPE_USE)\n" + 
770
				"@Retention(RUNTIME)\n" + 
771
				"@interface A {\n" + 
772
				"	String value() default \"default\";\n" + 
773
				"}\n",
774
				"B.java",
775
				"import java.lang.annotation.Target;\n" + 
776
				"import static java.lang.annotation.ElementType.*;\n" + 
777
				"import java.lang.annotation.Retention;\n" + 
778
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
779
				"@Target(TYPE_USE)\n" + 
780
				"@Retention(CLASS)\n" + 
781
				"@interface B {\n" + 
782
				"	int value() default -1;\n" + 
783
				"}",
784
				"X.java",
785
				"public class X {\n" + 
786
				"	@A int [] @B(3) [] field;\n" +
787
				"}",
788
		},
789
		"");
790
		String expectedOutput =
791
			"    RuntimeVisibleTypeAnnotations: \n" + 
792
			"      #12 @A(\n" + 
793
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
794
			"        locations = {1}\n" + 
795
			"      )\n" + 
796
			"    RuntimeInvisibleTypeAnnotations: \n" + 
797
			"      #8 @B(\n" + 
798
			"        #9 value=(int) 3 (constant type)\n" + 
799
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
800
			"        locations = {0}\n" + 
801
			"      )\n";
802
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
803
	}
804
	// class type parameter
805
	public void test016() throws Exception {
806
		this.runConformTest(
807
			new String[] {
808
				"A.java",
809
				"import java.lang.annotation.Target;\n" + 
810
				"import static java.lang.annotation.ElementType.*;\n" + 
811
				"import java.lang.annotation.Retention;\n" + 
812
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
813
				"@Target(TYPE_PARAMETER)\n" + 
814
				"@Retention(RUNTIME)\n" + 
815
				"@interface A {\n" + 
816
				"	String value() default \"default\";\n" + 
817
				"}\n",
818
				"B.java",
819
				"import java.lang.annotation.Target;\n" + 
820
				"import static java.lang.annotation.ElementType.*;\n" + 
821
				"import java.lang.annotation.Retention;\n" + 
822
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
823
				"@Target(TYPE_PARAMETER)\n" + 
824
				"@Retention(CLASS)\n" + 
825
				"@interface B {\n" + 
826
				"	int value() default -1;\n" + 
827
				"}",
828
				"X.java",
829
				"public class X<@A @B(3) T> {}",
830
		},
831
		"");
832
		String expectedOutput =
833
			"  RuntimeVisibleTypeAnnotations: \n" + 
834
			"    #25 @A(\n" + 
835
			"      target type = 0x22 CLASS_TYPE_PARAMETER\n" + 
836
			"      type parameter index = 0\n" + 
837
			"    )\n" + 
838
			"  RuntimeInvisibleTypeAnnotations: \n" + 
839
			"    #21 @B(\n" + 
840
			"      #22 value=(int) 3 (constant type)\n" + 
841
			"      target type = 0x22 CLASS_TYPE_PARAMETER\n" + 
842
			"      type parameter index = 0\n" + 
843
			"    )\n";
844
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
845
	}
846
	// method type parameter
847
	public void test017() throws Exception {
848
		this.runConformTest(
849
			new String[] {
850
				"A.java",
851
				"import java.lang.annotation.Target;\n" + 
852
				"import static java.lang.annotation.ElementType.*;\n" + 
853
				"import java.lang.annotation.Retention;\n" + 
854
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
855
				"@Target(TYPE_PARAMETER)\n" + 
856
				"@Retention(RUNTIME)\n" + 
857
				"@interface A {\n" + 
858
				"	String value() default \"default\";\n" + 
859
				"}\n",
860
				"B.java",
861
				"import java.lang.annotation.Target;\n" + 
862
				"import static java.lang.annotation.ElementType.*;\n" + 
863
				"import java.lang.annotation.Retention;\n" + 
864
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
865
				"@Target(TYPE_PARAMETER)\n" + 
866
				"@Retention(CLASS)\n" + 
867
				"@interface B {\n" + 
868
				"	int value() default -1;\n" + 
869
				"}",
870
				"X.java",
871
				"public class X {\n" + 
872
				"	<@A @B(3) T> void foo(T t) {}\n" + 
873
				"}",
874
		},
875
		"");
876
		String expectedOutput =
877
			"    RuntimeVisibleTypeAnnotations: \n" + 
878
			"      #27 @A(\n" + 
879
			"        target type = 0x20 METHOD_TYPE_PARAMETER\n" + 
880
			"        type parameter index = 0\n" + 
881
			"      )\n" + 
882
			"    RuntimeInvisibleTypeAnnotations: \n" + 
883
			"      #23 @B(\n" + 
884
			"        #24 value=(int) 3 (constant type)\n" + 
885
			"        target type = 0x20 METHOD_TYPE_PARAMETER\n" + 
886
			"        type parameter index = 0\n" + 
887
			"      )\n";
888
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
889
	}
890
	// class type parameter bound
891
	public void test018() throws Exception {
892
		this.runConformTest(
893
			new String[] {
894
				"A.java",
895
				"import java.lang.annotation.Target;\n" + 
896
				"import static java.lang.annotation.ElementType.*;\n" + 
897
				"import java.lang.annotation.Retention;\n" + 
898
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
899
				"@Target(TYPE_USE)\n" + 
900
				"@Retention(RUNTIME)\n" + 
901
				"@interface A {\n" + 
902
				"	String value() default \"default\";\n" + 
903
				"}\n",
904
				"B.java",
905
				"import java.lang.annotation.Target;\n" + 
906
				"import static java.lang.annotation.ElementType.*;\n" + 
907
				"import java.lang.annotation.Retention;\n" + 
908
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
909
				"@Target(TYPE_USE)\n" + 
910
				"@Retention(CLASS)\n" + 
911
				"@interface B {\n" + 
912
				"	int value() default -1;\n" + 
913
				"}",
914
				"X.java",
915
				"public class X<T extends @A String & @B(3) Cloneable> {}",
916
		},
917
		"");
918
		String expectedOutput =
919
			"  RuntimeVisibleTypeAnnotations: \n" + 
920
			"    #25 @A(\n" + 
921
			"      target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + 
922
			"      type parameter index = 0 type parameter bound index = 0\n" + 
923
			"    )\n" + 
924
			"  RuntimeInvisibleTypeAnnotations: \n" + 
925
			"    #21 @B(\n" + 
926
			"      #22 value=(int) 3 (constant type)\n" + 
927
			"      target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + 
928
			"      type parameter index = 0 type parameter bound index = 1\n" + 
929
			"    )\n" ;
930
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
931
	}
932
	// class type parameter bound generic or array
933
	public void test019() throws Exception {
934
		this.runConformTest(
935
			new String[] {
936
				"A.java",
937
				"import java.lang.annotation.Target;\n" + 
938
				"import static java.lang.annotation.ElementType.*;\n" + 
939
				"import java.lang.annotation.Retention;\n" + 
940
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
941
				"@Target(TYPE_USE)\n" + 
942
				"@Retention(RUNTIME)\n" + 
943
				"@interface A {\n" + 
944
				"	String value() default \"default\";\n" + 
945
				"}\n",
946
				"B.java",
947
				"import java.lang.annotation.Target;\n" + 
948
				"import static java.lang.annotation.ElementType.*;\n" + 
949
				"import java.lang.annotation.Retention;\n" + 
950
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
951
				"@Target(TYPE_USE)\n" + 
952
				"@Retention(CLASS)\n" + 
953
				"@interface B {\n" + 
954
				"	int value() default -1;\n" + 
955
				"}",
956
				"C.java",
957
				"import java.lang.annotation.Target;\n" + 
958
				"import static java.lang.annotation.ElementType.*;\n" + 
959
				"import java.lang.annotation.Retention;\n" + 
960
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
961
				"@Target(TYPE_USE)\n" + 
962
				"@Retention(RUNTIME)\n" + 
963
				"@interface C {\n" + 
964
				"	char value() default '-';\n" + 
965
				"}\n",
966
				"Y.java",
967
				"public class Y<T> {}",
968
				"X.java",
969
				"public class X<U, T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}",
970
		},
971
		"");
972
		String expectedOutput =
973
			"  RuntimeVisibleTypeAnnotations: \n" + 
974
			"    #25 @A(\n" + 
975
			"      target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
976
			"      type parameter index = 1 type parameter bound index = 0\n" + 
977
			"      locations = {0,2}\n" + 
978
			"    )\n" + 
979
			"    #26 @C(\n" + 
980
			"      target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
981
			"      type parameter index = 1 type parameter bound index = 0\n" + 
982
			"      locations = {0}\n" + 
983
			"    )\n" + 
984
			"  RuntimeInvisibleTypeAnnotations: \n" + 
985
			"    #21 @B(\n" + 
986
			"      target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
987
			"      type parameter index = 1 type parameter bound index = 0\n" + 
988
			"      locations = {0,1}\n" + 
989
			"    )\n" + 
990
			"    #21 @B(\n" + 
991
			"      #22 value=(int) 3 (constant type)\n" + 
992
			"      target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + 
993
			"      type parameter index = 1 type parameter bound index = 1\n" + 
994
			"    )\n";
995
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
996
	}
997
	// method type parameter bound
998
	public void test020() throws Exception {
999
		this.runConformTest(
1000
			new String[] {
1001
				"A.java",
1002
				"import java.lang.annotation.Target;\n" + 
1003
				"import static java.lang.annotation.ElementType.*;\n" + 
1004
				"import java.lang.annotation.Retention;\n" + 
1005
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1006
				"@Target(TYPE_USE)\n" + 
1007
				"@Retention(RUNTIME)\n" + 
1008
				"@interface A {\n" + 
1009
				"	String value() default \"default\";\n" + 
1010
				"}\n",
1011
				"B.java",
1012
				"import java.lang.annotation.Target;\n" + 
1013
				"import static java.lang.annotation.ElementType.*;\n" + 
1014
				"import java.lang.annotation.Retention;\n" + 
1015
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1016
				"@Target(TYPE_USE)\n" + 
1017
				"@Retention(CLASS)\n" + 
1018
				"@interface B {\n" + 
1019
				"	int value() default -1;\n" + 
1020
				"}",
1021
				"Z.java",
1022
				"public class Z {}",
1023
				"X.java",
1024
				"public class X {\n" +
1025
				"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" +
1026
				"}",
1027
		},
1028
		"");
1029
		String expectedOutput =
1030
			"    RuntimeVisibleTypeAnnotations: \n" + 
1031
			"      #27 @A(\n" + 
1032
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1033
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1034
			"      )\n" + 
1035
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1036
			"      #23 @B(\n" + 
1037
			"        #24 value=(int) 3 (constant type)\n" + 
1038
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1039
			"        type parameter index = 0 type parameter bound index = 1\n" + 
1040
			"      )\n";
1041
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1042
	}
1043
	// class type parameter bound generic or array
1044
	public void test021() throws Exception {
1045
		this.runConformTest(
1046
			new String[] {
1047
				"A.java",
1048
				"import java.lang.annotation.Target;\n" + 
1049
				"import static java.lang.annotation.ElementType.*;\n" + 
1050
				"import java.lang.annotation.Retention;\n" + 
1051
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1052
				"@Target(TYPE_USE)\n" + 
1053
				"@Retention(RUNTIME)\n" + 
1054
				"@interface A {\n" + 
1055
				"	String value() default \"default\";\n" + 
1056
				"}\n",
1057
				"B.java",
1058
				"import java.lang.annotation.Target;\n" + 
1059
				"import static java.lang.annotation.ElementType.*;\n" + 
1060
				"import java.lang.annotation.Retention;\n" + 
1061
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1062
				"@Target(TYPE_USE)\n" + 
1063
				"@Retention(CLASS)\n" + 
1064
				"@interface B {\n" + 
1065
				"	int value() default -1;\n" + 
1066
				"}",
1067
				"C.java",
1068
				"import java.lang.annotation.Target;\n" + 
1069
				"import static java.lang.annotation.ElementType.*;\n" + 
1070
				"import java.lang.annotation.Retention;\n" + 
1071
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1072
				"@Target(TYPE_USE)\n" + 
1073
				"@Retention(RUNTIME)\n" + 
1074
				"@interface C {\n" + 
1075
				"	char value() default '-';\n" + 
1076
				"}\n",
1077
				"Z.java",
1078
				"public class Z {}",
1079
				"Y.java",
1080
				"public class Y<T> {}",
1081
				"X.java",
1082
				"public class X {\n" +
1083
				"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" +
1084
				"}",
1085
		},
1086
		"");
1087
		String expectedOutput =
1088
			"    RuntimeVisibleTypeAnnotations: \n" + 
1089
			"      #27 @A(\n" + 
1090
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1091
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1092
			"        locations = {0,2}\n" + 
1093
			"      )\n" + 
1094
			"      #28 @C(\n" + 
1095
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1096
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1097
			"        locations = {0}\n" + 
1098
			"      )\n" + 
1099
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1100
			"      #23 @B(\n" + 
1101
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1102
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1103
			"        locations = {0,1}\n" + 
1104
			"      )\n" + 
1105
			"      #23 @B(\n" + 
1106
			"        #24 value=(int) 3 (constant type)\n" + 
1107
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1108
			"        type parameter index = 0 type parameter bound index = 1\n" + 
1109
			"      )\n";
1110
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1111
	}
1112
	// local variable + generic or array
1113
	public void test022() throws Exception {
1114
		this.runConformTest(
1115
			new String[] {
1116
				"A.java",
1117
				"import java.lang.annotation.Target;\n" + 
1118
				"import static java.lang.annotation.ElementType.*;\n" + 
1119
				"import java.lang.annotation.Retention;\n" + 
1120
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1121
				"@Target(TYPE_USE)\n" + 
1122
				"@Retention(RUNTIME)\n" + 
1123
				"@interface A {\n" + 
1124
				"	String value() default \"default\";\n" + 
1125
				"}\n",
1126
				"B.java",
1127
				"import java.lang.annotation.Target;\n" + 
1128
				"import static java.lang.annotation.ElementType.*;\n" + 
1129
				"import java.lang.annotation.Retention;\n" + 
1130
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1131
				"@Target(TYPE_USE)\n" + 
1132
				"@Retention(CLASS)\n" + 
1133
				"@interface B {\n" + 
1134
				"	int value() default -1;\n" + 
1135
				"}",
1136
				"C.java",
1137
				"import java.lang.annotation.Target;\n" + 
1138
				"import static java.lang.annotation.ElementType.*;\n" + 
1139
				"import java.lang.annotation.Retention;\n" + 
1140
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1141
				"@Target(TYPE_USE)\n" + 
1142
				"@Retention(RUNTIME)\n" + 
1143
				"@interface C {\n" + 
1144
				"	char value() default '-';\n" + 
1145
				"}\n",
1146
				"X.java",
1147
				"public class X {\n" + 
1148
				"	String[][] bar() {\n" + 
1149
				"		return new String[][] {};" +
1150
				"	}\n" + 
1151
				"	void foo(String s) {\n" + 
1152
				"		@C int i;\n" + 
1153
				"		@A String [] @B(3)[] tab = bar();\n" + 
1154
				"		if (tab != null) {\n" + 
1155
				"			i = 0;\n" + 
1156
				"			System.out.println(i + tab.length);\n" + 
1157
				"		} else {\n" + 
1158
				"			System.out.println(tab.length);\n" + 
1159
				"		}\n" + 
1160
				"		i = 4;\n" + 
1161
				"		System.out.println(-i + tab.length);\n" + 
1162
				"	}\n" + 
1163
				"}",
1164
		},
1165
		"");
1166
		String expectedOutput =
1167
			"    RuntimeVisibleTypeAnnotations: \n" + 
1168
			"      #49 @C(\n" + 
1169
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
1170
			"        local variable entries:\n" + 
1171
			"          [pc: 11, pc: 24] index: 2\n" + 
1172
			"          [pc: 34, pc: 46] index: 2\n" + 
1173
			"      )\n" + 
1174
			"      #50 @A(\n" + 
1175
			"        target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1176
			"        local variable entries:\n" + 
1177
			"          [pc: 5, pc: 46] index: 3\n" + 
1178
			"        locations = {1}\n" + 
1179
			"      )\n" + 
1180
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1181
			"      #45 @B(\n" + 
1182
			"        #46 value=(int) 3 (constant type)\n" + 
1183
			"        target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1184
			"        local variable entries:\n" + 
1185
			"          [pc: 5, pc: 46] index: 3\n" + 
1186
			"        locations = {0}\n" + 
1187
			"      )\n";
1188
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1189
	}
1190
	// type argument constructor call
1191
	public void test023() throws Exception {
1192
		this.runConformTest(
1193
			new String[] {
1194
				"A.java",
1195
				"import java.lang.annotation.Target;\n" + 
1196
				"import static java.lang.annotation.ElementType.*;\n" + 
1197
				"import java.lang.annotation.Retention;\n" + 
1198
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1199
				"@Target(TYPE_USE)\n" + 
1200
				"@Retention(RUNTIME)\n" + 
1201
				"@interface A {\n" + 
1202
				"	String value() default \"default\";\n" + 
1203
				"}\n",
1204
				"B.java",
1205
				"import java.lang.annotation.Target;\n" + 
1206
				"import static java.lang.annotation.ElementType.*;\n" + 
1207
				"import java.lang.annotation.Retention;\n" + 
1208
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1209
				"@Target(TYPE_USE)\n" + 
1210
				"@Retention(CLASS)\n" + 
1211
				"@interface B {\n" + 
1212
				"	int value() default -1;\n" + 
1213
				"}",
1214
				"X.java",
1215
				"public class X {\n" + 
1216
				"	<T> X(T t) {\n" + 
1217
				"	}\n" + 
1218
				"	public Object foo() {\n" + 
1219
				"		X x = new <@A @B(1) String>X(null);\n" + 
1220
				"		return x;\n" + 
1221
				"	}\n" + 
1222
				"}",
1223
		},
1224
		"");
1225
		String expectedOutput =
1226
			"    RuntimeVisibleTypeAnnotations: \n" + 
1227
			"      #31 @A(\n" + 
1228
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1229
			"        offset = 5\n" + 
1230
			"        type argument index = 0\n" + 
1231
			"      )\n" + 
1232
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1233
			"      #27 @B(\n" + 
1234
			"        #28 value=(int) 1 (constant type)\n" + 
1235
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1236
			"        offset = 5\n" + 
1237
			"        type argument index = 0\n" + 
1238
			"      )\n";
1239
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1240
	}
1241
	// type argument constructor call generic or array
1242
	public void test024() throws Exception {
1243
		this.runConformTest(
1244
			new String[] {
1245
				"A.java",
1246
				"import java.lang.annotation.Target;\n" + 
1247
				"import static java.lang.annotation.ElementType.*;\n" + 
1248
				"import java.lang.annotation.Retention;\n" + 
1249
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1250
				"@Target(TYPE_USE)\n" + 
1251
				"@Retention(RUNTIME)\n" + 
1252
				"@interface A {\n" + 
1253
				"	String value() default \"default\";\n" + 
1254
				"}\n",
1255
				"B.java",
1256
				"import java.lang.annotation.Target;\n" + 
1257
				"import static java.lang.annotation.ElementType.*;\n" + 
1258
				"import java.lang.annotation.Retention;\n" + 
1259
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1260
				"@Target(TYPE_USE)\n" + 
1261
				"@Retention(CLASS)\n" + 
1262
				"@interface B {\n" + 
1263
				"	int value() default -1;\n" + 
1264
				"}",
1265
				"C.java",
1266
				"import java.lang.annotation.Target;\n" + 
1267
				"import static java.lang.annotation.ElementType.*;\n" + 
1268
				"import java.lang.annotation.Retention;\n" + 
1269
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1270
				"@Target(TYPE_USE)\n" + 
1271
				"@Retention(RUNTIME)\n" + 
1272
				"@interface C {\n" + 
1273
				"	char value() default '-';\n" + 
1274
				"}\n",
1275
				"X.java",
1276
				"public class X {\n" + 
1277
				"	<T, U> X(T t, U u) {\n" + 
1278
				"	}\n" + 
1279
				"	public Object foo() {\n" + 
1280
				"		X x = new <@A Integer, @A String @C [] @B(1)[]>X(null, null);\n" + 
1281
				"		return x;\n" + 
1282
				"	}\n" + 
1283
				"}",
1284
		},
1285
		"");
1286
		String expectedOutput =
1287
			"    RuntimeVisibleTypeAnnotations: \n" + 
1288
			"      #33 @A(\n" + 
1289
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1290
			"        offset = 6\n" + 
1291
			"        type argument index = 0\n" + 
1292
			"      )\n" + 
1293
			"      #33 @A(\n" + 
1294
			"        target type = 0x19 TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY\n" + 
1295
			"        offset = 6\n" + 
1296
			"        type argument index = 1\n" + 
1297
			"        locations = {1}\n" + 
1298
			"      )\n" + 
1299
			"      #34 @C(\n" + 
1300
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1301
			"        offset = 6\n" + 
1302
			"        type argument index = 1\n" + 
1303
			"      )\n" + 
1304
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1305
			"      #29 @B(\n" + 
1306
			"        #30 value=(int) 1 (constant type)\n" + 
1307
			"        target type = 0x19 TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY\n" + 
1308
			"        offset = 6\n" + 
1309
			"        type argument index = 1\n" + 
1310
			"        locations = {0}\n" + 
1311
			"      )\n";
1312
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1313
	}
1314
	// type argument method call
1315
	public void test025() throws Exception {
1316
		this.runConformTest(
1317
			new String[] {
1318
				"X.java",
1319
				"public class X {\n" +
1320
				"\n" +
1321
				"	static <T, U> T foo(T t, U u) {\n" +
1322
				"		return t;\n" +
1323
				"	}\n" +
1324
				"	public static void main(String[] args) {\n" +
1325
				"		System.out.println(X.<@A @B(1) String[], @C('-') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" +
1326
				"	}\n" +
1327
				"}\n",
1328
				"A.java",
1329
				"import java.lang.annotation.Target;\n" + 
1330
				"import static java.lang.annotation.ElementType.*;\n" + 
1331
				"import java.lang.annotation.Retention;\n" + 
1332
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1333
				"@Target(TYPE_USE)\n" + 
1334
				"@Retention(RUNTIME)\n" + 
1335
				"@interface A {\n" + 
1336
				"	String value() default \"default\";\n" + 
1337
				"}\n",
1338
				"B.java",
1339
				"import java.lang.annotation.Target;\n" + 
1340
				"import static java.lang.annotation.ElementType.*;\n" + 
1341
				"import java.lang.annotation.Retention;\n" + 
1342
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1343
				"@Target(TYPE_USE)\n" + 
1344
				"@Retention(CLASS)\n" + 
1345
				"@interface B {\n" + 
1346
				"	int value() default -1;\n" + 
1347
				"}",
1348
				"C.java",
1349
				"import java.lang.annotation.Target;\n" + 
1350
				"import static java.lang.annotation.ElementType.*;\n" + 
1351
				"import java.lang.annotation.Retention;\n" + 
1352
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1353
				"@Target(TYPE_USE)\n" + 
1354
				"@Retention(RUNTIME)\n" + 
1355
				"@interface C {\n" + 
1356
				"	char value() default '-';\n" + 
1357
				"}\n",
1358
		},
1359
		"SUCCESS");
1360
		String expectedOutput =
1361
			"    RuntimeVisibleTypeAnnotations: \n" + 
1362
			"      #52 @A(\n" + 
1363
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
1364
			"        offset = 13\n" + 
1365
			"        type argument index = 0\n" + 
1366
			"      )\n" + 
1367
			"      #53 @C(\n" + 
1368
			"        #49 value=\'-\' (constant type)\n" + 
1369
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
1370
			"        offset = 13\n" + 
1371
			"        type argument index = 1\n" + 
1372
			"      )\n" + 
1373
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1374
			"      #48 @B(\n" + 
1375
			"        #49 value=(int) 1 (constant type)\n" + 
1376
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
1377
			"        offset = 13\n" + 
1378
			"        type argument index = 0\n" + 
1379
			"      )\n";
1380
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1381
	}
1382
	// check locations
1383
	public void test026() throws Exception {
1384
		this.runConformTest(
1385
			new String[] {
1386
				"X.java",
1387
				"import java.util.Map;\n" +
1388
				"import java.util.List;\n" +
1389
				"public class X {\n" + 
1390
				"	@H String @E[] @F[] @G[] field;\n" + 
1391
				"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
1392
				"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
1393
				"}",
1394
				"A.java",
1395
				"import java.lang.annotation.Target;\n" + 
1396
				"import static java.lang.annotation.ElementType.*;\n" + 
1397
				"import java.lang.annotation.Retention;\n" + 
1398
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1399
				"@Target(TYPE_USE)\n" + 
1400
				"@Retention(RUNTIME)\n" + 
1401
				"@interface A {\n" + 
1402
				"	String value() default \"default\";\n" + 
1403
				"}\n",
1404
				"B.java",
1405
				"import java.lang.annotation.Target;\n" + 
1406
				"import static java.lang.annotation.ElementType.*;\n" + 
1407
				"import java.lang.annotation.Retention;\n" + 
1408
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1409
				"@Target(TYPE_USE)\n" + 
1410
				"@Retention(CLASS)\n" + 
1411
				"@interface B {\n" + 
1412
				"	int value() default -1;\n" + 
1413
				"}",
1414
				"C.java",
1415
				"import java.lang.annotation.Target;\n" + 
1416
				"import static java.lang.annotation.ElementType.*;\n" + 
1417
				"import java.lang.annotation.Retention;\n" + 
1418
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1419
				"@Target(TYPE_USE)\n" + 
1420
				"@Retention(RUNTIME)\n" + 
1421
				"@interface C {\n" + 
1422
				"	char value() default '-';\n" + 
1423
				"}\n",
1424
				"D.java",
1425
				"import java.lang.annotation.Target;\n" + 
1426
				"import static java.lang.annotation.ElementType.*;\n" + 
1427
				"import java.lang.annotation.Retention;\n" + 
1428
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1429
				"@Target(TYPE_USE)\n" + 
1430
				"@Retention(RUNTIME)\n" + 
1431
				"@interface D {\n" + 
1432
				"	String value() default \"default\";\n" + 
1433
				"}\n",
1434
				"E.java",
1435
				"import java.lang.annotation.Target;\n" + 
1436
				"import static java.lang.annotation.ElementType.*;\n" + 
1437
				"import java.lang.annotation.Retention;\n" + 
1438
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1439
				"@Target(TYPE_USE)\n" + 
1440
				"@Retention(CLASS)\n" + 
1441
				"@interface E {\n" + 
1442
				"	int value() default -1;\n" + 
1443
				"}",
1444
				"F.java",
1445
				"import java.lang.annotation.Target;\n" + 
1446
				"import static java.lang.annotation.ElementType.*;\n" + 
1447
				"import java.lang.annotation.Retention;\n" + 
1448
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1449
				"@Target(TYPE_USE)\n" + 
1450
				"@Retention(RUNTIME)\n" + 
1451
				"@interface F {\n" + 
1452
				"	char value() default '-';\n" + 
1453
				"}\n",
1454
				"G.java",
1455
				"import java.lang.annotation.Target;\n" + 
1456
				"import static java.lang.annotation.ElementType.*;\n" + 
1457
				"import java.lang.annotation.Retention;\n" + 
1458
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1459
				"@Target(TYPE_USE)\n" + 
1460
				"@Retention(CLASS)\n" + 
1461
				"@interface G {\n" + 
1462
				"	int value() default -1;\n" + 
1463
				"}",
1464
				"H.java",
1465
				"import java.lang.annotation.Target;\n" + 
1466
				"import static java.lang.annotation.ElementType.*;\n" + 
1467
				"import java.lang.annotation.Retention;\n" + 
1468
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1469
				"@Target(TYPE_USE)\n" + 
1470
				"@Retention(RUNTIME)\n" + 
1471
				"@interface H {\n" + 
1472
				"	char value() default '-';\n" + 
1473
				"}\n",
1474
		},
1475
		"");
1476
		String expectedOutput =
1477
			"  // Field descriptor #6 [[[Ljava/lang/String;\n" + 
1478
			"  java.lang.String[][][] field;\n" + 
1479
			"    RuntimeVisibleTypeAnnotations: \n" + 
1480
			"      #11 @H(\n" + 
1481
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1482
			"        locations = {2}\n" + 
1483
			"      )\n" + 
1484
			"      #12 @F(\n" + 
1485
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1486
			"        locations = {0}\n" + 
1487
			"      )\n" + 
1488
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1489
			"      #8 @E(\n" + 
1490
			"        target type = 0xe FIELD\n" + 
1491
			"      )\n" + 
1492
			"      #9 @G(\n" + 
1493
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1494
			"        locations = {1}\n" + 
1495
			"      )\n" + 
1496
			"  \n" + 
1497
			"  // Field descriptor #14 Ljava/util/Map;\n" + 
1498
			"  // Signature: Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Object;>;>;\n" + 
1499
			"  java.util.Map field2;\n" + 
1500
			"    RuntimeVisibleTypeAnnotations: \n" + 
1501
			"      #18 @A(\n" + 
1502
			"        target type = 0xe FIELD\n" + 
1503
			"      )\n" + 
1504
			"      #19 @C(\n" + 
1505
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1506
			"        locations = {1}\n" + 
1507
			"      )\n" + 
1508
			"      #20 @D(\n" + 
1509
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1510
			"        locations = {1,0}\n" + 
1511
			"      )\n" + 
1512
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1513
			"      #17 @B(\n" + 
1514
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1515
			"        locations = {0}\n" + 
1516
			"      )\n" + 
1517
			"  \n" + 
1518
			"  // Field descriptor #14 Ljava/util/Map;\n" + 
1519
			"  // Signature: Ljava/util/Map<Ljava/lang/String;[[[Ljava/lang/String;>;\n" + 
1520
			"  java.util.Map field3;\n" + 
1521
			"    RuntimeVisibleTypeAnnotations: \n" + 
1522
			"      #18 @A(\n" + 
1523
			"        target type = 0xe FIELD\n" + 
1524
			"      )\n" + 
1525
			"      #11 @H(\n" + 
1526
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1527
			"        locations = {1,2}\n" + 
1528
			"      )\n" + 
1529
			"      #12 @F(\n" + 
1530
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1531
			"        locations = {1,0}\n" + 
1532
			"      )\n" + 
1533
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1534
			"      #17 @B(\n" + 
1535
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1536
			"        locations = {0}\n" + 
1537
			"      )\n" + 
1538
			"      #8 @E(\n" + 
1539
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1540
			"        locations = {1}\n" + 
1541
			"      )\n" + 
1542
			"      #9 @G(\n" + 
1543
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1544
			"        locations = {1,1}\n" + 
1545
			"      )\n";
1546
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1547
	}
1548
	// check locations
1549
	public void test027() throws Exception {
1550
		this.runConformTest(
1551
			new String[] {
1552
				"X.java",
1553
				"public class X {\n" + 
1554
				"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
1555
				"}",
1556
				"E.java",
1557
				"import java.lang.annotation.Target;\n" + 
1558
				"import static java.lang.annotation.ElementType.*;\n" + 
1559
				"import java.lang.annotation.Retention;\n" + 
1560
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1561
				"@Target(TYPE_USE)\n" + 
1562
				"@Retention(CLASS)\n" + 
1563
				"@interface E {\n" + 
1564
				"	int value() default -1;\n" + 
1565
				"}",
1566
				"F.java",
1567
				"import java.lang.annotation.Target;\n" + 
1568
				"import static java.lang.annotation.ElementType.*;\n" + 
1569
				"import java.lang.annotation.Retention;\n" + 
1570
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1571
				"@Target(TYPE_USE)\n" + 
1572
				"@Retention(RUNTIME)\n" + 
1573
				"@interface F {\n" + 
1574
				"	char value() default '-';\n" + 
1575
				"}\n",
1576
				"G.java",
1577
				"import java.lang.annotation.Target;\n" + 
1578
				"import static java.lang.annotation.ElementType.*;\n" + 
1579
				"import java.lang.annotation.Retention;\n" + 
1580
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1581
				"@Target(TYPE_USE)\n" + 
1582
				"@Retention(CLASS)\n" + 
1583
				"@interface G {\n" + 
1584
				"	int value() default -1;\n" + 
1585
				"}",
1586
				"H.java",
1587
				"import java.lang.annotation.Target;\n" + 
1588
				"import static java.lang.annotation.ElementType.*;\n" + 
1589
				"import java.lang.annotation.Retention;\n" + 
1590
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1591
				"@Target(TYPE_USE)\n" + 
1592
				"@Retention(RUNTIME)\n" + 
1593
				"@interface H {\n" + 
1594
				"	char value() default '-';\n" + 
1595
				"}\n",
1596
		},
1597
		"");
1598
		String expectedOutput =
1599
			"    RuntimeVisibleTypeAnnotations: \n" + 
1600
			"      #11 @H(\n" + 
1601
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1602
			"        locations = {2}\n" + 
1603
			"      )\n" + 
1604
			"      #12 @F(\n" + 
1605
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1606
			"        locations = {0}\n" + 
1607
			"      )\n" + 
1608
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1609
			"      #8 @E(\n" + 
1610
			"        target type = 0xe FIELD\n" + 
1611
			"      )\n" + 
1612
			"      #9 @G(\n" + 
1613
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1614
			"        locations = {1}\n" + 
1615
			"      )\n";
1616
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1617
	}
1618
	// cast
1619
	public void test028() throws Exception {
1620
		this.runConformTest(
1621
			new String[] {
1622
				"A.java",
1623
				"import java.lang.annotation.Target;\n" + 
1624
				"import static java.lang.annotation.ElementType.*;\n" + 
1625
				"import java.lang.annotation.Retention;\n" + 
1626
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1627
				"@Target(TYPE_USE)\n" + 
1628
				"@Retention(RUNTIME)\n" + 
1629
				"@interface A {\n" + 
1630
				"	String value() default \"default\";\n" + 
1631
				"}\n",
1632
				"B.java",
1633
				"import java.lang.annotation.Target;\n" + 
1634
				"import static java.lang.annotation.ElementType.*;\n" + 
1635
				"import java.lang.annotation.Retention;\n" + 
1636
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1637
				"@Target(TYPE_USE)\n" + 
1638
				"@Retention(CLASS)\n" + 
1639
				"@interface B {\n" + 
1640
				"	int value() default -1;\n" + 
1641
				"}",
1642
				"C.java",
1643
				"import java.lang.annotation.Target;\n" + 
1644
				"import static java.lang.annotation.ElementType.*;\n" + 
1645
				"import java.lang.annotation.Retention;\n" + 
1646
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1647
				"@Target(TYPE_USE)\n" + 
1648
				"@Retention(RUNTIME)\n" + 
1649
				"@interface C {\n" + 
1650
				"	char value() default '-';\n" + 
1651
				"}\n",
1652
				"I.java",
1653
				"interface I {}\n",
1654
				"J.java",
1655
				"interface J {}\n",
1656
				"X.java",
1657
				"public class X {\n" + 
1658
				"	public void foo(Object o) {\n" + 
1659
				"		if (o instanceof String[][]) {\n" +
1660
				"			String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" +
1661
				"			System.out.println(tab.length);\n" +
1662
				"		}\n" + 
1663
				"		System.out.println(o);\n" +
1664
				"	}\n" + 
1665
				"}",
1666
		},
1667
		"");
1668
		String expectedOutput =
1669
			"    RuntimeVisibleTypeAnnotations: \n" + 
1670
			"      #41 @C(\n" + 
1671
			"        #38 value=\'_\' (constant type)\n" + 
1672
			"        target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + 
1673
			"        offset = 8\n" + 
1674
			"        locations = {1}\n" + 
1675
			"      )\n" + 
1676
			"      #43 @A(\n" + 
1677
			"        target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + 
1678
			"        offset = 8\n" + 
1679
			"        locations = {0}\n" + 
1680
			"      )\n" + 
1681
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1682
			"      #37 @B(\n" + 
1683
			"        #38 value=(int) 3 (constant type)\n" + 
1684
			"        target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + 
1685
			"        offset = 8\n" + 
1686
			"        locations = {1}\n" + 
1687
			"      )\n";
1688
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1689
	}
1690
	// qualified allocation expression with type arguments
1691
	public void test029() throws Exception {
1692
		this.runConformTest(
1693
			new String[] {
1694
				"A.java",
1695
				"import java.lang.annotation.Target;\n" + 
1696
				"import static java.lang.annotation.ElementType.*;\n" + 
1697
				"import java.lang.annotation.Retention;\n" + 
1698
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1699
				"@Target(TYPE_USE)\n" + 
1700
				"@Retention(RUNTIME)\n" + 
1701
				"@interface A {\n" + 
1702
				"	String value() default \"default\";\n" + 
1703
				"}\n",
1704
				"B.java",
1705
				"import java.lang.annotation.Target;\n" + 
1706
				"import static java.lang.annotation.ElementType.*;\n" + 
1707
				"import java.lang.annotation.Retention;\n" + 
1708
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1709
				"@Target(TYPE_USE)\n" + 
1710
				"@Retention(CLASS)\n" + 
1711
				"@interface B {\n" + 
1712
				"	int value() default -1;\n" + 
1713
				"}",
1714
				"C.java",
1715
				"import java.lang.annotation.Target;\n" + 
1716
				"import static java.lang.annotation.ElementType.*;\n" + 
1717
				"import java.lang.annotation.Retention;\n" + 
1718
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1719
				"@Target(TYPE_USE)\n" + 
1720
				"@Retention(RUNTIME)\n" + 
1721
				"@interface C {\n" + 
1722
				"	char value() default '-';\n" + 
1723
				"}\n",
1724
				"D.java",
1725
				"import java.lang.annotation.Target;\n" + 
1726
				"import static java.lang.annotation.ElementType.*;\n" + 
1727
				"import java.lang.annotation.Retention;\n" + 
1728
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1729
				"@Target(TYPE_USE)\n" + 
1730
				"@Retention(RUNTIME)\n" + 
1731
				"@interface D {\n" + 
1732
				"	char value() default '-';\n" + 
1733
				"}\n",
1734
				"X.java",
1735
				"public class X {\n" + 
1736
				"	class Y {\n" + 
1737
				"		<T, U> Y(T t, U u) {}\n" + 
1738
				"	}\n" + 
1739
				"	public static void main(String[] args) {\n" + 
1740
				"		Y y = new X().new <@D() @A(value = \"hello\") String, @B X> Y(\"SUCCESS\", null);\n" + 
1741
				"		System.out.println(y);\n" + 
1742
				"	}\n" + 
1743
				"}",
1744
		},
1745
		"");
1746
		String expectedOutput =
1747
			"    RuntimeVisibleTypeAnnotations: \n" + 
1748
			"      #47 @D(\n" + 
1749
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1750
			"        offset = 19\n" + 
1751
			"        type argument index = 0\n" + 
1752
			"      )\n" + 
1753
			"      #48 @A(\n" + 
1754
			"        #49 value=\"hello\" (constant type)\n" + 
1755
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1756
			"        offset = 19\n" + 
1757
			"        type argument index = 0\n" + 
1758
			"      )\n" + 
1759
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1760
			"      #45 @B(\n" + 
1761
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1762
			"        offset = 19\n" + 
1763
			"        type argument index = 1\n" + 
1764
			"      )\n";
1765
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1766
	}
1767
	// local + wildcard
1768
	// qualified allocation expression with type arguments
1769
	public void test030() throws Exception {
1770
		this.runConformTest(
1771
			new String[] {
1772
				"A.java",
1773
				"import java.lang.annotation.Target;\n" + 
1774
				"import static java.lang.annotation.ElementType.*;\n" + 
1775
				"import java.lang.annotation.Retention;\n" + 
1776
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1777
				"@Target(TYPE_USE)\n" + 
1778
				"@Retention(RUNTIME)\n" + 
1779
				"@interface A {\n" + 
1780
				"	String value() default \"default\";\n" + 
1781
				"}\n",
1782
				"B.java",
1783
				"import java.lang.annotation.Target;\n" + 
1784
				"import static java.lang.annotation.ElementType.*;\n" + 
1785
				"import java.lang.annotation.Retention;\n" + 
1786
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1787
				"@Target(TYPE_USE)\n" + 
1788
				"@Retention(CLASS)\n" + 
1789
				"@interface B {\n" + 
1790
				"	int value() default -1;\n" + 
1791
				"}",
1792
				"C.java",
1793
				"import java.lang.annotation.Target;\n" + 
1794
				"import static java.lang.annotation.ElementType.*;\n" + 
1795
				"import java.lang.annotation.Retention;\n" + 
1796
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1797
				"@Target(TYPE_USE)\n" + 
1798
				"@Retention(RUNTIME)\n" + 
1799
				"@interface C {\n" + 
1800
				"	char value() default '-';\n" + 
1801
				"}\n",
1802
				"D.java",
1803
				"import java.lang.annotation.Target;\n" + 
1804
				"import static java.lang.annotation.ElementType.*;\n" + 
1805
				"import java.lang.annotation.Retention;\n" + 
1806
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1807
				"@Target(TYPE_USE)\n" + 
1808
				"@Retention(RUNTIME)\n" + 
1809
				"@interface D {\n" + 
1810
				"	char value() default '-';\n" + 
1811
				"}\n",
1812
				"X.java",
1813
				"import java.util.Map;\n" +
1814
				"import java.util.HashMap;\n" +
1815
				"@SuppressWarnings({\"unchecked\",\"rawtypes\"})\n" + 
1816
				"public class X {\n" + 
1817
				"	Object newMap(Object o) {\n" + 
1818
				"		Map<@A Object, ? super @C Map<@B String, @D Comparable>> map;\n" + 
1819
				"		if (o == null) {\n" + 
1820
				"			map = null;\n" + 
1821
				"			System.out.println(map);\n" + 
1822
				"		} else {\n" + 
1823
				"			System.out.println(\"No map yet\");\n" + 
1824
				"		}\n" + 
1825
				"		map = new HashMap();\n" + 
1826
				"		return map;\n" + 
1827
				"	} \n" + 
1828
				"}",
1829
		},
1830
		"");
1831
		String expectedOutput =
1832
			"    RuntimeVisibleTypeAnnotations: \n" + 
1833
			"      #46 @A(\n" + 
1834
			"        target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1835
			"        local variable entries:\n" + 
1836
			"          [pc: 6, pc: 16] index: 2\n" + 
1837
			"          [pc: 32, pc: 34] index: 2\n" + 
1838
			"        locations = {0}\n" + 
1839
			"      )\n" + 
1840
			"      #47 @C(\n" + 
1841
			"        target type = 0x1c WILDCARD_BOUND\n" + 
1842
			"        wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1843
			"          local variable entries:\n" + 
1844
			"                [pc: 6, pc: 16] index: 2\n" + 
1845
			"                [pc: 32, pc: 34] index: 2\n" + 
1846
			"              wildcard locations = {1}\n" + 
1847
			"      )\n" + 
1848
			"      #48 @D(\n" + 
1849
			"        target type = 0x1d WILDCARD_BOUND_GENERIC_OR_ARRAY\n" + 
1850
			"        wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1851
			"          local variable entries:\n" + 
1852
			"                [pc: 6, pc: 16] index: 2\n" + 
1853
			"                [pc: 32, pc: 34] index: 2\n" + 
1854
			"              wildcard locations = {1}\n" + 
1855
			"        locations = {1}\n" + 
1856
			"      )\n" + 
1857
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1858
			"      #44 @B(\n" + 
1859
			"        target type = 0x1d WILDCARD_BOUND_GENERIC_OR_ARRAY\n" + 
1860
			"        wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1861
			"          local variable entries:\n" + 
1862
			"                [pc: 6, pc: 16] index: 2\n" + 
1863
			"                [pc: 32, pc: 34] index: 2\n" + 
1864
			"              wildcard locations = {1}\n" + 
1865
			"        locations = {0}\n" + 
1866
			"      )\n";
1867
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1868
	}
1869
	// method type parameter bound generic or array
1870
	public void test031() throws Exception {
1871
		this.runConformTest(
1872
			new String[] {
1873
				"A.java",
1874
				"import java.lang.annotation.Target;\n" + 
1875
				"import static java.lang.annotation.ElementType.*;\n" + 
1876
				"import java.lang.annotation.Retention;\n" + 
1877
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1878
				"@Target(TYPE_USE)\n" + 
1879
				"@Retention(RUNTIME)\n" + 
1880
				"@interface A {\n" + 
1881
				"	String value() default \"default\";\n" + 
1882
				"}\n",
1883
				"B.java",
1884
				"import java.lang.annotation.Target;\n" + 
1885
				"import static java.lang.annotation.ElementType.*;\n" + 
1886
				"import java.lang.annotation.Retention;\n" + 
1887
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1888
				"@Target(TYPE_USE)\n" + 
1889
				"@Retention(CLASS)\n" + 
1890
				"@interface B {\n" + 
1891
				"	int value() default -1;\n" + 
1892
				"}",
1893
				"C.java",
1894
				"import java.lang.annotation.Target;\n" + 
1895
				"import static java.lang.annotation.ElementType.*;\n" + 
1896
				"import java.lang.annotation.Retention;\n" + 
1897
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1898
				"@Target(TYPE_USE)\n" + 
1899
				"@Retention(CLASS)\n" + 
1900
				"@interface C {\n" + 
1901
				"	int value() default -1;\n" + 
1902
				"}",
1903
				"D.java",
1904
				"import java.lang.annotation.Target;\n" + 
1905
				"import static java.lang.annotation.ElementType.*;\n" + 
1906
				"import java.lang.annotation.Retention;\n" + 
1907
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1908
				"@Target(TYPE_PARAMETER)\n" + 
1909
				"@Retention(RUNTIME)\n" + 
1910
				"@interface D {\n" + 
1911
				"	String value() default \"default\";\n" + 
1912
				"}\n",
1913
				"Z.java",
1914
				"public class Z<T> {}",
1915
				"X.java",
1916
				"public class X {\n" +
1917
				"	<@D U, T extends Z<@A String @C[][]@B[]> & @B(3) Cloneable> void foo(U u, T t) {}\n" +
1918
				"}",
1919
		},
1920
		"");
1921
		String expectedOutput =
1922
			"    RuntimeVisibleTypeAnnotations: \n" + 
1923
			"      #31 @D(\n" + 
1924
			"        target type = 0x20 METHOD_TYPE_PARAMETER\n" + 
1925
			"        type parameter index = 0\n" + 
1926
			"      )\n" + 
1927
			"      #32 @A(\n" + 
1928
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1929
			"        type parameter index = 1 type parameter bound index = 0\n" + 
1930
			"        locations = {0,2}\n" + 
1931
			"      )\n" + 
1932
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1933
			"      #26 @C(\n" + 
1934
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1935
			"        type parameter index = 1 type parameter bound index = 0\n" + 
1936
			"        locations = {0}\n" + 
1937
			"      )\n" + 
1938
			"      #27 @B(\n" + 
1939
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1940
			"        type parameter index = 1 type parameter bound index = 0\n" + 
1941
			"        locations = {0,1}\n" + 
1942
			"      )\n" + 
1943
			"      #27 @B(\n" + 
1944
			"        #28 value=(int) 3 (constant type)\n" + 
1945
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1946
			"        type parameter index = 1 type parameter bound index = 1\n" + 
1947
			"      )\n";
1948
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1949
	}
1950
	// type argument method call and generic or array
1951
	public void test032() throws Exception {
1952
		this.runConformTest(
1953
			new String[] {
1954
				"X.java",
1955
				"public class X {\n" +
1956
				"\n" +
1957
				"	static <T, U> T foo(T t, U u) {\n" +
1958
				"		return t;\n" +
1959
				"	}\n" +
1960
				"	public static void bar() {\n" +
1961
				"		System.out.println(X.<@A String[] @B(1) [], @C('-') X>foo(new String[][]{{\"SUCCESS\"}}, null)[0]);\n" +
1962
				"	}\n" +
1963
				"}\n",
1964
				"A.java",
1965
				"import java.lang.annotation.Target;\n" + 
1966
				"import static java.lang.annotation.ElementType.*;\n" + 
1967
				"import java.lang.annotation.Retention;\n" + 
1968
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1969
				"@Target(TYPE_USE)\n" + 
1970
				"@Retention(RUNTIME)\n" + 
1971
				"@interface A {\n" + 
1972
				"	String value() default \"default\";\n" + 
1973
				"}\n",
1974
				"B.java",
1975
				"import java.lang.annotation.Target;\n" + 
1976
				"import static java.lang.annotation.ElementType.*;\n" + 
1977
				"import java.lang.annotation.Retention;\n" + 
1978
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1979
				"@Target(TYPE_USE)\n" + 
1980
				"@Retention(CLASS)\n" + 
1981
				"@interface B {\n" + 
1982
				"	int value() default -1;\n" + 
1983
				"}",
1984
				"C.java",
1985
				"import java.lang.annotation.Target;\n" + 
1986
				"import static java.lang.annotation.ElementType.*;\n" + 
1987
				"import java.lang.annotation.Retention;\n" + 
1988
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1989
				"@Target(TYPE_USE)\n" + 
1990
				"@Retention(RUNTIME)\n" + 
1991
				"@interface C {\n" + 
1992
				"	char value() default '-';\n" + 
1993
				"}\n",
1994
		},
1995
		"");
1996
		String expectedOutput =
1997
			"    RuntimeVisibleTypeAnnotations: \n" + 
1998
			"      #52 @A(\n" + 
1999
			"        target type = 0x1b TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY\n" + 
2000
			"        offset = 20\n" + 
2001
			"        type argument index = 0\n" + 
2002
			"        locations = {1}\n" + 
2003
			"      )\n" + 
2004
			"      #53 @C(\n" + 
2005
			"        #49 value=\'-\' (constant type)\n" + 
2006
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
2007
			"        offset = 20\n" + 
2008
			"        type argument index = 1\n" + 
2009
			"      )\n" + 
2010
			"    RuntimeInvisibleTypeAnnotations: \n" + 
2011
			"      #48 @B(\n" + 
2012
			"        #49 value=(int) 1 (constant type)\n" + 
2013
			"        target type = 0x1b TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY\n" + 
2014
			"        offset = 20\n" + 
2015
			"        type argument index = 0\n" + 
2016
			"        locations = {0}\n" + 
2017
			"      )\n";
2018
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2019
	}
2020
	// superclass
2021
	public void test033() throws Exception {
2022
		this.runConformTest(
2023
			new String[] {
2024
				"Marker.java",
2025
				"@interface Marker {}",
2026
				"X.java",
2027
				"public class X extends @Marker Object {}",
2028
			},
2029
			"");
2030
	}
2031
	// superclass
2032
	public void test034() throws Exception {
2033
		this.runNegativeTest(
2034
			new String[] {
2035
				"Marker.java",
2036
				"import java.lang.annotation.Target;\n" + 
2037
				"import static java.lang.annotation.ElementType.*;\n" + 
2038
				"@Target(TYPE_PARAMETER)\n" + 
2039
				"@interface Marker {}",
2040
				"X.java",
2041
				"public class X extends @Marker Object {}",
2042
			},
2043
			"----------\n" + 
2044
			"1. ERROR in X.java (at line 1)\n" + 
2045
			"	public class X extends @Marker Object {}\n" + 
2046
			"	                       ^^^^^^^\n" + 
2047
			"The annotation @Marker is disallowed for this location\n" + 
2048
			"----------\n");
2049
	}
2050
	// annotation on catch variable
2051
	public void test035() throws Exception {
2052
		this.runConformTest(
2053
			new String[] {
2054
				"X.java",
2055
				"import java.lang.annotation.Target;\n" + 
2056
				"import java.lang.annotation.Retention;\n" + 
2057
				"import static java.lang.annotation.ElementType.*;\n" + 
2058
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2059
				"public class X {\n" + 
2060
				"	public static void main(String[] args) {\n" + 
2061
				"		@A Exception test = new Exception() {\n" +
2062
				"			private static final long serialVersionUID = 1L;\n" +
2063
				"			@Override\n" +
2064
				"			public String toString() {\n" +
2065
				"				return \"SUCCESS\";\n" +
2066
				"			}\n" +
2067
				"		};\n" + 
2068
				"		try {\n" + 
2069
				"			System.out.println(test);\n" + 
2070
				"		} catch(@A Exception e) {\n" + 
2071
				"			e.printStackTrace();\n" + 
2072
				"		}\n" + 
2073
				"	}\n" + 
2074
				"}",
2075
				"A.java",
2076
				"import java.lang.annotation.Target;\n" + 
2077
				"import static java.lang.annotation.ElementType.*;\n" + 
2078
				"import java.lang.annotation.Retention;\n" + 
2079
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2080
				"@Target(TYPE_USE)\n" + 
2081
				"@Retention(RUNTIME)\n" + 
2082
				"@interface A {\n" + 
2083
				"	String value() default \"default\";\n" + 
2084
				"}\n",
2085
		},
2086
		"SUCCESS");
2087
		String expectedOutput =
2088
			"    RuntimeVisibleTypeAnnotations: \n" + 
2089
			"      #44 @A(\n" + 
2090
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2091
			"        local variable entries:\n" + 
2092
			"          [pc: 8, pc: 24] index: 1\n" + 
2093
			"      )\n" + 
2094
			"      #44 @A(\n" + 
2095
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2096
			"        local variable entries:\n" + 
2097
			"          [pc: 19, pc: 23] index: 2\n" + 
2098
			"      )\n";
2099
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2100
	}
2101
	// annotation on catch variable
2102
	public void test036() throws Exception {
2103
		this.runConformTest(
2104
			new String[] {
2105
				"X.java",
2106
				"import java.lang.annotation.Target;\n" + 
2107
				"import java.lang.annotation.Retention;\n" + 
2108
				"import static java.lang.annotation.ElementType.*;\n" + 
2109
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2110
				"public class X {\n" + 
2111
				"	public static void main(String[] args) {\n" + 
2112
				"		@B int j = 9;\n" + 
2113
				"		try {\n" + 
2114
				"			System.out.print(\"SUCCESS\" + j);\n" + 
2115
				"		} catch(@A Exception e) {\n" + 
2116
				"		}\n" + 
2117
				"		@B int k = 3;\n" + 
2118
				"		System.out.println(k);\n" + 
2119
				"	}\n" + 
2120
				"}",
2121
				"A.java",
2122
				"import java.lang.annotation.Target;\n" + 
2123
				"import static java.lang.annotation.ElementType.*;\n" + 
2124
				"import java.lang.annotation.Retention;\n" + 
2125
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2126
				"@Target(TYPE_USE)\n" + 
2127
				"@Retention(RUNTIME)\n" + 
2128
				"@interface A {\n" + 
2129
				"	String value() default \"default\";\n" + 
2130
				"}\n",
2131
				"B.java",
2132
				"import java.lang.annotation.Target;\n" + 
2133
				"import static java.lang.annotation.ElementType.*;\n" + 
2134
				"import java.lang.annotation.Retention;\n" + 
2135
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2136
				"@Target(TYPE_USE)\n" + 
2137
				"@Retention(CLASS)\n" + 
2138
				"@interface B {\n" + 
2139
				"	String value() default \"default\";\n" + 
2140
				"}\n",
2141
		},
2142
		"SUCCESS93");
2143
		String expectedOutput =
2144
			"    RuntimeInvisibleTypeAnnotations: \n" + 
2145
			"      #56 @B(\n" + 
2146
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2147
			"        local variable entries:\n" + 
2148
			"          [pc: 3, pc: 39] index: 1\n" + 
2149
			"      )\n" + 
2150
			"      #56 @B(\n" + 
2151
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2152
			"        local variable entries:\n" + 
2153
			"          [pc: 31, pc: 39] index: 2\n" + 
2154
			"      )\n";
2155
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2156
	}
2157
	// make sure annotation without target appears twice when set on a method declaration
2158
	public void test037() throws Exception {
2159
		this.runConformTest(
2160
			new String[] {
2161
				"X.java",
2162
				"import java.lang.annotation.Target;\r\n" + 
2163
				"import static java.lang.annotation.ElementType.*;\r\n" + 
2164
				"\r\n" + 
2165
				"@Target(METHOD)\r\n" + 
2166
				"@interface Annot {\r\n" + 
2167
				"	int value() default 0;\r\n" + 
2168
				"}\r\n" + 
2169
				"public class X {\r\n" + 
2170
				"	@Annot(4)\r\n" + 
2171
				"	public void foo() {\r\n" + 
2172
				"	}\r\n" + 
2173
				"}",
2174
		},
2175
		"");
2176
		String expectedOutput =
2177
			"  public void foo();\n" + 
2178
			"    0  return\n" + 
2179
			"      Line numbers:\n" + 
2180
			"        [pc: 0, line: 11]\n" + 
2181
			"      Local variable table:\n" + 
2182
			"        [pc: 0, pc: 1] local: this index: 0 type: X\n" + 
2183
			"    RuntimeInvisibleAnnotations: \n" + 
2184
			"      #16 @Annot(\n" + 
2185
			"        #17 value=(int) 4 (constant type)\n" + 
2186
			"      )\n" + 
2187
			"}";
2188
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2189
	}
2190
	// make sure annotation without target appears twice when set on a method declaration
2191
	public void test038() throws Exception {
2192
		this.runConformTest(
2193
			new String[] {
2194
				"X.java",
2195
				"@interface Annot {\r\n" + 
2196
				"	int value() default 0;\r\n" + 
2197
				"}\r\n" + 
2198
				"public class X {\r\n" + 
2199
				"	@Annot(4)\r\n" + 
2200
				"	public void foo() {\r\n" + 
2201
				"	}\r\n" + 
2202
				"}",
2203
		},
2204
		"");
2205
		String expectedOutput =
2206
			"  // Method descriptor #6 ()V\n" + 
2207
			"  // Stack: 0, Locals: 1\n" + 
2208
			"  public void foo();\n" + 
2209
			"    0  return\n" + 
2210
			"      Line numbers:\n" + 
2211
			"        [pc: 0, line: 7]\n" + 
2212
			"      Local variable table:\n" + 
2213
			"        [pc: 0, pc: 1] local: this index: 0 type: X\n" + 
2214
			"    RuntimeInvisibleAnnotations: \n" + 
2215
			"      #16 @Annot(\n" + 
2216
			"        #17 value=(int) 4 (constant type)\n" + 
2217
			"      )\n" + 
2218
			"}";
2219
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2220
	}
2221
	// make sure annotation without target appears twice when set on a method declaration
2222
	public void test039() throws Exception {
2223
		this.runConformTest(
2224
			new String[] {
2225
				"X.java",
2226
				"@interface Annot {\r\n" + 
2227
				"	int value() default 0;\r\n" + 
2228
				"}\r\n" + 
2229
				"public class X {\r\n" + 
2230
				"	@Annot(4)\r\n" + 
2231
				"	public int foo() {\r\n" + 
2232
				"		return 0;\r\n" + 
2233
				"	}\r\n" + 
2234
				"}",
2235
		},
2236
		"");
2237
		String expectedOutput =
2238
			"  public int foo();\n" + 
2239
			"    0  iconst_0\n" + 
2240
			"    1  ireturn\n" + 
2241
			"      Line numbers:\n" + 
2242
			"        [pc: 0, line: 7]\n" + 
2243
			"      Local variable table:\n" + 
2244
			"        [pc: 0, pc: 2] local: this index: 0 type: X\n" + 
2245
			"    RuntimeInvisibleAnnotations: \n" + 
2246
			"      #17 @Annot(\n" + 
2247
			"        #18 value=(int) 4 (constant type)\n" + 
2248
			"      )\n" + 
2249
			"    RuntimeInvisibleTypeAnnotations: \n" + 
2250
			"      #17 @Annot(\n" + 
2251
			"        #18 value=(int) 4 (constant type)\n" + 
2252
			"        target type = 0xa METHOD_RETURN_TYPE\n" + 
2253
			"      )\n" + 
2254
			"}";
2255
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2256
	}
2257
	// make sure annotation without target appears twice when set on a method declaration
2258
	public void test040() throws Exception {
2259
		this.runConformTest(
2260
			new String[] {
2261
				"X.java",
2262
				"import java.lang.annotation.Target;\r\n" + 
2263
				"import static java.lang.annotation.ElementType.*;\r\n" + 
2264
				"\r\n" + 
2265
				"@Target(METHOD)\r\n" + 
2266
				"@interface Annot {\r\n" + 
2267
				"	int value() default 0;\r\n" + 
2268
				"}\r\n" + 
2269
				"public class X {\r\n" + 
2270
				"	@Annot(4)\r\n" + 
2271
				"	public int foo() {\r\n" + 
2272
				"		return 0;\r\n" + 
2273
				"	}\r\n" + 
2274
				"}",
2275
		},
2276
		"");
2277
		String expectedOutput =
2278
			"  public int foo();\n" + 
2279
			"    0  iconst_0\n" + 
2280
			"    1  ireturn\n" + 
2281
			"      Line numbers:\n" + 
2282
			"        [pc: 0, line: 11]\n" + 
2283
			"      Local variable table:\n" + 
2284
			"        [pc: 0, pc: 2] local: this index: 0 type: X\n" + 
2285
			"    RuntimeInvisibleAnnotations: \n" + 
2286
			"      #17 @Annot(\n" + 
2287
			"        #18 value=(int) 4 (constant type)\n" + 
2288
			"      )\n" + 
2289
			"}";
2290
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2291
	}
2292
}
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2011 IBM Corporation and others.
2
 * Copyright (c) 2005, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 33-39 Link Here
33
	// Static initializer to specify tests subset using TESTS_* static variables
33
	// Static initializer to specify tests subset using TESTS_* static variables
34
	// All specified tests which does not belong to the class are skipped...
34
	// All specified tests which does not belong to the class are skipped...
35
	static {
35
	static {
36
//		TESTS_NAMES = new String[] { "test000" };
36
		TESTS_NAMES = new String[] { "test064" };
37
//		TESTS_NUMBERS = new int[] { 61 };
37
//		TESTS_NUMBERS = new int[] { 61 };
38
//		TESTS_RANGE = new int[] { 11, -1 };
38
//		TESTS_RANGE = new int[] { 11, -1 };
39
	}
39
	}
(-)a/org.eclipse.jdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/readableNames.properties (+10 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2012 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
###############################################################################
1
,opt=,
11
,opt=,
2
AbstractMethodDeclaration=AbstractMethodDeclaration
12
AbstractMethodDeclaration=AbstractMethodDeclaration
3
AdditionalBound1=AdditionalBound1
13
AdditionalBound1=AdditionalBound1
(-)a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java (-1 / +8 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 55-60 Link Here
55
public TypeReference copyDims(int dim){
59
public TypeReference copyDims(int dim){
56
	return this;
60
	return this;
57
}
61
}
62
public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){
63
	return this;
64
}
58
protected TypeBinding getTypeBinding(Scope scope) {
65
protected TypeBinding getTypeBinding(Scope scope) {
59
	// it can be a package, type or member type
66
	// it can be a package, type or member type
60
	Binding binding = scope.parent.getTypeOrPackage(this.tokens); // step up from the ClassScope
67
	Binding binding = scope.parent.getTypeOrPackage(this.tokens); // step up from the ClassScope
(-)a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java (-1 / +11 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 55-60 Link Here
55
public TypeReference copyDims(int dim){
59
public TypeReference copyDims(int dim){
56
	return this;
60
	return this;
57
}
61
}
62
/*
63
 * No expansion of the completion reference into an array one
64
 */
65
public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){
66
	return this;
67
}
58
protected TypeBinding getTypeBinding(Scope scope) {
68
protected TypeBinding getTypeBinding(Scope scope) {
59
    if (this.fieldTypeCompletionNode != null) {
69
    if (this.fieldTypeCompletionNode != null) {
60
		throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope);
70
		throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope);
(-)a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (-7 / +67 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 1156-1164 Link Here
1156
				if(info == LESS && node instanceof TypeReference) {
1160
				if(info == LESS && node instanceof TypeReference) {
1157
					if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
1161
					if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
1158
						if (consumeTypeArguments) consumeTypeArguments();
1162
						if (consumeTypeArguments) consumeTypeArguments();
1159
						TypeReference ref = this.getTypeReference(0);
1163
						TypeReference ref;
1160
						if(prevKind == K_PARAMETERIZED_CAST) {
1164
						if(prevKind == K_PARAMETERIZED_CAST) {
1165
							ref = this.getUnannotatedTypeReference(0);  // by design type is not annotated.
1161
							ref = computeQualifiedGenericsFromRightSide(ref, 0);
1166
							ref = computeQualifiedGenericsFromRightSide(ref, 0);
1167
						} else {
1168
							ref = this.getTypeReference(0);
1162
						}
1169
						}
1163
						if(this.currentElement instanceof RecoveredType) {
1170
						if(this.currentElement instanceof RecoveredType) {
1164
							this.currentElement = this.currentElement.add(new CompletionOnFieldType(ref, false), 0);
1171
							this.currentElement = this.currentElement.add(new CompletionOnFieldType(ref, false), 0);
Lines 1360-1366 Link Here
1360
		if ((length = this.identifierLengthStack[this.identifierLengthPtr-1]) < 0) {
1367
		if ((length = this.identifierLengthStack[this.identifierLengthPtr-1]) < 0) {
1361
			// build the primitive type node
1368
			// build the primitive type node
1362
			int dim = isAfterArrayType() ? this.intStack[this.intPtr--] : 0;
1369
			int dim = isAfterArrayType() ? this.intStack[this.intPtr--] : 0;
1363
			SingleTypeReference typeRef = (SingleTypeReference)TypeReference.baseTypeReference(-length, dim);
1370
			Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
1371
			SingleTypeReference typeRef = (SingleTypeReference)TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
1364
			typeRef.sourceStart = this.intStack[this.intPtr--];
1372
			typeRef.sourceStart = this.intStack[this.intPtr--];
1365
			if (dim == 0) {
1373
			if (dim == 0) {
1366
				typeRef.sourceEnd = this.intStack[this.intPtr--];
1374
				typeRef.sourceEnd = this.intStack[this.intPtr--];
Lines 2589-2594 Link Here
2589
	}
2597
	}
2590
}
2598
}
2591
protected void consumeFormalParameter(boolean isVarArgs) {
2599
protected void consumeFormalParameter(boolean isVarArgs) {
2600
	
2601
	this.invocationType = NO_RECEIVER;
2602
	this.qualifier = -1;
2603
	
2592
	if (this.indexOfAssistIdentifier() < 0) {
2604
	if (this.indexOfAssistIdentifier() < 0) {
2593
		super.consumeFormalParameter(isVarArgs);
2605
		super.consumeFormalParameter(isVarArgs);
2594
		if (this.pendingAnnotation != null) {
2606
		if (this.pendingAnnotation != null) {
Lines 2606-2615 Link Here
2606
			endOfEllipsis = this.intStack[this.intPtr--];
2618
			endOfEllipsis = this.intStack[this.intPtr--];
2607
		}
2619
		}
2608
		int firstDimensions = this.intStack[this.intPtr--];
2620
		int firstDimensions = this.intStack[this.intPtr--];
2609
		final int typeDimensions = firstDimensions + extendedDimensions;
2621
		TypeReference type = getUnannotatedTypeReference(extendedDimensions);
2610
		TypeReference type = getTypeReference(typeDimensions);
2622
		Annotation [] varArgsAnnotations = null;
2623
		int length;
2624
		if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
2625
			System.arraycopy(
2626
				this.typeAnnotationStack,
2627
				(this.typeAnnotationPtr -= length) + 1,
2628
				varArgsAnnotations = new Annotation[length],
2629
				0,
2630
				length);
2631
		} 
2632
		final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
2633
		if (typeDimensions != extendedDimensions) {
2634
			// jsr308 type annotations management
2635
			Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
2636
			Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
2637
			Annotation [][] annotationsOnAllDimensions = null;
2638
			if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
2639
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
2640
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
2641
			}
2642
			type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
2643
			type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
2644
		}
2611
		if (isVarArgs) {
2645
		if (isVarArgs) {
2612
			type = copyDims(type, typeDimensions + 1);
2613
			if (extendedDimensions == 0) {
2646
			if (extendedDimensions == 0) {
2614
				type.sourceEnd = endOfEllipsis;
2647
				type.sourceEnd = endOfEllipsis;
2615
			}
2648
			}
Lines 2623-2629 Link Here
2623
				type,
2656
				type,
2624
				this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
2657
				this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
2625
		// consume annotations
2658
		// consume annotations
2626
		int length;
2627
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2659
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2628
			System.arraycopy(
2660
			System.arraycopy(
2629
				this.expressionStack,
2661
				this.expressionStack,
Lines 2725-2730 Link Here
2725
	}
2757
	}
2726
	pushOnElementStack(K_CAST_STATEMENT);
2758
	pushOnElementStack(K_CAST_STATEMENT);
2727
}
2759
}
2760
protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() {
2761
	popElement(K_PARAMETERIZED_CAST);
2762
2763
	Expression castType;
2764
	int end = this.intStack[this.intPtr--];
2765
2766
	int dim = this.intStack[this.intPtr--];
2767
	// TODO is it an annotated type reference?
2768
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2769
2770
	castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
2771
	this.intPtr--;
2772
	castType.sourceEnd = end - 1;
2773
	castType.sourceStart = this.intStack[this.intPtr--] + 1;
2774
	pushOnExpressionStack(castType);
2775
2776
	pushOnElementStack(K_CAST_STATEMENT);
2777
}
2728
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
2778
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
2729
	popElement(K_PARAMETERIZED_CAST);
2779
	popElement(K_PARAMETERIZED_CAST);
2730
2780
Lines 2732-2738 Link Here
2732
	int end = this.intStack[this.intPtr--];
2782
	int end = this.intStack[this.intPtr--];
2733
2783
2734
	int dim = this.intStack[this.intPtr--];
2784
	int dim = this.intStack[this.intPtr--];
2735
	TypeReference rightSide = getTypeReference(0);
2785
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2736
2786
2737
	castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
2787
	castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
2738
	this.intPtr--;
2788
	this.intPtr--;
Lines 4384-4389 Link Here
4384
	}
4434
	}
4385
	return result;
4435
	return result;
4386
}
4436
}
4437
protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation[][] annotationsOnDimensions) {
4438
	if (this.assistNode == typeRef) {
4439
		return typeRef;
4440
	}
4441
	TypeReference result = super.copyDims(typeRef, dim, annotationsOnDimensions);
4442
	if (this.assistNodeParent == typeRef) {
4443
		this.assistNodeParent = result;
4444
	}
4445
	return result;
4446
}
4387
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) {
4447
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) {
4388
4448
4389
	this.cursorLocation = cursorLoc;
4449
	this.cursorLocation = cursorLoc;
(-)a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java (-3 / +10 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 897-909 Link Here
897
/*
901
/*
898
 * Build specific type reference nodes in case the cursor is located inside the type reference
902
 * Build specific type reference nodes in case the cursor is located inside the type reference
899
 */
903
 */
900
protected TypeReference getTypeReference(int dim) {
904
protected TypeReference getUnannotatedTypeReference(int dim) {
901
905
902
	int index;
906
	int index;
903
907
904
	/* no need to take action if not inside completed identifiers */
908
	/* no need to take action if not inside completed identifiers */
905
	if ((index = indexOfAssistIdentifier(true)) < 0) {
909
	if ((index = indexOfAssistIdentifier(true)) < 0) {
906
		return super.getTypeReference(dim);
910
		return super.getUnannotatedTypeReference(dim);
907
	}
911
	}
908
	int length = this.identifierLengthStack[this.identifierLengthPtr];
912
	int length = this.identifierLengthStack[this.identifierLengthPtr];
909
	TypeReference reference;
913
	TypeReference reference;
Lines 1627-1632 Link Here
1627
	this.astLengthPtr = -1;
1631
	this.astLengthPtr = -1;
1628
	this.expressionPtr = -1;
1632
	this.expressionPtr = -1;
1629
	this.expressionLengthPtr = -1;
1633
	this.expressionLengthPtr = -1;
1634
	this.unattachedAnnotationPtr = -1;
1635
	this.typeAnnotationLengthPtr = -1;
1636
	this.typeAnnotationPtr = -1;
1630
	this.identifierPtr = -1;
1637
	this.identifierPtr = -1;
1631
	this.identifierLengthPtr	= -1;
1638
	this.identifierLengthPtr	= -1;
1632
	this.intPtr = -1;
1639
	this.intPtr = -1;
(-)a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java (-5 / +29 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 606-615 Link Here
606
			endOfEllipsis = this.intStack[this.intPtr--];
610
			endOfEllipsis = this.intStack[this.intPtr--];
607
		}
611
		}
608
		int firstDimensions = this.intStack[this.intPtr--];
612
		int firstDimensions = this.intStack[this.intPtr--];
609
		final int typeDimensions = firstDimensions + extendedDimensions;
613
		TypeReference type = getUnannotatedTypeReference(extendedDimensions);
610
		TypeReference type = getTypeReference(typeDimensions);
614
		Annotation [] varArgsAnnotations = null;
615
		int length;
616
		if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
617
			System.arraycopy(
618
				this.typeAnnotationStack,
619
				(this.typeAnnotationPtr -= length) + 1,
620
				varArgsAnnotations = new Annotation[length],
621
				0,
622
				length);
623
		} 
624
		final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
625
		if (typeDimensions != extendedDimensions) {
626
			// jsr308 type annotations management
627
			Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
628
			Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
629
			Annotation [][] annotationsOnAllDimensions = null;
630
			if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
631
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
632
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
633
			}
634
			type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
635
			type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
636
		}
611
		if (isVarArgs) {
637
		if (isVarArgs) {
612
			type = copyDims(type, typeDimensions + 1);
613
			if (extendedDimensions == 0) {
638
			if (extendedDimensions == 0) {
614
				type.sourceEnd = endOfEllipsis;
639
				type.sourceEnd = endOfEllipsis;
615
			}
640
			}
Lines 626-632 Link Here
626
		arg.declarationSourceStart = modifierPositions;
651
		arg.declarationSourceStart = modifierPositions;
627
652
628
		// consume annotations
653
		// consume annotations
629
		int length;
630
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
654
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
631
			System.arraycopy(
655
			System.arraycopy(
632
				this.expressionStack,
656
				this.expressionStack,
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java (-1 / +10 lines)
Lines 1291-1297 Link Here
1291
	int UnusedWarningToken = Internal + 635;
1291
	int UnusedWarningToken = Internal + 635;
1292
	/** @since 3.6 */
1292
	/** @since 3.6 */
1293
	int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636;
1293
	int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636;
1294
1294
	/** @since 3.9 */
1295
    int InvalidUsageOfTypeAnnotations = Syntax + Internal + 637;
1296
    /** @since 3.9 */
1297
    int InvalidUsageOfReceiverAnnotations = Syntax + Internal + 638;
1298
    /** @since 3.9 */
1299
    int MisplacedTypeAnnotations = Syntax + Internal + 639;
1300
    /** @since 3.9 */
1301
    int InvalidLocationForModifiers = Syntax + Internal + 640;
1302
    /** @since 3.9*/
1303
    int IllegalUsageOfTypeAnnotations = Internal + Syntax + 641;
1295
	/**
1304
	/**
1296
	 * More problems in generics
1305
	 * More problems in generics
1297
	 */
1306
	 */
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java (-1 / +69 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 49-54 Link Here
49
		// do nothing by default
53
		// do nothing by default
50
	}
54
	}
51
	public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
55
	public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
56
		// do nothing by default
57
	}
58
	public void endVisit(ArrayInitializer arrayInitializer, ClassScope scope) {
52
		// do nothing by default
59
		// do nothing by default
53
	}
60
	}
54
	public void endVisit(
61
	public void endVisit(
Lines 271-280 Link Here
271
		// do nothing by default
278
		// do nothing by default
272
	}
279
	}
273
	/**
280
	/**
281
	 * @param annotation
282
	 * @param scope
283
	 * @since 3.1
284
	 */
285
	public void endVisit(MarkerAnnotation annotation, ClassScope scope) {
286
		// do nothing by default
287
	}
288
	/**
274
	 * @param pair
289
	 * @param pair
275
	 * @param scope
290
	 * @param scope
276
	 */
291
	 */
277
	public void endVisit(MemberValuePair pair, BlockScope scope) {
292
	public void endVisit(MemberValuePair pair, BlockScope scope) {
293
		// do nothing by default
294
	}
295
	/**
296
	 * @param pair
297
	 * @param scope
298
	 */
299
	public void endVisit(MemberValuePair pair, ClassScope scope) {
278
		// do nothing by default
300
		// do nothing by default
279
	}
301
	}
280
	public void endVisit(MessageSend messageSend, BlockScope scope) {
302
	public void endVisit(MessageSend messageSend, BlockScope scope) {
Lines 292-297 Link Here
292
	 * @since 3.1
314
	 * @since 3.1
293
	 */
315
	 */
294
	public void endVisit(NormalAnnotation annotation, BlockScope scope) {
316
	public void endVisit(NormalAnnotation annotation, BlockScope scope) {
317
		// do nothing by default
318
	}
319
	public void endVisit(NormalAnnotation annotation, ClassScope scope) {
295
		// do nothing by default
320
		// do nothing by default
296
	}
321
	}
297
	public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
322
	public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
Lines 372-377 Link Here
372
	 * @since 3.1
397
	 * @since 3.1
373
	 */
398
	 */
374
	public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) {
399
	public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) {
400
		// do nothing by default
401
	}
402
	/**
403
	 * @param annotation
404
	 * @param scope
405
	 * @since 3.1
406
	 */
407
	public void endVisit(SingleMemberAnnotation annotation, ClassScope scope) {
375
		// do nothing by default
408
		// do nothing by default
376
	}
409
	}
377
	public void endVisit(
410
	public void endVisit(
Lines 491-496 Link Here
491
		return true; // do nothing by default, keep traversing
524
		return true; // do nothing by default, keep traversing
492
	}
525
	}
493
	public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
526
	public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
527
		return true; // do nothing by default, keep traversing
528
	}
529
	public boolean visit(ArrayInitializer arrayInitializer, ClassScope scope) {
494
		return true; // do nothing by default, keep traversing
530
		return true; // do nothing by default, keep traversing
495
	}
531
	}
496
	public boolean visit(
532
	public boolean visit(
Lines 713-723 Link Here
713
		return true;
749
		return true;
714
	}
750
	}
715
	/**
751
	/**
752
	 * @param annotation
753
	 * @param scope
754
	 * @since 3.1
755
	 */
756
	public boolean visit(MarkerAnnotation annotation, ClassScope scope) {
757
		return true;
758
	}
759
	/**
716
	 * @param pair
760
	 * @param pair
717
	 * @param scope
761
	 * @param scope
718
	 * @since 3.1
762
	 * @since 3.1
719
	 */
763
	 */
720
	public boolean visit(MemberValuePair pair, BlockScope scope) {
764
	public boolean visit(MemberValuePair pair, BlockScope scope) {
765
		return true;
766
	}
767
	/**
768
	 * @param pair
769
	 * @param scope
770
	 * @since 3.1
771
	 */
772
	public boolean visit(MemberValuePair pair, ClassScope scope) {
721
		return true;
773
		return true;
722
	}
774
	}
723
	public boolean visit(MessageSend messageSend, BlockScope scope) {
775
	public boolean visit(MessageSend messageSend, BlockScope scope) {
Lines 737-742 Link Here
737
	 * @since 3.1
789
	 * @since 3.1
738
	 */
790
	 */
739
	public boolean visit(NormalAnnotation annotation, BlockScope scope) {
791
	public boolean visit(NormalAnnotation annotation, BlockScope scope) {
792
		return true;
793
	}
794
	/**
795
	 * @param annotation
796
	 * @param scope
797
	 * @since 3.1
798
	 */
799
	public boolean visit(NormalAnnotation annotation, ClassScope scope) {
740
		return true;
800
		return true;
741
	}
801
	}
742
	public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
802
	public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
Lines 819-824 Link Here
819
	public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
879
	public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
820
		return true;
880
		return true;
821
	}
881
	}
882
	/**
883
	 * @param annotation
884
	 * @param scope
885
	 * @since 3.1
886
	 */
887
	public boolean visit(SingleMemberAnnotation annotation, ClassScope scope) {
888
		return true;
889
	}
822
	public boolean visit(
890
	public boolean visit(
823
		SingleNameReference singleNameReference,
891
		SingleNameReference singleNameReference,
824
		BlockScope scope) {
892
		BlockScope scope) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-2 / +643 lines)
Lines 21-26 Link Here
21
import java.util.HashSet;
21
import java.util.HashSet;
22
import java.util.List;
22
import java.util.List;
23
import java.util.Set;
23
import java.util.Set;
24
import java.util.Stack;
24
25
25
import org.eclipse.jdt.core.compiler.CategorizedProblem;
26
import org.eclipse.jdt.core.compiler.CategorizedProblem;
26
import org.eclipse.jdt.core.compiler.CharOperation;
27
import org.eclipse.jdt.core.compiler.CharOperation;
Lines 34-47 Link Here
34
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
35
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
35
import org.eclipse.jdt.internal.compiler.ast.Expression;
36
import org.eclipse.jdt.internal.compiler.ast.Expression;
36
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
37
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
38
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
37
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
39
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
38
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
40
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
39
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
41
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
42
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
43
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
40
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
44
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
41
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
45
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
42
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
46
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
43
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
47
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
48
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
49
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
50
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
44
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
51
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
52
import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext;
53
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
45
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
54
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
46
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
55
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
47
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
56
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
Lines 49-62 Link Here
49
import org.eclipse.jdt.internal.compiler.codegen.Opcodes;
58
import org.eclipse.jdt.internal.compiler.codegen.Opcodes;
50
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame;
59
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame;
51
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
60
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
61
import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream;
62
import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo;
52
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker;
63
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker;
53
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker;
64
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker;
54
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker;
65
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker;
55
import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo;
56
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
66
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
57
import org.eclipse.jdt.internal.compiler.impl.Constant;
67
import org.eclipse.jdt.internal.compiler.impl.Constant;
58
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
68
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
59
import org.eclipse.jdt.internal.compiler.lookup.Binding;
69
import org.eclipse.jdt.internal.compiler.lookup.Binding;
70
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
60
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
71
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
61
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
72
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
62
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
73
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
Lines 231-236 Link Here
231
		LookupEnvironment env = typeBinding.scope.environment();
242
		LookupEnvironment env = typeBinding.scope.environment();
232
		return env.classFilePool.acquire(typeBinding);
243
		return env.classFilePool.acquire(typeBinding);
233
	}
244
	}
245
246
	/**
247
	 * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none.
248
	 */
249
	private static int[] getWildcardLocations(TypeReference reference, Wildcard wildcard) {
250
		class LocationCollector extends ASTVisitor {
251
			Stack currentIndexes;
252
			boolean search = true;
253
			Wildcard currentWildcard;
254
			
255
			public LocationCollector(Wildcard currentWildcard) {
256
				this.currentIndexes = new Stack();
257
				this.currentWildcard = currentWildcard;
258
			}
259
			public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) {
260
				if (!this.search) return false;
261
				TypeReference[] typeReferences = typeReference.typeArguments;
262
				this.currentIndexes.push(new Integer(0));
263
				for (int i = 0, max = typeReferences.length; i < max; i++) {
264
					typeReferences[i].traverse(this, scope);
265
					if (!this.search) return false;
266
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
267
				}
268
				this.currentIndexes.pop();
269
				return true;
270
			}
271
			public boolean visit(ParameterizedQualifiedTypeReference typeReference, BlockScope scope) {
272
				if (!this.search) return false;
273
				TypeReference[] typeReferences = typeReference.typeArguments[typeReference.typeArguments.length - 1];
274
				this.currentIndexes.push(new Integer(0));
275
				for (int i = 0, max = typeReferences.length; i < max; i++) {
276
					typeReferences[i].traverse(this, scope);
277
					if (!this.search) return false;
278
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
279
				}
280
				this.currentIndexes.pop();
281
				return true;
282
			}
283
			public boolean visit(Wildcard typeReference, BlockScope scope) {
284
				if (!this.search) return false;
285
				if (typeReference.equals(this.currentWildcard)) {
286
					this.search = false;
287
				}
288
				return true;
289
			}
290
			public String toString() {
291
				StringBuffer buffer = new StringBuffer();
292
				buffer
293
					.append("search location for ") //$NON-NLS-1$
294
					.append(this.currentWildcard)
295
					.append("\ncurrent indexes : ") //$NON-NLS-1$
296
					.append(this.currentIndexes);
297
				return String.valueOf(buffer);
298
			}
299
		}
300
		if (reference == null) return null;
301
		LocationCollector collector = new LocationCollector(wildcard);
302
		reference.traverse(collector, (BlockScope) null);
303
		if (collector.currentIndexes.isEmpty()) {
304
			return null;
305
		}
306
		int size = collector.currentIndexes.size();
307
		int[] result = new int[size];
308
		for (int i = 0; i < size; i++) {
309
			result[size - i - 1] = ((Integer) collector.currentIndexes.pop()).intValue();
310
		}
311
		return result;
312
	}
313
234
	/**
314
	/**
235
	 * INTERNAL USE-ONLY
315
	 * INTERNAL USE-ONLY
236
	 * This methods creates a new instance of the receiver.
316
	 * This methods creates a new instance of the receiver.
Lines 249-255 Link Here
249
		this.isNestedType = typeBinding.isNestedType();
329
		this.isNestedType = typeBinding.isNestedType();
250
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
330
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
251
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
331
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
252
			this.codeStream = new StackMapFrameCodeStream(this);
332
			if (this.targetJDK >= ClassFileConstants.JDK1_7) {
333
				this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
334
				this.codeStream = new TypeAnnotationCodeStream(this);
335
			} else {
336
				this.codeStream = new StackMapFrameCodeStream(this);
337
			}
253
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
338
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
254
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
339
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
255
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
340
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
Lines 367-372 Link Here
367
			generateMissingTypesAttribute();
452
			generateMissingTypesAttribute();
368
			attributesNumber++;
453
			attributesNumber++;
369
		}
454
		}
455
		
456
		attributesNumber += generateTypeAnnotationAttributeForTypeDeclaration();
370
		// update the number of attributes
457
		// update the number of attributes
371
		if (attributeOffset + 2 >= this.contents.length) {
458
		if (attributeOffset + 2 >= this.contents.length) {
372
			resizeContents(2);
459
			resizeContents(2);
Lines 421-428 Link Here
421
			FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
508
			FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
422
			if (fieldDeclaration != null) {
509
			if (fieldDeclaration != null) {
423
				Annotation[] annotations = fieldDeclaration.annotations;
510
				Annotation[] annotations = fieldDeclaration.annotations;
511
				List allTypeAnnotationContexts = new ArrayList();
512
				int invisibleTypeAnnotationsCounter = 0;
513
				int visibleTypeAnnotationsCounter = 0;
424
				if (annotations != null) {
514
				if (annotations != null) {
425
					attributesNumber += generateRuntimeAnnotations(annotations);
515
					attributesNumber += generateRuntimeAnnotations(annotations);
516
					if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
517
						if ((fieldDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
518
							fieldDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
519
						}
520
					}
521
				}
522
				TypeReference fieldType = fieldDeclaration.type;
523
				if (fieldType != null 
524
						&& ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0)
525
						&& ((fieldType.bits & ASTNode.HasTypeAnnotations) != 0)) {
526
					fieldType.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
527
				}
528
				int size = allTypeAnnotationContexts.size();
529
				if (size != 0) {
530
					AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
531
					allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
532
					for (int i = 0, max = allTypeAnnotationContextsArray.length; i < max; i++) {
533
						AnnotationContext annotationContext = allTypeAnnotationContextsArray[i];
534
						if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
535
							invisibleTypeAnnotationsCounter++;
536
							allTypeAnnotationContexts.add(annotationContext);
537
						} else {
538
							visibleTypeAnnotationsCounter++;
539
							allTypeAnnotationContexts.add(annotationContext);
540
						}
541
					}
542
					attributesNumber += generateRuntimeTypeAnnotations(
543
							allTypeAnnotationContextsArray,
544
							visibleTypeAnnotationsCounter,
545
							invisibleTypeAnnotationsCounter);
426
				}
546
				}
427
			}
547
			}
428
		}
548
		}
Lines 1843-1852 Link Here
1843
			MethodBinding binding,
1963
			MethodBinding binding,
1844
			int methodAttributeOffset,
1964
			int methodAttributeOffset,
1845
			int attributesNumber) {
1965
			int attributesNumber) {
1966
1967
		if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
1968
			List allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts;
1969
			int invisibleTypeAnnotationsCounter = 0;
1970
			int visibleTypeAnnotationsCounter = 0;
1971
			for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) {
1972
				LocalVariableBinding localVariable = this.codeStream.locals[i];
1973
				LocalDeclaration declaration = localVariable.declaration;
1974
				if (declaration == null
1975
						|| (declaration.isArgument() && ((declaration.bits & ASTNode.IsUnionType) == 0))
1976
						|| (localVariable.initializationCount == 0)
1977
						|| ((declaration.bits & ASTNode.HasTypeAnnotations) == 0)) {
1978
					continue;
1979
				}
1980
				declaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.LOCAL_VARIABLE, localVariable, allTypeAnnotationContexts);
1981
			}
1982
			AbstractMethodDeclaration methodDeclaration = binding.sourceMethod();
1983
			if (methodDeclaration != null) {
1984
				if ((methodDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
1985
					Argument[] arguments = methodDeclaration.arguments;
1986
					if (arguments != null) {
1987
						for (int i = 0, max = arguments.length; i < max; i++) {
1988
							Argument argument = arguments[i];
1989
							if ((argument.bits & ASTNode.HasTypeAnnotations) != 0) {
1990
								argument.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_PARAMETER, i, allTypeAnnotationContexts);
1991
							}
1992
						}
1993
					}
1994
					Annotation[] annotations = methodDeclaration.receiverAnnotations;
1995
					if (annotations != null) {
1996
						for (int i = 0, max = annotations.length; i < max; i++) {
1997
							Annotation annotation = annotations[i];
1998
							AnnotationContext annotationContext = null;
1999
							if (annotation.isRuntimeTypeInvisible()) {
2000
								annotationContext = new AnnotationContext(annotation, null, AnnotationTargetTypeConstants.METHOD_RECEIVER, null, AnnotationContext.INVISIBLE, null);
2001
								invisibleTypeAnnotationsCounter++;
2002
							} else if (annotation.isRuntimeTypeVisible()) {
2003
								annotationContext = new AnnotationContext(annotation, null, AnnotationTargetTypeConstants.METHOD_RECEIVER, null, AnnotationContext.VISIBLE, null);
2004
								visibleTypeAnnotationsCounter++;
2005
							}
2006
							if (annotationContext != null) {
2007
								allTypeAnnotationContexts.add(annotationContext);
2008
							}
2009
						}
2010
					}
2011
				}
2012
				Annotation[] annotations = methodDeclaration.annotations;
2013
				if (annotations != null && binding.returnType.id != T_void) {
2014
					methodDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN_TYPE, allTypeAnnotationContexts);
2015
				}
2016
				if (!methodDeclaration.isConstructor() && !methodDeclaration.isClinit() && binding.returnType.id != T_void) {
2017
					MethodDeclaration declaration = (MethodDeclaration) methodDeclaration;
2018
					TypeReference typeReference = declaration.returnType;
2019
					if ((typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
2020
						typeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN_TYPE, allTypeAnnotationContexts);
2021
					}
2022
				}
2023
				TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
2024
				if (thrownExceptions != null) {
2025
					for (int i = 0, max = thrownExceptions.length; i < max; i++) {
2026
						TypeReference thrownException = thrownExceptions[i];
2027
						thrownException.getAllAnnotationContexts(AnnotationTargetTypeConstants.THROWS, i, allTypeAnnotationContexts);
2028
					}
2029
				}
2030
				TypeParameter[] typeParameters = methodDeclaration.typeParameters();
2031
				if (typeParameters != null) {
2032
					for (int i = 0, max = typeParameters.length; i < max; i++) {
2033
						TypeParameter typeParameter = typeParameters[i];
2034
						if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
2035
							typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER, i, allTypeAnnotationContexts);
2036
						}
2037
					}
2038
				}
2039
			}
2040
			int size = allTypeAnnotationContexts.size();
2041
			if (size != 0) {
2042
				AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
2043
				allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
2044
				for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) {
2045
					AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
2046
					if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
2047
						invisibleTypeAnnotationsCounter++;
2048
					} else {
2049
						visibleTypeAnnotationsCounter++;
2050
					}
2051
				}
2052
				attributesNumber += generateRuntimeTypeAnnotations(
2053
						allTypeAnnotationContextsArray,
2054
						visibleTypeAnnotationsCounter,
2055
						invisibleTypeAnnotationsCounter);
2056
			}
2057
		}
2058
1846
		// update the number of attributes
2059
		// update the number of attributes
1847
		this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8);
2060
		this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8);
1848
		this.contents[methodAttributeOffset] = (byte) attributesNumber;
2061
		this.contents[methodAttributeOffset] = (byte) attributesNumber;
1849
	}
2062
	}
2063
2064
	private void dumpLocations(int[] locations) {
2065
		if (locations != null) {
2066
			int length = locations.length;
2067
			int actualSize = 2 + length;
2068
			if (this.contentsOffset + actualSize >= this.contents.length) {
2069
				resizeContents(actualSize);
2070
			}
2071
			this.contents[this.contentsOffset++] = (byte) (length >> 8);
2072
			this.contents[this.contentsOffset++] = (byte) length;
2073
			for (int i = 0; i < length; i++) {
2074
				this.contents[this.contentsOffset++] = (byte) locations[i];
2075
			}
2076
		}
2077
	}
2078
	private void dumpTargetTypeContents(int targetType, AnnotationContext annotationContext) {
2079
		switch(targetType) {
2080
			case AnnotationTargetTypeConstants.THROWS :
2081
			case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS :
2082
			case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
2083
			case AnnotationTargetTypeConstants.OBJECT_CREATION :
2084
			case AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
2085
			case AnnotationTargetTypeConstants.CLASS_LITERAL :
2086
			case AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
2087
			case AnnotationTargetTypeConstants.TYPE_INSTANCEOF :
2088
			case AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
2089
			case AnnotationTargetTypeConstants.TYPE_CAST :
2090
			case AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY :
2091
				this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8);
2092
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2093
				break;
2094
			case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
2095
			case AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
2096
				int localVariableTableOffset = this.contentsOffset;
2097
				LocalVariableBinding localVariable = annotationContext.variableBinding;
2098
				int actualSize = 0;
2099
				int initializationCount = localVariable.initializationCount;
2100
				actualSize += 6 * initializationCount;
2101
				// reserve enough space
2102
				if (this.contentsOffset + actualSize >= this.contents.length) {
2103
					resizeContents(actualSize);
2104
				}
2105
				this.contentsOffset += 2;
2106
				int numberOfEntries = 0;
2107
				for (int j = 0; j < initializationCount; j++) {
2108
					int startPC = localVariable.initializationPCs[j << 1];
2109
					int endPC = localVariable.initializationPCs[(j << 1) + 1];
2110
					if (startPC != endPC) { // only entries for non zero length
2111
						// now we can safely add the local entry
2112
						numberOfEntries++;
2113
						this.contents[this.contentsOffset++] = (byte) (startPC >> 8);
2114
						this.contents[this.contentsOffset++] = (byte) startPC;
2115
						int length = endPC - startPC;
2116
						this.contents[this.contentsOffset++] = (byte) (length >> 8);
2117
						this.contents[this.contentsOffset++] = (byte) length;
2118
						int resolvedPosition = localVariable.resolvedPosition;
2119
						this.contents[this.contentsOffset++] = (byte) (resolvedPosition >> 8);
2120
						this.contents[this.contentsOffset++] = (byte) resolvedPosition;
2121
					}
2122
				}
2123
				this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8);
2124
				this.contents[localVariableTableOffset] = (byte) numberOfEntries;
2125
				break;
2126
			case AnnotationTargetTypeConstants.METHOD_PARAMETER :
2127
			case AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
2128
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2129
				break;
2130
			// nothing to do
2131
			// case AnnotationTargetTypeConstants.METHOD_RECEIVER :
2132
			// case AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
2133
			//	break;
2134
			// case AnnotationTargetTypeConstants.FIELD :
2135
			// case AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY :
2136
			//	break;
2137
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
2138
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
2139
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2140
				break;
2141
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
2142
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
2143
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
2144
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
2145
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2146
				this.contents[this.contentsOffset++] = (byte) annotationContext.info2;
2147
				break;
2148
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
2149
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
2150
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
2151
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
2152
				// offset
2153
				this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8);
2154
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2155
				// type index
2156
				this.contents[this.contentsOffset++] = (byte) annotationContext.info2;
2157
		}
2158
	}
2159
1850
	/**
2160
	/**
1851
	 * INTERNAL USE-ONLY
2161
	 * INTERNAL USE-ONLY
1852
	 * This methods returns a char[] representing the file name of the receiver
2162
	 * This methods returns a char[] representing the file name of the receiver
Lines 3133-3138 Link Here
3133
		}
3443
		}
3134
		return attributesNumber;
3444
		return attributesNumber;
3135
	}
3445
	}
3446
	/**
3447
	 * @param annotationContexts the given annotation contexts
3448
	 * @param visibleTypeAnnotationsNumber the given number of visible type annotations
3449
	 * @param invisibleTypeAnnotationsNumber the given number of invisible type annotations
3450
	 * @return the number of attributes created while dumping the annotations in the .class file
3451
	 */
3452
	private int generateRuntimeTypeAnnotations(final AnnotationContext[] annotationContexts, int visibleTypeAnnotationsNumber, int invisibleTypeAnnotationsNumber) {
3453
		int attributesNumber = 0;
3454
		final int length = annotationContexts.length;
3455
3456
		int visibleTypeAnnotationsCounter = visibleTypeAnnotationsNumber;
3457
		int invisibleTypeAnnotationsCounter = invisibleTypeAnnotationsNumber;
3458
		int annotationAttributeOffset = this.contentsOffset;
3459
		int constantPOffset = this.constantPool.currentOffset;
3460
		int constantPoolIndex = this.constantPool.currentIndex;
3461
		if (invisibleTypeAnnotationsCounter != 0) {
3462
			if (this.contentsOffset + 10 >= this.contents.length) {
3463
				resizeContents(10);
3464
			}
3465
			int runtimeInvisibleAnnotationsAttributeNameIndex =
3466
				this.constantPool.literalIndex(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName);
3467
			this.contents[this.contentsOffset++] = (byte) (runtimeInvisibleAnnotationsAttributeNameIndex >> 8);
3468
			this.contents[this.contentsOffset++] = (byte) runtimeInvisibleAnnotationsAttributeNameIndex;
3469
			int attributeLengthOffset = this.contentsOffset;
3470
			this.contentsOffset += 4; // leave space for the attribute length
3471
3472
			int annotationsLengthOffset = this.contentsOffset;
3473
			this.contentsOffset += 2; // leave space for the annotations length
3474
3475
			int counter = 0;
3476
			loop: for (int i = 0; i < length; i++) {
3477
				if (invisibleTypeAnnotationsCounter == 0) break loop;
3478
				AnnotationContext annotationContext = annotationContexts[i];
3479
				if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
3480
					int currentAnnotationOffset = this.contentsOffset;
3481
					generateTypeAnnotation(annotationContext, currentAnnotationOffset);
3482
					invisibleTypeAnnotationsCounter--;
3483
					if (this.contentsOffset != currentAnnotationOffset) {
3484
						counter++;
3485
					}
3486
				}
3487
			}
3488
			if (counter != 0) {
3489
				this.contents[annotationsLengthOffset++] = (byte) (counter >> 8);
3490
				this.contents[annotationsLengthOffset++] = (byte) counter;
3491
3492
				int attributeLength = this.contentsOffset - attributeLengthOffset - 4;
3493
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
3494
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
3495
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
3496
				this.contents[attributeLengthOffset++] = (byte) attributeLength;
3497
				attributesNumber++;
3498
			} else {
3499
				this.contentsOffset = annotationAttributeOffset;
3500
				// reset the constant pool to its state before the clinit
3501
				this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName, constantPoolIndex, constantPOffset);
3502
			}
3503
		}
3504
3505
		annotationAttributeOffset = this.contentsOffset;
3506
		constantPOffset = this.constantPool.currentOffset;
3507
		constantPoolIndex = this.constantPool.currentIndex;
3508
		if (visibleTypeAnnotationsCounter != 0) {
3509
			if (this.contentsOffset + 10 >= this.contents.length) {
3510
				resizeContents(10);
3511
			}
3512
			int runtimeVisibleAnnotationsAttributeNameIndex =
3513
				this.constantPool.literalIndex(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName);
3514
			this.contents[this.contentsOffset++] = (byte) (runtimeVisibleAnnotationsAttributeNameIndex >> 8);
3515
			this.contents[this.contentsOffset++] = (byte) runtimeVisibleAnnotationsAttributeNameIndex;
3516
			int attributeLengthOffset = this.contentsOffset;
3517
			this.contentsOffset += 4; // leave space for the attribute length
3518
3519
			int annotationsLengthOffset = this.contentsOffset;
3520
			this.contentsOffset += 2; // leave space for the annotations length
3521
3522
			int counter = 0;
3523
			loop: for (int i = 0; i < length; i++) {
3524
				if (visibleTypeAnnotationsCounter == 0) break loop;
3525
				AnnotationContext annotationContext = annotationContexts[i];
3526
				if ((annotationContext.visibility & AnnotationContext.VISIBLE) != 0) {
3527
					visibleTypeAnnotationsCounter--;
3528
					int currentAnnotationOffset = this.contentsOffset;
3529
					generateTypeAnnotation(annotationContext, currentAnnotationOffset);
3530
					if (this.contentsOffset != currentAnnotationOffset) {
3531
						counter++;
3532
					}
3533
				}
3534
			}
3535
			if (counter != 0) {
3536
				this.contents[annotationsLengthOffset++] = (byte) (counter >> 8);
3537
				this.contents[annotationsLengthOffset++] = (byte) counter;
3538
3539
				int attributeLength = this.contentsOffset - attributeLengthOffset - 4;
3540
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
3541
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
3542
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
3543
				this.contents[attributeLengthOffset++] = (byte) attributeLength;
3544
				attributesNumber++;
3545
			} else {
3546
				this.contentsOffset = annotationAttributeOffset;
3547
				this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName, constantPoolIndex, constantPOffset);
3548
			}
3549
		}
3550
		return attributesNumber;
3551
	}
3136
3552
3137
	private int generateSignatureAttribute(char[] genericSignature) {
3553
	private int generateSignatureAttribute(char[] genericSignature) {
3138
		int localContentsOffset = this.contentsOffset;
3554
		int localContentsOffset = this.contentsOffset;
Lines 3733-3738 Link Here
3733
		return 1;
4149
		return 1;
3734
	}
4150
	}
3735
4151
4152
	private void generateTypeAnnotation(AnnotationContext annotationContext, int currentOffset) {
4153
		int targetType = annotationContext.targetType;
4154
		if (annotationContext.wildcard != null) {
4155
			generateWilcardTypeAnnotation(annotationContext, currentOffset);
4156
			return;
4157
		}
4158
		// common part between type annotation and annotation
4159
		generateAnnotation(annotationContext.annotation, currentOffset);
4160
		if (this.contentsOffset == currentOffset) {
4161
			// error occurred while generating the annotation
4162
			return;
4163
		}
4164
		int[] locations = Annotation.getLocations(
4165
			annotationContext.typeReference,
4166
			annotationContext.primaryAnnotations,
4167
			annotationContext.annotation,
4168
			annotationContext.annotationsOnDimensions);
4169
		if (locations != null) {
4170
			// convert to GENERIC_OR_ARRAY type
4171
			switch(targetType) {
4172
				case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS :
4173
					targetType = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY;
4174
					break;
4175
				case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
4176
					targetType = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY;
4177
					break;
4178
				case AnnotationTargetTypeConstants.METHOD_PARAMETER :
4179
					targetType = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY;
4180
					break;
4181
				case AnnotationTargetTypeConstants.FIELD :
4182
					targetType = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY;
4183
					break;
4184
//					case AnnotationTargetTypeConstants.METHOD_RECEIVER :
4185
//					// should not happen - possible extension
4186
//					targetType = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY;
4187
//					break;
4188
//				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
4189
//					// should not happen - possible extension
4190
//					targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4191
//					break;
4192
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
4193
					// should not happen - possible extension
4194
					targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4195
					break;
4196
//				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
4197
//					// should not happen - possible extension
4198
//					targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4199
//					break;
4200
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
4201
					// should not happen - possible extension
4202
					targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4203
					break;
4204
//				case AnnotationTargetTypeConstants.THROWS :
4205
//					targetType = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY;
4206
				case AnnotationTargetTypeConstants.TYPE_INSTANCEOF:
4207
					targetType = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY;
4208
					break;
4209
				case AnnotationTargetTypeConstants.CLASS_LITERAL:
4210
					targetType = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY;
4211
					break;
4212
				case AnnotationTargetTypeConstants.OBJECT_CREATION:
4213
					targetType = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY;
4214
					break;
4215
				case AnnotationTargetTypeConstants.TYPE_CAST:
4216
					targetType = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY;
4217
					break;
4218
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
4219
					targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY;
4220
					break;
4221
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
4222
					targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY;
4223
					break;
4224
				case AnnotationTargetTypeConstants.METHOD_RETURN_TYPE :
4225
					targetType = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY;
4226
			}
4227
		}
4228
		// reserve enough space
4229
		if (this.contentsOffset + 5 >= this.contents.length) {
4230
			resizeContents(5);
4231
		}
4232
		this.contents[this.contentsOffset++] = (byte) targetType;
4233
		dumpTargetTypeContents(targetType, annotationContext);
4234
		dumpLocations(locations);
4235
	}
4236
4237
	private void generateWilcardTypeAnnotation(AnnotationContext annotationContext, int currentOffset) {
4238
		// common part between type annotation and annotation
4239
		generateAnnotation(annotationContext.annotation, currentOffset);
4240
		if (this.contentsOffset == currentOffset) {
4241
			// error occurred while generating the annotation
4242
			return;
4243
		}
4244
		int[] wildcardLocations = getWildcardLocations(annotationContext.typeReference, annotationContext.wildcard);
4245
		int targetType = annotationContext.targetType;
4246
		switch(targetType) {
4247
			case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS :
4248
				targetType = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY;
4249
				break;
4250
			case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
4251
				targetType = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY;
4252
				break;
4253
			case AnnotationTargetTypeConstants.METHOD_PARAMETER :
4254
				targetType = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY;
4255
				break;
4256
			case AnnotationTargetTypeConstants.FIELD :
4257
				targetType = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY;
4258
				break;
4259
//				case AnnotationTargetTypeConstants.METHOD_RECEIVER :
4260
//				// should not happen - possible extension
4261
//				targetType = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY;
4262
//				break;
4263
//			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
4264
//				// should not happen - possible extension
4265
//				targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4266
//				break;
4267
//			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
4268
//				// should not happen - possible extension
4269
//				targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4270
//				break;
4271
//			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
4272
//				// should not happen - possible extension
4273
//				targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4274
//				break;
4275
//			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
4276
//				// should not happen - possible extension
4277
//				targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4278
//				break;
4279
//			case AnnotationTargetTypeConstants.THROWS :
4280
//				targetType = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY;
4281
			case AnnotationTargetTypeConstants.TYPE_INSTANCEOF:
4282
				targetType = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY;
4283
				break;
4284
			case AnnotationTargetTypeConstants.CLASS_LITERAL:
4285
				targetType = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY;
4286
				break;
4287
			case AnnotationTargetTypeConstants.OBJECT_CREATION:
4288
				targetType = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY;
4289
				break;
4290
			case AnnotationTargetTypeConstants.TYPE_CAST:
4291
				targetType = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY;
4292
				break;
4293
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
4294
				targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY;
4295
				break;
4296
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
4297
				targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY;
4298
				break;
4299
			case AnnotationTargetTypeConstants.METHOD_RETURN_TYPE :
4300
				targetType = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY;
4301
		}
4302
		int[] locations = Annotation.getLocations(
4303
				annotationContext.wildcard.bound,
4304
				null,
4305
				annotationContext.annotation,
4306
				null);
4307
		// reserve enough space
4308
		if (this.contentsOffset + 5 >= this.contents.length) {
4309
			resizeContents(5);
4310
		}
4311
		this.contents[this.contentsOffset++] =
4312
			(byte) (locations != null ?
4313
					AnnotationTargetTypeConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
4314
					AnnotationTargetTypeConstants.WILDCARD_BOUND);
4315
		this.contents[this.contentsOffset++] = (byte) targetType;
4316
		dumpTargetTypeContents(targetType, annotationContext);
4317
		dumpLocations(wildcardLocations);
4318
		dumpLocations(locations);
4319
	}
4320
	private int generateTypeAnnotationAttributeForTypeDeclaration() {
4321
		TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext;
4322
		if ((typeDeclaration.bits & ASTNode.HasTypeAnnotations) == 0) {
4323
			return 0;
4324
		}
4325
		int attributesNumber = 0;
4326
		int visibleTypeAnnotationsCounter = 0;
4327
		int invisibleTypeAnnotationsCounter = 0;
4328
		TypeReference superclass = typeDeclaration.superclass;
4329
		List allTypeAnnotationContexts = new ArrayList();
4330
		if (superclass != null && (superclass.bits & ASTNode.HasTypeAnnotations) != 0) {
4331
			superclass.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS, -1, allTypeAnnotationContexts);
4332
		}
4333
		TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
4334
		if (superInterfaces != null) {
4335
			for (int i = 0; i < superInterfaces.length; i++) {
4336
				TypeReference superInterface = superInterfaces[i];
4337
				if ((superInterface.bits & ASTNode.HasTypeAnnotations) == 0) {
4338
					continue;
4339
				}
4340
				superInterface.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS, i, allTypeAnnotationContexts);
4341
			}
4342
		}
4343
		TypeParameter[] typeParameters = typeDeclaration.typeParameters;
4344
		if (typeParameters != null) {
4345
			for (int i = 0, max = typeParameters.length; i < max; i++) {
4346
				TypeParameter typeParameter = typeParameters[i];
4347
				if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
4348
					typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER, i, allTypeAnnotationContexts);
4349
				}
4350
			}
4351
		}
4352
		int size = allTypeAnnotationContexts.size();
4353
		if (size != 0) {
4354
			AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
4355
			allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
4356
			for (int j = 0, max = allTypeAnnotationContextsArray.length; j < max; j++) {
4357
				AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
4358
				if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
4359
					invisibleTypeAnnotationsCounter++;
4360
					allTypeAnnotationContexts.add(annotationContext);
4361
				} else {
4362
					visibleTypeAnnotationsCounter++;
4363
					allTypeAnnotationContexts.add(annotationContext);
4364
				}
4365
			}
4366
			attributesNumber += generateRuntimeTypeAnnotations(
4367
					allTypeAnnotationContextsArray,
4368
					visibleTypeAnnotationsCounter,
4369
					invisibleTypeAnnotationsCounter);
4370
		}
4371
		return attributesNumber;
4372
	}
4373
	
3736
	private int generateVarargsAttribute() {
4374
	private int generateVarargsAttribute() {
3737
		int localContentsOffset = this.contentsOffset;
4375
		int localContentsOffset = this.contentsOffset;
3738
		/*
4376
		/*
Lines 4157-4162 Link Here
4157
		this.produceAttributes = options.produceDebugAttributes;
4795
		this.produceAttributes = options.produceDebugAttributes;
4158
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
4796
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
4159
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
4797
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
4798
			if (this.targetJDK >= ClassFileConstants.JDK1_7) {
4799
				this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
4800
			}
4160
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
4801
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
4161
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
4802
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
4162
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
4803
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-3 / +138 lines)
Lines 61-67 Link Here
61
	public final static int Bit27 = 0x4000000;		// parenthesis count (expression)
61
	public final static int Bit27 = 0x4000000;		// parenthesis count (expression)
62
	public final static int Bit28 = 0x8000000;		// parenthesis count (expression)
62
	public final static int Bit28 = 0x8000000;		// parenthesis count (expression)
63
	public final static int Bit29 = 0x10000000;		// parenthesis count (expression)
63
	public final static int Bit29 = 0x10000000;		// parenthesis count (expression)
64
	public final static int Bit30 = 0x20000000;		// elseif (if statement) | try block exit (try statement) | fall-through (case statement) | ignore no effect assign (expression ref) | needScope (for statement) | isAnySubRoutineEscaping (return statement) | blockExit (synchronized statement)
64
	/* elseif (if statement)
65
	 * | try block exit (try statement)
66
	 * | fall-through (case statement)
67
	 * | ignore no effect assign (expression ref)
68
	 * | needScope (for statement)
69
	 * | isAnySubRoutineEscaping (return statement)
70
	 * | blockExit (synchronized statement)
71
	 * | hasTypeAnnotations (type decl, field decl, local decl, argument, method decl, type reference)
72
	 */
73
	public final static int Bit30 = 0x20000000;
65
	public final static int Bit31 = 0x40000000;		// local declaration reachable (local decl) | ignore raw type check (type ref) | discard entire assignment (assignment) | isSynchronized (return statement) | thenExit (if statement)
74
	public final static int Bit31 = 0x40000000;		// local declaration reachable (local decl) | ignore raw type check (type ref) | discard entire assignment (assignment) | isSynchronized (return statement) | thenExit (if statement)
66
	public final static int Bit32 = 0x80000000;		// reachable (statement)
75
	public final static int Bit32 = 0x80000000;		// reachable (statement)
67
76
Lines 253-258 Link Here
253
	public static final int INVOCATION_ARGUMENT_UNCHECKED = 1;
262
	public static final int INVOCATION_ARGUMENT_UNCHECKED = 1;
254
	public static final int INVOCATION_ARGUMENT_WILDCARD = 2;
263
	public static final int INVOCATION_ARGUMENT_WILDCARD = 2;
255
264
265
	// for all declarations that can contain type references that have type annotations
266
	public static final int HasTypeAnnotations = Bit21;
267
	
256
	// for type reference (diamond case) - Java 7
268
	// for type reference (diamond case) - Java 7
257
	public static final int IsUnionType = Bit30;
269
	public static final int IsUnionType = Bit30;
258
	// Used to tag ParameterizedSingleTypeReference or ParameterizedQualifiedTypeReference when they are
270
	// Used to tag ParameterizedSingleTypeReference or ParameterizedQualifiedTypeReference when they are
Lines 528-535 Link Here
528
	public static StringBuffer printAnnotations(Annotation[] annotations, StringBuffer output) {
540
	public static StringBuffer printAnnotations(Annotation[] annotations, StringBuffer output) {
529
		int length = annotations.length;
541
		int length = annotations.length;
530
		for (int i = 0; i < length; i++) {
542
		for (int i = 0; i < length; i++) {
531
			annotations[i].print(0, output);
543
			if (i > 0) {
532
			output.append(" "); //$NON-NLS-1$
544
				output.append(" "); //$NON-NLS-1$
545
			}
546
			Annotation annotation2 = annotations[i];
547
			if (annotation2 != null) {
548
				annotation2.print(0, output);
549
			} else {
550
				output.append('?');
551
			}
533
		}
552
		}
534
		return output;
553
		return output;
535
	}
554
	}
Lines 712-717 Link Here
712
		}
731
		}
713
	}
732
	}
714
733
734
	/**
735
	 * Resolve annotations, and check duplicates, answers combined tagBits
736
	 * for recognized standard annotations
737
	 */
738
	public static void resolveAnnotations(ClassScope scope, Annotation[] sourceAnnotations, Binding recipient) {
739
		AnnotationBinding[] annotations = null;
740
		int length = sourceAnnotations == null ? 0 : sourceAnnotations.length;
741
		if (recipient != null) {
742
			switch (recipient.kind()) {
743
				case Binding.PACKAGE :
744
					PackageBinding packageBinding = (PackageBinding) recipient;
745
					if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
746
					packageBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
747
					break;
748
				case Binding.TYPE :
749
				case Binding.GENERIC_TYPE :
750
					ReferenceBinding type = (ReferenceBinding) recipient;
751
					if ((type.tagBits & TagBits.AnnotationResolved) != 0) return;
752
					type.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
753
					if (length > 0) {
754
						annotations = new AnnotationBinding[length];
755
						type.setAnnotations(annotations);
756
					}
757
					break;
758
				case Binding.METHOD :
759
					MethodBinding method = (MethodBinding) recipient;
760
					if ((method.tagBits & TagBits.AnnotationResolved) != 0) return;
761
					method.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
762
					if (length > 0) {
763
						annotations = new AnnotationBinding[length];
764
						method.setAnnotations(annotations);
765
					}
766
					break;
767
				case Binding.FIELD :
768
					FieldBinding field = (FieldBinding) recipient;
769
					if ((field.tagBits & TagBits.AnnotationResolved) != 0) return;
770
					field.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
771
					if (length > 0) {
772
						annotations = new AnnotationBinding[length];
773
						field.setAnnotations(annotations);
774
					}
775
					break;
776
				case Binding.LOCAL :
777
					LocalVariableBinding local = (LocalVariableBinding) recipient;
778
					if ((local.tagBits & TagBits.AnnotationResolved) != 0) return;
779
					local.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
780
					if (length > 0) {
781
						annotations = new AnnotationBinding[length];
782
						local.setAnnotations(annotations, scope);
783
					}
784
					break;
785
				default :
786
					return;
787
			}
788
		}
789
		if (sourceAnnotations == null)
790
			return;
791
		for (int i = 0; i < length; i++) {
792
			Annotation annotation = sourceAnnotations[i];
793
			final Binding annotationRecipient = annotation.recipient;
794
			if (annotationRecipient != null && recipient != null) {
795
				// only local and field can share annnotations
796
				switch (recipient.kind()) {
797
					case Binding.FIELD :
798
						FieldBinding field = (FieldBinding) recipient;
799
						field.tagBits = ((FieldBinding) annotationRecipient).tagBits;
800
						break;
801
					case Binding.LOCAL :
802
						LocalVariableBinding local = (LocalVariableBinding) recipient;
803
						local.tagBits = ((LocalVariableBinding) annotationRecipient).tagBits;
804
						break;
805
				}
806
				if (annotations != null) {
807
					// need to fill the instances array
808
					annotations[0] = annotation.getCompilerAnnotation();
809
					for (int j = 1; j < length; j++) {
810
						Annotation annot = sourceAnnotations[j];
811
						annotations[j] = annot.getCompilerAnnotation();
812
					}
813
				}
814
				return;
815
			} else {
816
				annotation.recipient = recipient;
817
				annotation.resolveType(scope);
818
				// null if receiver is a package binding
819
				if (annotations != null) {
820
					annotations[i] = annotation.getCompilerAnnotation();
821
				}
822
			}
823
		}
824
		// check duplicate annotations
825
		if (annotations != null) {
826
			AnnotationBinding[] distinctAnnotations = annotations; // only copy after 1st duplicate is detected
827
			for (int i = 0; i < length; i++) {
828
				AnnotationBinding annotation = distinctAnnotations[i];
829
				if (annotation == null) continue;
830
				TypeBinding annotationType = annotation.getAnnotationType();
831
				boolean foundDuplicate = false;
832
				for (int j = i+1; j < length; j++) {
833
					AnnotationBinding otherAnnotation = distinctAnnotations[j];
834
					if (otherAnnotation == null) continue;
835
					if (otherAnnotation.getAnnotationType() == annotationType) {
836
						foundDuplicate = true;
837
						if (distinctAnnotations == annotations) {
838
							System.arraycopy(distinctAnnotations, 0, distinctAnnotations = new AnnotationBinding[length], 0, length);
839
						}
840
						distinctAnnotations[j] = null; // report it only once
841
						scope.problemReporter().duplicateAnnotation(sourceAnnotations[j]);
842
					}
843
				}
844
				if (foundDuplicate) {
845
					scope.problemReporter().duplicateAnnotation(sourceAnnotations[i]);
846
				}
847
			}
848
		}
849
	}
715
/**
850
/**
716
 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
851
 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
717
 */
852
 */
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java (-1 / +20 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 14-19 Link Here
14
 *								bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults
18
 *								bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults
15
 *******************************************************************************/
19
 *******************************************************************************/
16
package org.eclipse.jdt.internal.compiler.ast;
20
package org.eclipse.jdt.internal.compiler.ast;
21
22
import java.util.List;
17
23
18
import org.eclipse.jdt.core.compiler.*;
24
import org.eclipse.jdt.core.compiler.*;
19
import org.eclipse.jdt.internal.compiler.*;
25
import org.eclipse.jdt.internal.compiler.*;
Lines 39-44 Link Here
39
	public int modifiers;
45
	public int modifiers;
40
	public int modifiersSourceStart;
46
	public int modifiersSourceStart;
41
	public Annotation[] annotations;
47
	public Annotation[] annotations;
48
	// jsr 308
49
	public Annotation[] receiverAnnotations;
42
	public Argument[] arguments;
50
	public Argument[] arguments;
43
	public TypeReference[] thrownExceptions;
51
	public TypeReference[] thrownExceptions;
44
	public Statement[] statements;
52
	public Statement[] statements;
Lines 301-306 Link Here
301
		classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber);
309
		classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber);
302
	}
310
	}
303
311
312
	public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
313
		// do nothing
314
	}
315
304
	private void checkArgumentsSize() {
316
	private void checkArgumentsSize() {
305
		TypeBinding[] parameters = this.binding.parameters;
317
		TypeBinding[] parameters = this.binding.parameters;
306
		int size = 1; // an abstract method or a native method cannot be static
318
		int size = 1; // an abstract method or a native method cannot be static
Lines 396-402 Link Here
396
		}
408
		}
397
		printIndent(tab, output);
409
		printIndent(tab, output);
398
		printModifiers(this.modifiers, output);
410
		printModifiers(this.modifiers, output);
399
		if (this.annotations != null) printAnnotations(this.annotations, output);
411
		if (this.annotations != null) {
412
			printAnnotations(this.annotations, output);
413
			output.append(' ');
414
		}
400
415
401
		TypeParameter[] typeParams = typeParameters();
416
		TypeParameter[] typeParams = typeParameters();
402
		if (typeParams != null) {
417
		if (typeParams != null) {
Lines 418-423 Link Here
418
			}
433
			}
419
		}
434
		}
420
		output.append(')');
435
		output.append(')');
436
		if (this.receiverAnnotations != null) {
437
			output.append(" "); //$NON-NLS-1$
438
			printAnnotations(this.receiverAnnotations, output);
439
		}
421
		if (this.thrownExceptions != null) {
440
		if (this.thrownExceptions != null) {
422
			output.append(" throws "); //$NON-NLS-1$
441
			output.append(" throws "); //$NON-NLS-1$
423
			for (int i = 0; i < this.thrownExceptions.length; i++) {
442
			for (int i = 0; i < this.thrownExceptions.length; i++) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java (-2 / +9 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 87-93 Link Here
87
	public StringBuffer printAsExpression(int indent, StringBuffer output) {
91
	public StringBuffer printAsExpression(int indent, StringBuffer output) {
88
		printIndent(indent, output);
92
		printIndent(indent, output);
89
		printModifiers(this.modifiers, output);
93
		printModifiers(this.modifiers, output);
90
		if (this.annotations != null) printAnnotations(this.annotations, output);
94
		if (this.annotations != null) {
95
			printAnnotations(this.annotations, output);
96
			output.append(' ');
97
		}
91
98
92
		if (this.type != null) {
99
		if (this.type != null) {
93
			this.type.print(0, output).append(' ');
100
			this.type.print(0, output).append(' ');
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-2 / +6 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 127-133 Link Here
127
	MethodBinding codegenBinding = this.binding.original();
131
	MethodBinding codegenBinding = this.binding.original();
128
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
132
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
129
133
130
	codeStream.new_(allocatedType);
134
	codeStream.new_(this.type, allocatedType);
131
	boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
135
	boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
132
	if (valueRequired || isUnboxing) {
136
	if (valueRequired || isUnboxing) {
133
		codeStream.dup();
137
		codeStream.dup();
Lines 160-166 Link Here
160
	}
164
	}
161
	// invoke constructor
165
	// invoke constructor
162
	if (this.syntheticAccessor == null) {
166
	if (this.syntheticAccessor == null) {
163
		codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
167
		codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments);
164
	} else {
168
	} else {
165
		// synthetic accessor got some extra arguments appended to its signature, which need values
169
		// synthetic accessor got some extra arguments appended to its signature, which need values
166
		for (int i = 0,
170
		for (int i = 0,
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java (-13 / +431 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 12-17 Link Here
12
 *								bug 365662 - [compiler][null] warn on contradictory and redundant null annotations
16
 *								bug 365662 - [compiler][null] warn on contradictory and redundant null annotations
13
 *******************************************************************************/
17
 *******************************************************************************/
14
package org.eclipse.jdt.internal.compiler.ast;
18
package org.eclipse.jdt.internal.compiler.ast;
19
20
import java.util.Stack;
15
21
16
import org.eclipse.jdt.core.compiler.CharOperation;
22
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.internal.compiler.ASTVisitor;
23
import org.eclipse.jdt.internal.compiler.ASTVisitor;
Lines 25-30 Link Here
25
 * Annotation
31
 * Annotation
26
 */
32
 */
27
public abstract class Annotation extends Expression {
33
public abstract class Annotation extends Expression {
34
	
35
	/**
36
	 * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none.
37
	 */
38
	public static int[] getLocations(
39
			final TypeReference reference,
40
			final Annotation[] primaryAnnotation,
41
			final Annotation annotation,
42
			final Annotation[][] annotationsOnDimensionsOnExpression) {
43
		class LocationCollector extends ASTVisitor {
44
			Stack currentIndexes;
45
			Annotation currentAnnotation;
46
			boolean search = true;
47
			
48
			public LocationCollector(Annotation currentAnnotation) {
49
				this.currentIndexes = new Stack();
50
				this.currentAnnotation = currentAnnotation;
51
			}
52
			public boolean visit(ArrayTypeReference typeReference, BlockScope scope) {
53
				if (!this.search) return false;
54
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
55
				if (annotationsOnDimensions != null) {
56
					// check if the annotation is located on the first dimension
57
					Annotation[] annotations = annotationsOnDimensions[0];
58
					if (annotations != null) {
59
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
60
							Annotation current = annotations[j];
61
							if (current == this.currentAnnotation) {
62
								this.search = false;
63
								return false;
64
							}
65
						}
66
					}
67
68
					this.currentIndexes.push(new Integer(0));
69
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
70
						annotations = annotationsOnDimensions[i];
71
						if (annotations != null) {
72
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
73
								Annotation current = annotations[j];
74
								if (current == this.currentAnnotation) {
75
									this.search = false;
76
									return false;
77
								}
78
							}
79
						}
80
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
81
					}
82
				}
83
				Annotation[] annotations = typeReference.annotations;
84
				if (annotations == null) {
85
					annotations = primaryAnnotation;
86
				}
87
				if (annotations != null) {
88
					for (int i = 0; i < annotations.length; i++) {
89
						Annotation current = annotations[i];
90
						if (current == this.currentAnnotation) {
91
							this.search = false;
92
							return false;
93
						}
94
					}
95
				}
96
				this.currentIndexes.pop();
97
				return true;
98
			}
99
			public boolean visit(ArrayQualifiedTypeReference typeReference, BlockScope scope) {
100
				if (!this.search) return false;
101
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
102
				if (annotationsOnDimensions != null) {
103
					// check if the annotation is located on the first dimension
104
					Annotation[] annotations = annotationsOnDimensions[0];
105
					if (annotations != null) {
106
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
107
							Annotation current = annotations[j];
108
							if (current == this.currentAnnotation) {
109
								this.search = false;
110
								return false;
111
							}
112
						}
113
					}
114
115
					this.currentIndexes.push(new Integer(0));
116
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
117
						annotations = annotationsOnDimensions[i];
118
						if (annotations != null) {
119
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
120
								Annotation current = annotations[j];
121
								if (current == this.currentAnnotation) {
122
									this.search = false;
123
									return false;
124
								}
125
							}
126
						}
127
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
128
					}
129
				}
130
				Annotation[] annotations = typeReference.annotations;
131
				if (annotations == null) {
132
					annotations = primaryAnnotation;
133
				}
134
				if (annotations != null) {
135
					for (int i = 0; i < annotations.length; i++) {
136
						Annotation current = annotations[i];
137
						if (current == this.currentAnnotation) {
138
							this.search = false;
139
							return false;
140
						}
141
					}
142
				}
143
				this.currentIndexes.pop();
144
				return true;
145
			}
146
			public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) {
147
				if (!this.search) return false;
148
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
149
				if (annotationsOnDimensions != null) {
150
					// check if the annotation is located on the first dimension
151
					Annotation[] annotations = annotationsOnDimensions[0];
152
					if (annotations != null) {
153
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
154
							Annotation current = annotations[j];
155
							if (current == this.currentAnnotation) {
156
								this.search = false;
157
								return false;
158
							}
159
						}
160
					}
161
162
					this.currentIndexes.push(new Integer(0));
163
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
164
						annotations = annotationsOnDimensions[i];
165
						if (annotations != null) {
166
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
167
								Annotation current = annotations[j];
168
								if (current == this.currentAnnotation) {
169
									this.search = false;
170
									return false;
171
								}
172
							}
173
						}
174
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
175
					}
176
				}
177
				Annotation[] annotations = typeReference.annotations;
178
				if (annotations == null) {
179
					annotations = primaryAnnotation;
180
				}
181
				if (annotations != null) {
182
					for (int i = 0; i < annotations.length; i++) {
183
						Annotation current = annotations[i];
184
						if (current == this.currentAnnotation) {
185
							this.search = false;
186
							return false;
187
						}
188
					}
189
				}
190
				TypeReference[] typeReferences = typeReference.typeArguments;
191
				this.currentIndexes.push(new Integer(0));
192
				for (int i = 0, max = typeReferences.length; i < max; i++) {
193
					typeReferences[i].traverse(this, scope);
194
					if (!this.search) return false;
195
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
196
				}
197
				this.currentIndexes.pop();
198
				return true;
199
			}
200
			public boolean visit(ParameterizedQualifiedTypeReference typeReference, BlockScope scope) {
201
				if (!this.search) return false;
202
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
203
				if (annotationsOnDimensions != null) {
204
					// check if the annotation is located on the first dimension
205
					Annotation[] annotations = annotationsOnDimensions[0];
206
					if (annotations != null) {
207
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
208
							Annotation current = annotations[j];
209
							if (current == this.currentAnnotation) {
210
								this.search = false;
211
								return false;
212
							}
213
						}
214
					}
215
216
					this.currentIndexes.push(new Integer(0));
217
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
218
						annotations = annotationsOnDimensions[i];
219
						if (annotations != null) {
220
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
221
								Annotation current = annotations[j];
222
								if (current == this.currentAnnotation) {
223
									this.search = false;
224
									return false;
225
								}
226
							}
227
						}
228
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
229
					}
230
				}
231
				Annotation[] annotations = typeReference.annotations;
232
				if (annotations == null) {
233
					annotations = primaryAnnotation;
234
				}
235
				if (annotations != null) {
236
					for (int i = 0; i < annotations.length; i++) {
237
						Annotation current = annotations[i];
238
						if (current == this.currentAnnotation) {
239
							this.search = false;
240
							return false;
241
						}
242
					}
243
				}
244
				//TODO it is unclear how to manage annotations located in the first type arguments
245
				TypeReference[] typeReferences = typeReference.typeArguments[typeReference.typeArguments.length - 1];
246
				this.currentIndexes.push(new Integer(0));
247
				for (int i = 0, max = typeReferences.length; i < max; i++) {
248
					typeReferences[i].traverse(this, scope);
249
					if (!this.search) return false;
250
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
251
				}
252
				this.currentIndexes.pop();
253
				return true;
254
			}
255
			public boolean visit(SingleTypeReference typeReference, BlockScope scope) {
256
				if (!this.search) return false;
257
				Annotation[][] annotationsOnDimensions = annotationsOnDimensionsOnExpression;
258
				if (annotationsOnDimensions != null) {
259
					// check if the annotation is located on the first dimension
260
					Annotation[] annotations = annotationsOnDimensions[0];
261
					if (annotations != null) {
262
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
263
							Annotation current = annotations[j];
264
							if (current == this.currentAnnotation) {
265
								this.search = false;
266
								return false;
267
							}
268
						}
269
					}
270
271
					this.currentIndexes.push(new Integer(0));
272
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
273
						annotations = annotationsOnDimensions[i];
274
						if (annotations != null) {
275
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
276
								Annotation current = annotations[j];
277
								if (current == this.currentAnnotation) {
278
									this.search = false;
279
									return false;
280
								}
281
							}
282
						}
283
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
284
					}
285
				}
286
				Annotation[] annotations = typeReference.annotations;
287
				if (annotations != null) {
288
					for (int i = 0; i < annotations.length; i++) {
289
						Annotation current = annotations[i];
290
						if (current == this.currentAnnotation) {
291
							this.search = false;
292
							return false;
293
						}
294
					}
295
				}
296
				return false;
297
			}
298
			public boolean visit(Wildcard typeReference, BlockScope scope) {
299
				if (!this.search) return false;
300
				TypeReference bound = typeReference.bound;
301
				bound.traverse(this, scope);
302
				return true;
303
			}
304
			public boolean visit(QualifiedTypeReference typeReference, BlockScope scope) {
305
				if (!this.search) return false;
306
				Annotation[] annotations = typeReference.annotations;
307
				if (annotations != null) {
308
					for (int i = 0; i < annotations.length; i++) {
309
						Annotation current = annotations[i];
310
						if (current == this.currentAnnotation) {
311
							this.search = false;
312
							return false;
313
						}
314
					}
315
				}
316
				return true;
317
			}
318
			public String toString() {
319
				StringBuffer buffer = new StringBuffer();
320
				buffer
321
					.append("search location for ") //$NON-NLS-1$
322
					.append(this.currentAnnotation)
323
					.append("\ncurrent indexes : ") //$NON-NLS-1$
324
					.append(this.currentIndexes);
325
				return String.valueOf(buffer);
326
			}
327
		}
328
		if (reference == null) return null;
329
		LocationCollector collector = new LocationCollector(annotation);
330
		reference.traverse(collector, (BlockScope) null);
331
		if (collector.currentIndexes.isEmpty()) {
332
			return null;
333
		}
334
		int size = collector.currentIndexes.size();
335
		int[] result = new int[size];
336
		for (int i = 0; i < size; i++) {
337
			result[size - i - 1] = ((Integer) collector.currentIndexes.pop()).intValue();
338
		}
339
		return result;
340
	}
341
	
342
	// jsr 308
343
		public static class TypeUseBinding extends ReferenceBinding {
344
			private int kind;
345
			public TypeUseBinding(int kind) {
346
				this.tagBits = 0L;
347
				this.kind = kind;
348
			}
349
			public int kind() {
350
				return this.kind;
351
			}
352
			public boolean hasTypeBit(int bit) {
353
				// TODO Auto-generated method stub
354
				return false;
355
			}
356
		}
28
357
29
	final static MemberValuePair[] NoValuePairs = new MemberValuePair[0];
358
	final static MemberValuePair[] NoValuePairs = new MemberValuePair[0];
30
	private static final long TAGBITS_NULLABLE_OR_NONNULL = TagBits.AnnotationNullable|TagBits.AnnotationNonNull;
359
	private static final long TAGBITS_NULLABLE_OR_NONNULL = TagBits.AnnotationNullable|TagBits.AnnotationNonNull;
Lines 91-96 Link Here
91
			case 'T' :
420
			case 'T' :
92
				if (CharOperation.equals(elementName, TypeConstants.TYPE))
421
				if (CharOperation.equals(elementName, TypeConstants.TYPE))
93
					return TagBits.AnnotationForType;
422
					return TagBits.AnnotationForType;
423
				if (CharOperation.equals(elementName, TypeConstants.TYPE_USE_TARGET))
424
					return TagBits.AnnotationForTypeUse;
425
				if (CharOperation.equals(elementName, TypeConstants.TYPE_PARAMETER_TARGET))
426
					return TagBits.AnnotationForTypeParameter;
94
				break;
427
				break;
95
		}
428
		}
96
		return 0; // unknown
429
		return 0; // unknown
Lines 202-211 Link Here
202
			return false;
535
			return false;
203
		}
536
		}
204
		long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference
537
		long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference
538
		// jsr 308
539
		// we need to filter out type use and type parameter annotations
540
		if ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) != 0) {
541
			return false;
542
		}
543
205
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
544
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
206
			return true; // by default the retention is CLASS
545
			return true; // by default the retention is CLASS
207
546
208
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention;
547
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention;
548
	}
549
550
	public boolean isRuntimeTypeInvisible() {
551
		final TypeBinding annotationBinding = this.resolvedType;
552
		if (annotationBinding == null) {
553
			return false;
554
		}
555
		long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference
556
		// jsr 308
557
		// we need to filter out type use and type parameter annotations
558
		if ((metaTagBits & (TagBits.AnnotationTargetMASK)) != 0
559
				&& ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) == 0)) {
560
			return false;
561
		}
562
563
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
564
			return true; // by default the retention is CLASS
565
566
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention;
567
	}
568
569
	public boolean isRuntimeTypeVisible() {
570
		final TypeBinding annotationBinding = this.resolvedType;
571
		if (annotationBinding == null) {
572
			return false;
573
		}
574
		long metaTagBits = annotationBinding.getAnnotationTagBits();
575
		if ((metaTagBits & (TagBits.AnnotationTargetMASK)) != 0
576
				&& ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) == 0)) {
577
			return false;
578
		}
579
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
580
			return false; // by default the retention is CLASS
581
582
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention;
209
	}
583
	}
210
584
211
	public boolean isRuntimeVisible() {
585
	public boolean isRuntimeVisible() {
Lines 214-219 Link Here
214
			return false;
588
			return false;
215
		}
589
		}
216
		long metaTagBits = annotationBinding.getAnnotationTagBits();
590
		long metaTagBits = annotationBinding.getAnnotationTagBits();
591
		if ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) != 0) {
592
			return false;
593
		}
217
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
594
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
218
			return false; // by default the retention is CLASS
595
			return false; // by default the retention is CLASS
219
596
Lines 341-356 Link Here
341
					}
718
					}
342
				}
719
				}
343
			}
720
			}
344
			if (!foundValue &&
721
			if (!foundValue
345
					(method.modifiers & ClassFileConstants.AccAnnotationDefault) == 0 &&
722
					&& (method.modifiers & ClassFileConstants.AccAnnotationDefault) == 0
346
					(this.bits & IsRecovered) == 0) {
723
					&& (this.bits & IsRecovered) == 0
724
					&& annotationType.isValidBinding()) {
347
				scope.problemReporter().missingValueForAnnotationMember(this, selector);
725
				scope.problemReporter().missingValueForAnnotationMember(this, selector);
348
			}
726
			}
349
		}
727
		}
350
		// check unused pairs
728
		// check unused pairs
351
		for (int i = 0; i < pairsLength; i++) {
729
		for (int i = 0; i < pairsLength; i++) {
352
			if (pairs[i] != null) {
730
			if (pairs[i] != null) {
353
				scope.problemReporter().undefinedAnnotationValue(annotationType, pairs[i]);
731
				if (annotationType.isValidBinding()) {
732
					scope.problemReporter().undefinedAnnotationValue(annotationType, pairs[i]);
733
				}
354
				pairs[i].resolveTypeExpecting(scope, null); // resilient
734
				pairs[i].resolveTypeExpecting(scope, null); // resilient
355
			}
735
			}
356
		}
736
		}
Lines 421-439 Link Here
421
			}
801
			}
422
			// check (meta)target compatibility
802
			// check (meta)target compatibility
423
			checkTargetCompatibility: {
803
			checkTargetCompatibility: {
424
				long metaTagBits = annotationType.getAnnotationTagBits(); // could be forward reference
804
				if (!annotationType.isValidBinding()) {
425
				if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) // does not specify any target restriction
805
					// no need to check annotation usage if missing
426
					break checkTargetCompatibility;
806
					break checkTargetCompatibility;
807
				}
808
809
				long metaTagBits = annotationType.getAnnotationTagBits(); // could be forward reference
810
				if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) {
811
					// does not specify any target restriction - all locations are possible including type annotations
812
					break checkTargetCompatibility;
813
				}
427
814
428
				switch (this.recipient.kind()) {
815
				switch (this.recipient.kind()) {
429
					case Binding.PACKAGE :
816
					case Binding.PACKAGE :
430
						if ((metaTagBits & TagBits.AnnotationForPackage) != 0)
817
						if ((metaTagBits & TagBits.AnnotationForPackage) != 0)
431
							break checkTargetCompatibility;
818
							break checkTargetCompatibility;
432
						break;
819
						break;
820
					case Binding.TYPE_USE :
821
						if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
822
							// jsr 308
823
							break checkTargetCompatibility;
824
						}
825
						break;
433
					case Binding.TYPE :
826
					case Binding.TYPE :
434
					case Binding.GENERIC_TYPE :
827
					case Binding.GENERIC_TYPE :
435
						if (((ReferenceBinding)this.recipient).isAnnotationType()) {
828
						if (((ReferenceBinding)this.recipient).isAnnotationType()) {
436
							if ((metaTagBits & (TagBits.AnnotationForAnnotationType|TagBits.AnnotationForType)) != 0)
829
							if ((metaTagBits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType)) != 0)
437
							break checkTargetCompatibility;
830
							break checkTargetCompatibility;
438
						} else if ((metaTagBits & TagBits.AnnotationForType) != 0) {
831
						} else if ((metaTagBits & TagBits.AnnotationForType) != 0) {
439
							break checkTargetCompatibility;
832
							break checkTargetCompatibility;
Lines 443-466 Link Here
443
						}
836
						}
444
						break;
837
						break;
445
					case Binding.METHOD :
838
					case Binding.METHOD :
446
						if (((MethodBinding)this.recipient).isConstructor()) {
839
						MethodBinding methodBinding = (MethodBinding) this.recipient;
840
						if (methodBinding.isConstructor()) {
447
							if ((metaTagBits & TagBits.AnnotationForConstructor) != 0)
841
							if ((metaTagBits & TagBits.AnnotationForConstructor) != 0)
448
								break checkTargetCompatibility;
842
								break checkTargetCompatibility;
449
						} else 	if ((metaTagBits & TagBits.AnnotationForMethod) != 0)
843
						} else if ((metaTagBits & TagBits.AnnotationForMethod) != 0) {
450
							break checkTargetCompatibility;
844
							break checkTargetCompatibility;
845
						} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
846
							// jsr 308 - annotation on method return type
847
							if (methodBinding.returnType != null && methodBinding.returnType.id == T_void) {
848
								scope.problemReporter().illegalUsageOfTypeAnnotations(this);
849
							}
850
							break checkTargetCompatibility;
851
						}
451
						break;
852
						break;
452
					case Binding.FIELD :
853
					case Binding.FIELD :
453
						if ((metaTagBits & TagBits.AnnotationForField) != 0)
854
						if ((metaTagBits & TagBits.AnnotationForField) != 0) {
454
							break checkTargetCompatibility;
855
							break checkTargetCompatibility;
856
						} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
857
							// jsr 308 - annotation on field type
858
							break checkTargetCompatibility;
859
						}
455
						break;
860
						break;
456
					case Binding.LOCAL :
861
					case Binding.LOCAL :
457
						if ((((LocalVariableBinding)this.recipient).tagBits & TagBits.IsArgument) != 0) {
862
						if ((((LocalVariableBinding)this.recipient).tagBits & TagBits.IsArgument) != 0) {
458
							if ((metaTagBits & TagBits.AnnotationForParameter) != 0)
863
							if ((metaTagBits & TagBits.AnnotationForParameter) != 0) {
459
								break checkTargetCompatibility;
864
								break checkTargetCompatibility;
460
						} else 	if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0)
865
							} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
866
								// jsr 308 - annotation on method parameter type
867
								break checkTargetCompatibility;
868
							}
869
						} else if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0) {
461
							break checkTargetCompatibility;
870
							break checkTargetCompatibility;
871
						} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
872
							// jsr 308 - annotation on local type
873
							break checkTargetCompatibility;
874
						}
462
						break;
875
						break;
463
				}
876
					case Binding.TYPE_PARAMETER : // jsr308
877
						if ((metaTagBits & TagBits.AnnotationForTypeParameter) != 0) {
878
							break checkTargetCompatibility;
879
						}
880
					}
464
				scope.problemReporter().disallowedTargetForAnnotation(this);
881
				scope.problemReporter().disallowedTargetForAnnotation(this);
465
			}
882
			}
466
		}
883
		}
Lines 469-472 Link Here
469
886
470
	public abstract void traverse(ASTVisitor visitor, BlockScope scope);
887
	public abstract void traverse(ASTVisitor visitor, BlockScope scope);
471
888
889
	public abstract void traverse(ASTVisitor visitor, ClassScope scope);
472
}
890
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java (-2 / +9 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 55-61 Link Here
55
59
56
		printIndent(tab, output);
60
		printIndent(tab, output);
57
		printModifiers(this.modifiers, output);
61
		printModifiers(this.modifiers, output);
58
		if (this.annotations != null) printAnnotations(this.annotations, output);
62
		if (this.annotations != null) {
63
			printAnnotations(this.annotations, output);
64
			output.append(' ');
65
		}
59
66
60
		TypeParameter[] typeParams = typeParameters();
67
		TypeParameter[] typeParams = typeParameters();
61
		if (typeParams != null) {
68
		if (typeParams != null) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java (-1 / +4 lines)
Lines 105-111 Link Here
105
105
106
		printIndent(indent, output);
106
		printIndent(indent, output);
107
		printModifiers(this.modifiers, output);
107
		printModifiers(this.modifiers, output);
108
		if (this.annotations != null) printAnnotations(this.annotations, output);
108
		if (this.annotations != null) {
109
			printAnnotations(this.annotations, output);
110
			output.append(' ');
111
		}
109
112
110
		if (this.type == null) {
113
		if (this.type == null) {
111
			output.append("<no type> "); //$NON-NLS-1$
114
			output.append("<no type> "); //$NON-NLS-1$
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java (-2 / +14 lines)
Lines 24-29 Link Here
24
	//dimensions.length gives the number of dimensions, but the
24
	//dimensions.length gives the number of dimensions, but the
25
	// last ones may be nulled as in new int[4][5][][]
25
	// last ones may be nulled as in new int[4][5][][]
26
	public Expression[] dimensions;
26
	public Expression[] dimensions;
27
	public Annotation [][] annotationsOnDimensions; // jsr308 style annotations.
27
	public ArrayInitializer initializer;
28
	public ArrayInitializer initializer;
28
29
29
	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
30
	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
Lines 65-74 Link Here
65
		// array allocation
66
		// array allocation
66
		if (explicitDimCount == 1) {
67
		if (explicitDimCount == 1) {
67
			// Mono-dimensional array
68
			// Mono-dimensional array
68
			codeStream.newArray((ArrayBinding)this.resolvedType);
69
			codeStream.newArray(this.type, (ArrayBinding)this.resolvedType);
69
		} else {
70
		} else {
70
			// Multi-dimensional array
71
			// Multi-dimensional array
71
			codeStream.multianewarray(this.resolvedType, explicitDimCount);
72
			codeStream.multianewarray(this.type, this.resolvedType, explicitDimCount, this.annotationsOnDimensions);
72
		}
73
		}
73
		if (valueRequired) {
74
		if (valueRequired) {
74
			codeStream.generateImplicitConversion(this.implicitConversion);
75
			codeStream.generateImplicitConversion(this.implicitConversion);
Lines 83-88 Link Here
83
		output.append("new "); //$NON-NLS-1$
84
		output.append("new "); //$NON-NLS-1$
84
		this.type.print(0, output);
85
		this.type.print(0, output);
85
		for (int i = 0; i < this.dimensions.length; i++) {
86
		for (int i = 0; i < this.dimensions.length; i++) {
87
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
88
				output.append(' ');
89
				printAnnotations(this.annotationsOnDimensions[i], output);
90
				output.append(' ');
91
			}
86
			if (this.dimensions[i] == null)
92
			if (this.dimensions[i] == null)
87
				output.append("[]"); //$NON-NLS-1$
93
				output.append("[]"); //$NON-NLS-1$
88
			else {
94
			else {
Lines 163-168 Link Here
163
				return null;
169
				return null;
164
			}
170
			}
165
		}
171
		}
172
		if (this.annotationsOnDimensions != null) {
173
			for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
174
				Annotation[] annotations = this.annotationsOnDimensions[i];
175
				resolveAnnotations(scope, annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
176
			}
177
		}
166
		return this.resolvedType;
178
		return this.resolvedType;
167
	}
179
	}
168
180
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java (-1 / +5 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for 
14
 *     Stephan Herrmann - Contributions for 
Lines 56-62 Link Here
56
		int pc = codeStream.position;
60
		int pc = codeStream.position;
57
		int expressionLength = (this.expressions == null) ? 0: this.expressions.length;
61
		int expressionLength = (this.expressions == null) ? 0: this.expressions.length;
58
		codeStream.generateInlinedValue(expressionLength);
62
		codeStream.generateInlinedValue(expressionLength);
59
		codeStream.newArray(this.binding);
63
		codeStream.newArray(null, this.binding);
60
		if (this.expressions != null) {
64
		if (this.expressions != null) {
61
			// binding is an ArrayType, so I can just deal with the dimension
65
			// binding is an ArrayType, so I can just deal with the dimension
62
			int elementsTypeID = this.binding.dimensions > 1 ? -1 : this.binding.leafComponentType.id;
66
			int elementsTypeID = this.binding.dimensions > 1 ? -1 : this.binding.leafComponentType.id;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java (-5 / +90 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 17-32 Link Here
17
21
18
public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
22
public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
19
	int dimensions;
23
	int dimensions;
24
	Annotation[][] annotationsOnDimensions;  // jsr308 style type annotations on dimensions
20
25
21
	public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
26
	public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
22
27
23
		super( sources , poss);
28
		super( sources , poss);
24
		this.dimensions = dim ;
29
		this.dimensions = dim ;
30
		this.annotationsOnDimensions = null; 
31
	}
32
33
	public ArrayQualifiedTypeReference(char[][] sources, int dim, Annotation[][] annotationsOnDimensions, long[] poss) {
34
		this(sources, dim, poss);
35
		this.annotationsOnDimensions = annotationsOnDimensions;
36
		this.bits |= ASTNode.HasTypeAnnotations;
25
	}
37
	}
26
38
27
	public int dimensions() {
39
	public int dimensions() {
28
40
29
		return this.dimensions;
41
		return this.dimensions;
42
	}
43
	
44
	public Annotation[][] getAnnotationsOnDimensions() {
45
		return this.annotationsOnDimensions;
30
	}
46
	}
31
47
32
	/**
48
	/**
Lines 70-85 Link Here
70
		}
86
		}
71
	}
87
	}
72
88
89
	protected TypeBinding internalResolveType(Scope scope) {
90
		TypeBinding internalResolveType = super.internalResolveType(scope);
91
		if (this.annotationsOnDimensions != null) {
92
			switch(scope.kind) {
93
				case Scope.BLOCK_SCOPE :
94
				case Scope.METHOD_SCOPE :
95
					for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
96
						Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
97
						resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
98
					}
99
					break;
100
			}
101
		}
102
		return internalResolveType;
103
	}
104
73
	public StringBuffer printExpression(int indent, StringBuffer output){
105
	public StringBuffer printExpression(int indent, StringBuffer output){
74
106
75
		super.printExpression(indent, output);
107
		super.printExpression(indent, output);
76
		if ((this.bits & IsVarArgs) != 0) {
108
		if ((this.bits & IsVarArgs) != 0) {
77
			for (int i= 0 ; i < this.dimensions - 1; i++) {
109
			for (int i= 0 ; i < this.dimensions - 1; i++) {
110
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
111
					output.append(' ');
112
					printAnnotations(this.annotationsOnDimensions[i], output);
113
					output.append(' ');
114
				}
78
				output.append("[]"); //$NON-NLS-1$
115
				output.append("[]"); //$NON-NLS-1$
116
			}
117
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
118
				output.append(' ');
119
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
120
				output.append(' ');
79
			}
121
			}
80
			output.append("..."); //$NON-NLS-1$
122
			output.append("..."); //$NON-NLS-1$
81
		} else {
123
		} else {
82
			for (int i= 0 ; i < this.dimensions; i++) {
124
			for (int i= 0 ; i < this.dimensions; i++) {
125
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
126
					output.append(" "); //$NON-NLS-1$
127
					printAnnotations(this.annotationsOnDimensions[i], output);
128
					output.append(" "); //$NON-NLS-1$
129
				}
83
				output.append("[]"); //$NON-NLS-1$
130
				output.append("[]"); //$NON-NLS-1$
84
			}
131
			}
85
		}
132
		}
Lines 87-100 Link Here
87
	}
134
	}
88
135
89
	public void traverse(ASTVisitor visitor, BlockScope scope) {
136
	public void traverse(ASTVisitor visitor, BlockScope scope) {
90
137
		if (visitor.visit(this, scope)) {
91
		visitor.visit(this, scope);
138
			if (this.annotations != null) {
139
				int annotationsLength = this.annotations.length;
140
				for (int i = 0; i < annotationsLength; i++)
141
					this.annotations[i].traverse(visitor, scope);
142
			}
143
			if (this.annotationsOnDimensions != null) {
144
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
145
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
146
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
147
						Annotation annotation = annotations2[j];
148
						annotation.traverse(visitor, scope);
149
					}
150
				}
151
			}
152
		}
92
		visitor.endVisit(this, scope);
153
		visitor.endVisit(this, scope);
93
	}
154
	}
94
155
95
	public void traverse(ASTVisitor visitor, ClassScope scope) {
156
	public void traverse(ASTVisitor visitor, ClassScope scope) {
96
157
		if (visitor.visit(this, scope)) {
97
		visitor.visit(this, scope);
158
			if (this.annotations != null) {
159
				int annotationsLength = this.annotations.length;
160
				for (int i = 0; i < annotationsLength; i++)
161
					this.annotations[i].traverse(visitor, scope);
162
			}
163
			if (this.annotationsOnDimensions != null) {
164
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
165
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
166
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
167
						Annotation annotation = annotations2[j];
168
						annotation.traverse(visitor, scope);
169
					}
170
				}
171
			}
172
		}
98
		visitor.endVisit(this, scope);
173
		visitor.endVisit(this, scope);
99
	}
174
	}
175
176
	protected void resolveAnnotations(BlockScope scope) {
177
		super.resolveAnnotations(scope);
178
		if (this.annotationsOnDimensions != null) {
179
			for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
180
				Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
181
				resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
182
			}
183
		}
184
	}
100
}
185
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java (-5 / +96 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 12-17 Link Here
12
16
13
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
18
import org.eclipse.jdt.internal.compiler.ASTVisitor;
19
import org.eclipse.jdt.internal.compiler.lookup.Binding;
15
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
20
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
16
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
21
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
17
import org.eclipse.jdt.internal.compiler.lookup.Scope;
22
import org.eclipse.jdt.internal.compiler.lookup.Scope;
Lines 19-24 Link Here
19
24
20
public class ArrayTypeReference extends SingleTypeReference {
25
public class ArrayTypeReference extends SingleTypeReference {
21
	public int dimensions;
26
	public int dimensions;
27
	public Annotation[][] annotationsOnDimensions; // jsr308 style type annotations on dimensions.
22
	public int originalSourceEnd;
28
	public int originalSourceEnd;
23
29
24
	/**
30
	/**
Lines 32-42 Link Here
32
		super(source, pos);
38
		super(source, pos);
33
		this.originalSourceEnd = this.sourceEnd;
39
		this.originalSourceEnd = this.sourceEnd;
34
		this.dimensions = dimensions ;
40
		this.dimensions = dimensions ;
41
		this.annotationsOnDimensions = null;
42
	}
43
44
	public ArrayTypeReference(char[] source, int dimensions, Annotation[][] annotationsOnDimensions, long pos) {
45
		this(source, dimensions, pos);
46
		if (annotationsOnDimensions != null) {
47
			this.bits |= ASTNode.HasTypeAnnotations;
48
		}
49
		this.annotationsOnDimensions = annotationsOnDimensions;
35
	}
50
	}
36
51
37
	public int dimensions() {
52
	public int dimensions() {
38
53
39
		return this.dimensions;
54
		return this.dimensions;
55
	}
56
	
57
	public Annotation[][] getAnnotationsOnDimensions() {
58
		return this.annotationsOnDimensions;
40
	}
59
	}
41
	/**
60
	/**
42
	 * @return char[][]
61
	 * @return char[][]
Lines 69-79 Link Here
69
		super.printExpression(indent, output);
88
		super.printExpression(indent, output);
70
		if ((this.bits & IsVarArgs) != 0) {
89
		if ((this.bits & IsVarArgs) != 0) {
71
			for (int i= 0 ; i < this.dimensions - 1; i++) {
90
			for (int i= 0 ; i < this.dimensions - 1; i++) {
91
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
92
					output.append(' ');
93
					printAnnotations(this.annotationsOnDimensions[i], output);
94
					output.append(' ');
95
				}
72
				output.append("[]"); //$NON-NLS-1$
96
				output.append("[]"); //$NON-NLS-1$
97
			}
98
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
99
				output.append(' ');
100
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
101
				output.append(' ');
73
			}
102
			}
74
			output.append("..."); //$NON-NLS-1$
103
			output.append("..."); //$NON-NLS-1$
75
		} else {
104
		} else {
76
			for (int i= 0 ; i < this.dimensions; i++) {
105
			for (int i= 0 ; i < this.dimensions; i++) {
106
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
107
					output.append(" "); //$NON-NLS-1$
108
					printAnnotations(this.annotationsOnDimensions[i], output);
109
					output.append(" "); //$NON-NLS-1$
110
				}
77
				output.append("[]"); //$NON-NLS-1$
111
				output.append("[]"); //$NON-NLS-1$
78
			}
112
			}
79
		}
113
		}
Lines 81-94 Link Here
81
	}
115
	}
82
116
83
	public void traverse(ASTVisitor visitor, BlockScope scope) {
117
	public void traverse(ASTVisitor visitor, BlockScope scope) {
84
118
		if (visitor.visit(this, scope)) {
85
		visitor.visit(this, scope);
119
			if (this.annotations != null) {
120
				int annotationsLength = this.annotations.length;
121
				for (int i = 0; i < annotationsLength; i++)
122
					this.annotations[i].traverse(visitor, scope);
123
			}
124
			if (this.annotationsOnDimensions != null) {
125
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
126
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
127
					if (annotations2 != null) {
128
						for (int j = 0, max2 = annotations2.length; j < max2; j++) {
129
							Annotation annotation = annotations2[j];
130
							annotation.traverse(visitor, scope);
131
						}
132
					}
133
				}
134
			}
135
		}
86
		visitor.endVisit(this, scope);
136
		visitor.endVisit(this, scope);
87
	}
137
	}
88
138
89
	public void traverse(ASTVisitor visitor, ClassScope scope) {
139
	public void traverse(ASTVisitor visitor, ClassScope scope) {
90
140
		if (visitor.visit(this, scope)) {
91
		visitor.visit(this, scope);
141
			if (this.annotations != null) {
142
				int annotationsLength = this.annotations.length;
143
				for (int i = 0; i < annotationsLength; i++)
144
					this.annotations[i].traverse(visitor, scope);
145
			}
146
			if (this.annotationsOnDimensions != null) {
147
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
148
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
149
					if (annotations2 != null) {
150
						for (int j = 0, max2 = annotations2.length; j < max2; j++) {
151
							Annotation annotation = annotations2[j];
152
							annotation.traverse(visitor, scope);
153
						}
154
					}
155
				}
156
			}
157
		}
92
		visitor.endVisit(this, scope);
158
		visitor.endVisit(this, scope);
93
	}
159
	}
160
161
	protected TypeBinding internalResolveType(Scope scope) {
162
		TypeBinding internalResolveType = super.internalResolveType(scope);
163
		if (this.annotationsOnDimensions != null) {
164
			switch(scope.kind) {
165
				case Scope.BLOCK_SCOPE :
166
				case Scope.METHOD_SCOPE :
167
					for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
168
						Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
169
						resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
170
					}
171
					break;
172
			}
173
		}
174
		return internalResolveType;
175
	}
176
	protected void resolveAnnotations(BlockScope scope) {
177
		super.resolveAnnotations(scope);
178
		if (this.annotationsOnDimensions != null) {
179
			for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
180
				Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
181
				resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
182
			}
183
		}
184
	}
94
}
185
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java (-2 / +6 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752)
14
 *     Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752)
Lines 408-414 Link Here
408
		if (valueRequired || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
412
		if (valueRequired || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
409
			codeStream.generateConstant(this.constant, this.implicitConversion);
413
			codeStream.generateConstant(this.constant, this.implicitConversion);
410
			if (needRuntimeCheckcast) {
414
			if (needRuntimeCheckcast) {
411
				codeStream.checkcast(this.resolvedType);
415
				codeStream.checkcast(this.type, this.resolvedType);
412
			}
416
			}
413
			if (!valueRequired) {
417
			if (!valueRequired) {
414
				// the resolveType cannot be double or long
418
				// the resolveType cannot be double or long
Lines 420-426 Link Here
420
	}
424
	}
421
	this.expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast);
425
	this.expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast);
422
	if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType.erasure()) { // no need to issue a checkcast if already done as genericCast
426
	if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType.erasure()) { // no need to issue a checkcast if already done as genericCast
423
		codeStream.checkcast(this.resolvedType);
427
		codeStream.checkcast(this.type, this.resolvedType);
424
	}
428
	}
425
	if (valueRequired) {
429
	if (valueRequired) {
426
		codeStream.generateImplicitConversion(this.implicitConversion);
430
		codeStream.generateImplicitConversion(this.implicitConversion);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java (-1 / +5 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 61-67 Link Here
61
65
62
		// in interface case, no caching occurs, since cannot make a cache field for interface
66
		// in interface case, no caching occurs, since cannot make a cache field for interface
63
		if (valueRequired) {
67
		if (valueRequired) {
64
			codeStream.generateClassLiteralAccessForType(this.type.resolvedType, this.syntheticField);
68
			codeStream.generateClassLiteralAccessForType(this.type, this.type.resolvedType, this.syntheticField);
65
			codeStream.generateImplicitConversion(this.implicitConversion);
69
			codeStream.generateImplicitConversion(this.implicitConversion);
66
		}
70
		}
67
		codeStream.recordPositionsFrom(pc, this.sourceStart);
71
		codeStream.recordPositionsFrom(pc, this.sourceStart);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java (+5 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 171-176 Link Here
171
		if (this.assertionSyntheticFieldBinding != null) {
175
		if (this.assertionSyntheticFieldBinding != null) {
172
			// generate code related to the activation of assertion for this class
176
			// generate code related to the activation of assertion for this class
173
			codeStream.generateClassLiteralAccessForType(
177
			codeStream.generateClassLiteralAccessForType(
178
					null,
174
					classScope.outerMostClassScope().enclosingSourceType(),
179
					classScope.outerMostClassScope().enclosingSourceType(),
175
					this.classLiteralSyntheticField);
180
					this.classLiteralSyntheticField);
176
			codeStream.invokeJavaLangClassDesiredAssertionStatus();
181
			codeStream.invokeJavaLangClassDesiredAssertionStatus();
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-1 / +5 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 169-175 Link Here
169
				}
173
				}
170
				codeStream.invoke(Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */);
174
				codeStream.invoke(Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */);
171
			} else {
175
			} else {
172
				codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
176
				codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments);
173
			}
177
			}
174
			codeStream.recordPositionsFrom(pc, this.sourceStart);
178
			codeStream.recordPositionsFrom(pc, this.sourceStart);
175
		} finally {
179
		} finally {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java (-1 / +14 lines)
Lines 5-18 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
15
package org.eclipse.jdt.internal.compiler.ast;
12
16
17
import java.util.List;
18
13
import org.eclipse.jdt.core.compiler.IProblem;
19
import org.eclipse.jdt.core.compiler.IProblem;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
20
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.impl.*;
21
import org.eclipse.jdt.internal.compiler.impl.*;
22
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
16
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
17
import org.eclipse.jdt.internal.compiler.codegen.*;
24
import org.eclipse.jdt.internal.compiler.codegen.*;
18
import org.eclipse.jdt.internal.compiler.flow.*;
25
import org.eclipse.jdt.internal.compiler.flow.*;
Lines 109-115 Link Here
109
	}
116
	}
110
	codeStream.recordPositionsFrom(pc, this.sourceStart);
117
	codeStream.recordPositionsFrom(pc, this.sourceStart);
111
}
118
}
112
119
public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
120
	AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
121
	for (int i = 0, max = this.annotations.length; i < max; i++) {
122
		Annotation annotation = this.annotations[i];
123
		annotation.traverse(collector, (BlockScope) null);
124
	}
125
}
113
/**
126
/**
114
 * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind()
127
 * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind()
115
 */
128
 */
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java (-1 / +7 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
8
 * Contributors:
11
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
12
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
13
 *******************************************************************************/
Lines 87-93 Link Here
87
		if (this.modifiers != 0) {
90
		if (this.modifiers != 0) {
88
			printIndent(indent, output);
91
			printIndent(indent, output);
89
			printModifiers(this.modifiers, output);
92
			printModifiers(this.modifiers, output);
90
			if (this.annotations != null) printAnnotations(this.annotations, output);
93
			if (this.annotations != null) {
94
				printAnnotations(this.annotations, output);
95
				output.append(' ');
96
			}
91
			output.append("{\n"); //$NON-NLS-1$
97
			output.append("{\n"); //$NON-NLS-1$
92
			if (this.block != null) {
98
			if (this.block != null) {
93
				this.block.printBody(indent, output);
99
				this.block.printBody(indent, output);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java (-1 / +5 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 56-62 Link Here
56
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
60
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
57
	int pc = codeStream.position;
61
	int pc = codeStream.position;
58
	this.expression.generateCode(currentScope, codeStream, true);
62
	this.expression.generateCode(currentScope, codeStream, true);
59
	codeStream.instance_of(this.type.resolvedType);
63
	codeStream.instance_of(this.type, this.type.resolvedType);
60
	if (valueRequired) {
64
	if (valueRequired) {
61
		codeStream.generateImplicitConversion(this.implicitConversion);
65
		codeStream.generateImplicitConversion(this.implicitConversion);
62
	} else {
66
	} else {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java (-1 / +9 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 30-35 Link Here
30
	public TypeReference copyDims(int dim) {
34
	public TypeReference copyDims(int dim) {
31
		return null;
35
		return null;
32
	}
36
	}
37
	
38
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) {
39
		return null;
40
	}
33
41
34
	/* (non-Javadoc)
42
	/* (non-Javadoc)
35
	 * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
43
	 * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (+21 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
14
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
Lines 19-26 Link Here
19
 *******************************************************************************/
23
 *******************************************************************************/
20
package org.eclipse.jdt.internal.compiler.ast;
24
package org.eclipse.jdt.internal.compiler.ast;
21
25
26
import java.util.List;
27
22
import org.eclipse.jdt.internal.compiler.ASTVisitor;
28
import org.eclipse.jdt.internal.compiler.ASTVisitor;
23
import org.eclipse.jdt.internal.compiler.impl.*;
29
import org.eclipse.jdt.internal.compiler.impl.*;
30
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
24
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
31
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
25
import org.eclipse.jdt.internal.compiler.codegen.*;
32
import org.eclipse.jdt.internal.compiler.codegen.*;
26
import org.eclipse.jdt.internal.compiler.flow.*;
33
import org.eclipse.jdt.internal.compiler.flow.*;
Lines 189-199 Link Here
189
		return LOCAL_VARIABLE;
196
		return LOCAL_VARIABLE;
190
	}
197
	}
191
198
199
	// for local variables
200
	public void getAllAnnotationContexts(int targetType, LocalVariableBinding localVariable, List allAnnotationContexts) {
201
		AnnotationCollector collector = new AnnotationCollector(this, targetType, localVariable, allAnnotationContexts);
202
		this.traverse(collector, (BlockScope) null);
203
	}
204
	// for arguments
205
	public void getAllAnnotationContexts(int targetType, int parameterIndex, List allAnnotationContexts) {
206
		AnnotationCollector collector = new AnnotationCollector(this, targetType, parameterIndex, allAnnotationContexts);
207
		this.traverse(collector, (BlockScope) null);
208
	}
209
	public boolean isArgument() {
210
		return false;
211
	}
192
	public void resolve(BlockScope scope) {
212
	public void resolve(BlockScope scope) {
193
213
194
		// create a binding and add it to the scope
214
		// create a binding and add it to the scope
195
		TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/);
215
		TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/);
196
216
217
		this.bits |= (this.type.bits & ASTNode.HasTypeAnnotations);
197
		checkModifiers();
218
		checkModifiers();
198
		if (variableType != null) {
219
		if (variableType != null) {
199
			if (variableType == TypeBinding.VOID) {
220
			if (variableType == TypeBinding.VOID) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java (-1 / +13 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
2
 * Copyright (c) 2005, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 42-45 Link Here
42
		}
46
		}
43
		visitor.endVisit(this, scope);
47
		visitor.endVisit(this, scope);
44
	}
48
	}
49
	public void traverse(ASTVisitor visitor, ClassScope scope) {
50
		if (visitor.visit(this, scope)) {
51
			if (this.type != null) {
52
				this.type.traverse(visitor, scope);
53
			}
54
		}
55
		visitor.endVisit(this, scope);
56
	}
45
}
57
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java (+13 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 17-22 Link Here
17
import org.eclipse.jdt.internal.compiler.impl.Constant;
21
import org.eclipse.jdt.internal.compiler.impl.Constant;
18
import org.eclipse.jdt.internal.compiler.lookup.Binding;
22
import org.eclipse.jdt.internal.compiler.lookup.Binding;
19
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
23
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
24
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
20
import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair;
25
import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair;
21
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
22
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
Lines 241-244 Link Here
241
		}
246
		}
242
		visitor.endVisit(this, scope);
247
		visitor.endVisit(this, scope);
243
	}
248
	}
249
	public void traverse(ASTVisitor visitor, ClassScope scope) {
250
		if (visitor.visit(this, scope)) {
251
			if (this.value != null) {
252
				this.value.traverse(visitor, scope);
253
			}
254
		}
255
		visitor.endVisit(this, scope);
256
	}
244
}
257
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-4 / +8 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752)
14
 *     Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752)
Lines 230-242 Link Here
230
	if (this.syntheticAccessor == null){
234
	if (this.syntheticAccessor == null){
231
		TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenBinding, this.actualReceiverType, this.receiver.isImplicitThis());
235
		TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenBinding, this.actualReceiverType, this.receiver.isImplicitThis());
232
		if (isStatic){
236
		if (isStatic){
233
			codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass);
237
			codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
234
		} else if((this.receiver.isSuper()) || codegenBinding.isPrivate()){
238
		} else if((this.receiver.isSuper()) || codegenBinding.isPrivate()){
235
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass);
239
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
236
		} else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
240
		} else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
237
			codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass);
241
			codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
238
		} else {
242
		} else {
239
			codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass);
243
			codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
240
		}
244
		}
241
	} else {
245
	} else {
242
		codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessor, null /* default declaringClass */);
246
		codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessor, null /* default declaringClass */);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java (-1 / +21 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 15-20 Link Here
15
 *******************************************************************************/
19
 *******************************************************************************/
16
package org.eclipse.jdt.internal.compiler.ast;
20
package org.eclipse.jdt.internal.compiler.ast;
17
21
22
import java.util.List;
23
18
import org.eclipse.jdt.core.compiler.CharOperation;
24
import org.eclipse.jdt.core.compiler.CharOperation;
19
import org.eclipse.jdt.internal.compiler.ASTVisitor;
25
import org.eclipse.jdt.internal.compiler.ASTVisitor;
20
import org.eclipse.jdt.internal.compiler.CompilationResult;
26
import org.eclipse.jdt.internal.compiler.CompilationResult;
Lines 24-29 Link Here
24
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
30
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
25
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
31
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
26
import org.eclipse.jdt.internal.compiler.lookup.Binding;
32
import org.eclipse.jdt.internal.compiler.lookup.Binding;
33
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
27
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
34
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
28
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
35
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
29
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
36
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
Lines 35-40 Link Here
35
import org.eclipse.jdt.internal.compiler.parser.Parser;
42
import org.eclipse.jdt.internal.compiler.parser.Parser;
36
import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
43
import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
37
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
44
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
45
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
38
46
39
public class MethodDeclaration extends AbstractMethodDeclaration {
47
public class MethodDeclaration extends AbstractMethodDeclaration {
40
48
Lines 146-151 Link Here
146
		}
154
		}
147
	}
155
	}
148
156
157
	public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
158
		AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
159
		for (int i = 0, max = this.annotations.length; i < max; i++) {
160
			Annotation annotation = this.annotations[i];
161
			annotation.traverse(collector, (BlockScope) null);
162
		}
163
	}
164
149
	public boolean isMethod() {
165
	public boolean isMethod() {
150
		return true;
166
		return true;
151
	}
167
	}
Lines 163-168 Link Here
163
	public void resolveStatements() {
179
	public void resolveStatements() {
164
		// ========= abort on fatal error =============
180
		// ========= abort on fatal error =============
165
		if (this.returnType != null && this.binding != null) {
181
		if (this.returnType != null && this.binding != null) {
182
			this.bits |= (this.returnType.bits & ASTNode.HasTypeAnnotations);
166
			this.returnType.resolvedType = this.binding.returnType;
183
			this.returnType.resolvedType = this.binding.returnType;
167
			// record the return type binding
184
			// record the return type binding
168
		}
185
		}
Lines 177-183 Link Here
177
		}
194
		}
178
		if (this.typeParameters != null) {
195
		if (this.typeParameters != null) {
179
			for (int i = 0, length = this.typeParameters.length; i < length; i++) {
196
			for (int i = 0, length = this.typeParameters.length; i < length; i++) {
180
				this.typeParameters[i].resolve(this.scope);
197
				TypeParameter typeParameter = this.typeParameters[i];
198
				this.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
199
				typeParameter.resolve(this.scope);
200
				typeParameter.resolveAnnotations(this.scope);
181
				if (returnsUndeclTypeVar && this.typeParameters[i].binding == this.returnType.resolvedType) {
201
				if (returnsUndeclTypeVar && this.typeParameters[i].binding == this.returnType.resolvedType) {
182
					returnsUndeclTypeVar = false;
202
					returnsUndeclTypeVar = false;
183
				}
203
				}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java (-1 / +18 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 71-74 Link Here
71
		}
75
		}
72
		visitor.endVisit(this, scope);
76
		visitor.endVisit(this, scope);
73
	}
77
	}
78
	public void traverse(ASTVisitor visitor, ClassScope scope) {
79
		if (visitor.visit(this, scope)) {
80
			if (this.type != null) {
81
				this.type.traverse(visitor, scope);
82
			}
83
			if (this.memberValuePairs != null) {
84
				int memberValuePairsLength = this.memberValuePairs.length;
85
				for (int i = 0; i < memberValuePairsLength; i++)
86
					this.memberValuePairs[i].traverse(visitor, scope);
87
			}
88
		}
89
		visitor.endVisit(this, scope);
90
	}
74
}
91
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java (-1 / +71 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 35-40 Link Here
35
		super(tokens, dim, positions);
39
		super(tokens, dim, positions);
36
		this.typeArguments = typeArguments;
40
		this.typeArguments = typeArguments;
37
	}
41
	}
42
	public ParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, int dim, Annotation[][] annotationsOnDimensions, long[] positions) {
43
		this(tokens, typeArguments, dim, positions);
44
		this.annotationsOnDimensions = annotationsOnDimensions;
45
		if (annotationsOnDimensions != null) {
46
			this.bits |= ASTNode.HasTypeAnnotations;
47
		}
48
	}
38
	public void checkBounds(Scope scope) {
49
	public void checkBounds(Scope scope) {
39
		if (this.resolvedType == null) return;
50
		if (this.resolvedType == null) return;
40
51
Lines 59-64 Link Here
59
	}
70
	}
60
	public TypeReference copyDims(int dim){
71
	public TypeReference copyDims(int dim){
61
		return new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, this.sourcePositions);
72
		return new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, this.sourcePositions);
73
	}
74
	public TypeReference copyDims(int dim, Annotation[][] dimensionAnnotations){
75
		ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, dimensionAnnotations, this.sourcePositions);
76
		parameterizedQualifiedTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
77
		if (dimensionAnnotations != null) {
78
			parameterizedQualifiedTypeReference.bits |= ASTNode.HasTypeAnnotations;
79
		}
80
		return parameterizedQualifiedTypeReference;
81
	}
82
	public boolean isParameterizedTypeReference() {
83
		return true;
62
	}
84
	}
63
85
64
	/**
86
	/**
Lines 300-305 Link Here
300
	}
322
	}
301
323
302
	public StringBuffer printExpression(int indent, StringBuffer output) {
324
	public StringBuffer printExpression(int indent, StringBuffer output) {
325
		if (this.annotations != null) {
326
			output.append(" "); //$NON-NLS-1$
327
			printAnnotations(this.annotations, output);
328
			output.append(' ');
329
		}
303
		int length = this.tokens.length;
330
		int length = this.tokens.length;
304
		for (int i = 0; i < length - 1; i++) {
331
		for (int i = 0; i < length - 1; i++) {
305
			output.append(this.tokens[i]);
332
			output.append(this.tokens[i]);
Lines 336-346 Link Here
336
		}
363
		}
337
		if ((this.bits & IsVarArgs) != 0) {
364
		if ((this.bits & IsVarArgs) != 0) {
338
			for (int i= 0 ; i < this.dimensions - 1; i++) {
365
			for (int i= 0 ; i < this.dimensions - 1; i++) {
366
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
367
					output.append(" "); //$NON-NLS-1$
368
					printAnnotations(this.annotationsOnDimensions[i], output);
369
					output.append(" "); //$NON-NLS-1$
370
				}
339
				output.append("[]"); //$NON-NLS-1$
371
				output.append("[]"); //$NON-NLS-1$
372
			}
373
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
374
				output.append(" "); //$NON-NLS-1$
375
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
376
				output.append(" "); //$NON-NLS-1$
340
			}
377
			}
341
			output.append("..."); //$NON-NLS-1$
378
			output.append("..."); //$NON-NLS-1$
342
		} else {
379
		} else {
343
			for (int i= 0 ; i < this.dimensions; i++) {
380
			for (int i= 0 ; i < this.dimensions; i++) {
381
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
382
					output.append(" "); //$NON-NLS-1$
383
					printAnnotations(this.annotationsOnDimensions[i], output);
384
					output.append(" "); //$NON-NLS-1$
385
				}
344
				output.append("[]"); //$NON-NLS-1$
386
				output.append("[]"); //$NON-NLS-1$
345
			}
387
			}
346
		}
388
		}
Lines 355-360 Link Here
355
	}
397
	}
356
	public void traverse(ASTVisitor visitor, BlockScope scope) {
398
	public void traverse(ASTVisitor visitor, BlockScope scope) {
357
		if (visitor.visit(this, scope)) {
399
		if (visitor.visit(this, scope)) {
400
			if (this.annotations != null) {
401
				int annotationsLength = this.annotations.length;
402
				for (int i = 0; i < annotationsLength; i++)
403
					this.annotations[i].traverse(visitor, scope);
404
			}
405
			if (this.annotationsOnDimensions != null) {
406
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
407
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
408
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
409
						Annotation annotation = annotations2[j];
410
						annotation.traverse(visitor, scope);
411
					}
412
				}
413
			}
358
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
414
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
359
				if (this.typeArguments[i] != null) {
415
				if (this.typeArguments[i] != null) {
360
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
416
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
Lines 368-373 Link Here
368
424
369
	public void traverse(ASTVisitor visitor, ClassScope scope) {
425
	public void traverse(ASTVisitor visitor, ClassScope scope) {
370
		if (visitor.visit(this, scope)) {
426
		if (visitor.visit(this, scope)) {
427
			if (this.annotations != null) {
428
				int annotationsLength = this.annotations.length;
429
				for (int i = 0; i < annotationsLength; i++)
430
					this.annotations[i].traverse(visitor, scope);
431
			}
432
			if (this.annotationsOnDimensions != null) {
433
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
434
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
435
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
436
						Annotation annotation = annotations2[j];
437
						annotation.traverse(visitor, scope);
438
					}
439
				}
440
			}
371
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
441
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
372
				if (this.typeArguments[i] != null) {
442
				if (this.typeArguments[i] != null) {
373
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
443
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-3 / +72 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 30-35 Link Here
30
		this.originalSourceEnd = this.sourceEnd;
34
		this.originalSourceEnd = this.sourceEnd;
31
		this.typeArguments = typeArguments;
35
		this.typeArguments = typeArguments;
32
	}
36
	}
37
	public ParameterizedSingleTypeReference(char[] name, TypeReference[] typeArguments, int dim, Annotation[][] annotationsOnDimensions, long pos) {
38
		this(name, typeArguments, dim, pos);
39
		this.annotationsOnDimensions = annotationsOnDimensions;
40
		if (annotationsOnDimensions != null) {
41
			this.bits |= ASTNode.HasTypeAnnotations;
42
		}
43
	}
33
	public void checkBounds(Scope scope) {
44
	public void checkBounds(Scope scope) {
34
		if (this.resolvedType == null) return;
45
		if (this.resolvedType == null) return;
35
46
Lines 48-53 Link Here
48
	 */
59
	 */
49
	public TypeReference copyDims(int dim) {
60
	public TypeReference copyDims(int dim) {
50
		return new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, (((long)this.sourceStart)<<32)+this.sourceEnd);
61
		return new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, (((long)this.sourceStart)<<32)+this.sourceEnd);
62
	}
63
	public TypeReference copyDims(int dim, Annotation [][] annotationsOnDims) {
64
		ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, annotationsOnDims, (((long)this.sourceStart)<<32)+this.sourceEnd);
65
		parameterizedSingleTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
66
		if (annotationsOnDims != null) {
67
			parameterizedSingleTypeReference.bits |= ASTNode.HasTypeAnnotations;
68
		}
69
		return parameterizedSingleTypeReference;
51
	}
70
	}
52
71
53
	/**
72
	/**
Lines 81-86 Link Here
81
     */
100
     */
82
    protected TypeBinding getTypeBinding(Scope scope) {
101
    protected TypeBinding getTypeBinding(Scope scope) {
83
        return null; // not supported here - combined with resolveType(...)
102
        return null; // not supported here - combined with resolveType(...)
103
    }
104
    
105
    public boolean isParameterizedTypeReference() {
106
    	return true;
84
    }
107
    }
85
108
86
    /*
109
    /*
Lines 186-196 Link Here
186
		boolean argHasError = false;
209
		boolean argHasError = false;
187
		ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
210
		ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
188
		for (int i = 0; i < argLength; i++) {
211
		for (int i = 0; i < argLength; i++) {
189
		    TypeReference typeArgument = this.typeArguments[i];
212
			TypeReference typeArgument = this.typeArguments[i];
190
		    TypeBinding argType = isClassScope
213
		    TypeBinding argType = isClassScope
191
				? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i)
214
				? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i)
192
				: typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i);
215
				: typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i);
193
		     if (argType == null) {
216
			this.bits |= (typeArgument.bits & ASTNode.HasTypeAnnotations);
217
			if (argType == null) {
194
		         argHasError = true;
218
		         argHasError = true;
195
		     } else {
219
		     } else {
196
			    argTypes[i] = argType;
220
			    argTypes[i] = argType;
Lines 277-287 Link Here
277
		output.append(">"); //$NON-NLS-1$
301
		output.append(">"); //$NON-NLS-1$
278
		if ((this.bits & IsVarArgs) != 0) {
302
		if ((this.bits & IsVarArgs) != 0) {
279
			for (int i= 0 ; i < this.dimensions - 1; i++) {
303
			for (int i= 0 ; i < this.dimensions - 1; i++) {
304
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
305
					output.append(" "); //$NON-NLS-1$
306
					printAnnotations(this.annotationsOnDimensions[i], output);
307
					output.append(" "); //$NON-NLS-1$
308
				}
280
				output.append("[]"); //$NON-NLS-1$
309
				output.append("[]"); //$NON-NLS-1$
310
			}
311
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
312
				output.append(" "); //$NON-NLS-1$
313
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
314
				output.append(" "); //$NON-NLS-1$
281
			}
315
			}
282
			output.append("..."); //$NON-NLS-1$
316
			output.append("..."); //$NON-NLS-1$
283
		} else {
317
		} else {
284
			for (int i= 0 ; i < this.dimensions; i++) {
318
			for (int i= 0 ; i < this.dimensions; i++) {
319
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
320
					output.append(" "); //$NON-NLS-1$
321
					printAnnotations(this.annotationsOnDimensions[i], output);
322
					output.append(" "); //$NON-NLS-1$
323
				}
285
				output.append("[]"); //$NON-NLS-1$
324
				output.append("[]"); //$NON-NLS-1$
286
			}
325
			}
287
		}
326
		}
Lines 302-307 Link Here
302
341
303
	public void traverse(ASTVisitor visitor, BlockScope scope) {
342
	public void traverse(ASTVisitor visitor, BlockScope scope) {
304
		if (visitor.visit(this, scope)) {
343
		if (visitor.visit(this, scope)) {
344
			if (this.annotations != null) {
345
				int annotationsLength = this.annotations.length;
346
				for (int i = 0; i < annotationsLength; i++)
347
					this.annotations[i].traverse(visitor, scope);
348
			}
349
			if (this.annotationsOnDimensions != null) {
350
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
351
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
352
					if (annotations2 != null) {
353
						for (int j = 0, max2 = annotations2.length; j < max2; j++) {
354
							Annotation annotation = annotations2[j];
355
							annotation.traverse(visitor, scope);
356
						}
357
					}
358
				}
359
			}
305
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
360
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
306
				this.typeArguments[i].traverse(visitor, scope);
361
				this.typeArguments[i].traverse(visitor, scope);
307
			}
362
			}
Lines 311-316 Link Here
311
366
312
	public void traverse(ASTVisitor visitor, ClassScope scope) {
367
	public void traverse(ASTVisitor visitor, ClassScope scope) {
313
		if (visitor.visit(this, scope)) {
368
		if (visitor.visit(this, scope)) {
369
			if (this.annotations != null) {
370
				int annotationsLength = this.annotations.length;
371
				for (int i = 0; i < annotationsLength; i++)
372
					this.annotations[i].traverse(visitor, scope);
373
			}
374
			if (this.annotationsOnDimensions != null) {
375
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
376
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
377
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
378
						Annotation annotation = annotations2[j];
379
						annotation.traverse(visitor, scope);
380
					}
381
				}
382
			}
314
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
383
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
315
				this.typeArguments[i].traverse(visitor, scope);
384
				this.typeArguments[i].traverse(visitor, scope);
316
			}
385
			}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-2 / +6 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 140-146 Link Here
140
		int pc = codeStream.position;
144
		int pc = codeStream.position;
141
		MethodBinding codegenBinding = this.binding.original();
145
		MethodBinding codegenBinding = this.binding.original();
142
		ReferenceBinding allocatedType = codegenBinding.declaringClass;
146
		ReferenceBinding allocatedType = codegenBinding.declaringClass;
143
		codeStream.new_(allocatedType);
147
		codeStream.new_(this.type, allocatedType);
144
		boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
148
		boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
145
		if (valueRequired || isUnboxing) {
149
		if (valueRequired || isUnboxing) {
146
			codeStream.dup();
150
			codeStream.dup();
Lines 173-179 Link Here
173
177
174
		// invoke constructor
178
		// invoke constructor
175
		if (this.syntheticAccessor == null) {
179
		if (this.syntheticAccessor == null) {
176
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
180
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments);
177
		} else {
181
		} else {
178
			// synthetic accessor got some extra arguments appended to its signature, which need values
182
			// synthetic accessor got some extra arguments appended to its signature, which need values
179
			for (int i = 0,
183
			for (int i = 0,
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java (-6 / +34 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 32-37 Link Here
32
		//return a type reference copy of me with some dimensions
36
		//return a type reference copy of me with some dimensions
33
		//warning : the new type ref has a null binding
37
		//warning : the new type ref has a null binding
34
		return new ArrayQualifiedTypeReference(this.tokens, dim, this.sourcePositions);
38
		return new ArrayQualifiedTypeReference(this.tokens, dim, this.sourcePositions);
39
	}
40
	
41
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) {
42
		//return a type reference copy of me with some dimensions
43
		//warning : the new type ref has a null binding
44
		ArrayQualifiedTypeReference arrayQualifiedTypeReference = new ArrayQualifiedTypeReference(this.tokens, dim, annotationsOnDimensions, this.sourcePositions);
45
		arrayQualifiedTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
46
		if (annotationsOnDimensions != null) {
47
			arrayQualifiedTypeReference.bits |= ASTNode.HasTypeAnnotations;
48
		}
49
		return arrayQualifiedTypeReference;
35
	}
50
	}
36
51
37
	protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) {
52
	protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) {
Lines 122-128 Link Here
122
	}
137
	}
123
138
124
	public StringBuffer printExpression(int indent, StringBuffer output) {
139
	public StringBuffer printExpression(int indent, StringBuffer output) {
125
140
		if (this.annotations != null) {
141
			printAnnotations(this.annotations, output);
142
			output.append(' ');
143
		}
126
		for (int i = 0; i < this.tokens.length; i++) {
144
		for (int i = 0; i < this.tokens.length; i++) {
127
			if (i > 0) output.append('.');
145
			if (i > 0) output.append('.');
128
			output.append(this.tokens[i]);
146
			output.append(this.tokens[i]);
Lines 131-144 Link Here
131
	}
149
	}
132
150
133
	public void traverse(ASTVisitor visitor, BlockScope scope) {
151
	public void traverse(ASTVisitor visitor, BlockScope scope) {
134
152
		if (visitor.visit(this, scope)) {
135
		visitor.visit(this, scope);
153
			if (this.annotations != null) {
154
				int annotationsLength = this.annotations.length;
155
				for (int i = 0; i < annotationsLength; i++)
156
					this.annotations[i].traverse(visitor, scope);
157
			}
158
		}
136
		visitor.endVisit(this, scope);
159
		visitor.endVisit(this, scope);
137
	}
160
	}
138
161
139
	public void traverse(ASTVisitor visitor, ClassScope scope) {
162
	public void traverse(ASTVisitor visitor, ClassScope scope) {
140
163
		if (visitor.visit(this, scope)) {
141
		visitor.visit(this, scope);
164
			if (this.annotations != null) {
165
				int annotationsLength = this.annotations.length;
166
				for (int i = 0; i < annotationsLength; i++)
167
					this.annotations[i].traverse(visitor, scope);
168
			}
169
		}
142
		visitor.endVisit(this, scope);
170
		visitor.endVisit(this, scope);
143
	}
171
	}
144
}
172
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java (-1 / +17 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 62-65 Link Here
62
		}
66
		}
63
		visitor.endVisit(this, scope);
67
		visitor.endVisit(this, scope);
64
	}
68
	}
69
70
	public void traverse(ASTVisitor visitor, ClassScope scope) {
71
		if (visitor.visit(this, scope)) {
72
			if (this.type != null) {
73
				this.type.traverse(visitor, scope);
74
			}
75
			if (this.memberValue != null) {
76
				this.memberValue.traverse(visitor, scope);
77
			}
78
		}
79
		visitor.endVisit(this, scope);
80
	}
65
}
81
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java (-4 / +34 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
Lines 33-38 Link Here
33
37
34
		return new ArrayTypeReference(this.token, dim,(((long)this.sourceStart)<<32)+this.sourceEnd);
38
		return new ArrayTypeReference(this.token, dim,(((long)this.sourceStart)<<32)+this.sourceEnd);
35
	}
39
	}
40
	
41
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){
42
		//return a type reference copy of me with some dimensions
43
		//warning : the new type ref has a null binding
44
		ArrayTypeReference arrayTypeReference = new ArrayTypeReference(this.token, dim, annotationsOnDimensions, (((long)this.sourceStart)<<32)+this.sourceEnd);
45
		arrayTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
46
		if (annotationsOnDimensions != null) {
47
			arrayTypeReference.bits |= ASTNode.HasTypeAnnotations;
48
		}
49
		return arrayTypeReference;
50
	}
36
51
37
	public char[] getLastToken() {
52
	public char[] getLastToken() {
38
		return this.token;
53
		return this.token;
Lines 54-60 Link Here
54
	}
69
	}
55
70
56
	public StringBuffer printExpression(int indent, StringBuffer output){
71
	public StringBuffer printExpression(int indent, StringBuffer output){
57
72
		if (this.annotations != null) {
73
			printAnnotations(this.annotations, output);
74
			output.append(' ');
75
		}
58
		return output.append(this.token);
76
		return output.append(this.token);
59
	}
77
	}
60
78
Lines 85-96 Link Here
85
	}
103
	}
86
104
87
	public void traverse(ASTVisitor visitor, BlockScope scope) {
105
	public void traverse(ASTVisitor visitor, BlockScope scope) {
88
		visitor.visit(this, scope);
106
		if (visitor.visit(this, scope)) {
107
			if (this.annotations != null) {
108
				int annotationsLength = this.annotations.length;
109
				for (int i = 0; i < annotationsLength; i++)
110
					this.annotations[i].traverse(visitor, scope);
111
			}
112
		}
89
		visitor.endVisit(this, scope);
113
		visitor.endVisit(this, scope);
90
	}
114
	}
91
115
92
	public void traverse(ASTVisitor visitor, ClassScope scope) {
116
	public void traverse(ASTVisitor visitor, ClassScope scope) {
93
		visitor.visit(this, scope);
117
		if (visitor.visit(this, scope)) {
118
			if (this.annotations != null) {
119
				int annotationsLength = this.annotations.length;
120
				for (int i = 0; i < annotationsLength; i++)
121
					this.annotations[i].traverse(visitor, scope);
122
			}
123
		}
94
		visitor.endVisit(this, scope);
124
		visitor.endVisit(this, scope);
95
	}
125
	}
96
}
126
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java (-3 / +7 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 172-178 Link Here
172
			// called with (argLength - lastIndex) elements : foo(1, 2) or foo(1, 2, 3, 4)
176
			// called with (argLength - lastIndex) elements : foo(1, 2) or foo(1, 2, 3, 4)
173
			// need to gen elements into an array, then gen each remaining element into created array
177
			// need to gen elements into an array, then gen each remaining element into created array
174
			codeStream.generateInlinedValue(argLength - varArgIndex);
178
			codeStream.generateInlinedValue(argLength - varArgIndex);
175
			codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
179
			codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
176
			for (int i = varArgIndex; i < argLength; i++) {
180
			for (int i = varArgIndex; i < argLength; i++) {
177
				codeStream.dup();
181
				codeStream.dup();
178
				codeStream.generateInlinedValue(i - varArgIndex);
182
				codeStream.generateInlinedValue(i - varArgIndex);
Lines 191-197 Link Here
191
				// right number but not directly compatible or too many arguments - wrap extra into array
195
				// right number but not directly compatible or too many arguments - wrap extra into array
192
				// need to gen elements into an array, then gen each remaining element into created array
196
				// need to gen elements into an array, then gen each remaining element into created array
193
				codeStream.generateInlinedValue(1);
197
				codeStream.generateInlinedValue(1);
194
				codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
198
				codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
195
				codeStream.dup();
199
				codeStream.dup();
196
				codeStream.generateInlinedValue(0);
200
				codeStream.generateInlinedValue(0);
197
				arguments[varArgIndex].generateCode(currentScope, codeStream, true);
201
				arguments[varArgIndex].generateCode(currentScope, codeStream, true);
Lines 201-207 Link Here
201
			// scenario: foo(1) --> foo(1, new int[0])
205
			// scenario: foo(1) --> foo(1, new int[0])
202
			// generate code for an empty array of parameterType
206
			// generate code for an empty array of parameterType
203
			codeStream.generateInlinedValue(0);
207
			codeStream.generateInlinedValue(0);
204
			codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
208
			codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
205
		}
209
		}
206
	} else if (arguments != null) { // standard generation for method arguments
210
	} else if (arguments != null) { // standard generation for method arguments
207
		for (int i = 0, max = arguments.length; i < max; i++)
211
		for (int i = 0, max = arguments.length; i < max; i++)
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-1 / +21 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for Bug 360328 - [compiler][null] detect null problems in nested code (local class inside a loop)
14
 *     Stephan Herrmann - Contribution for Bug 360328 - [compiler][null] detect null problems in nested code (local class inside a loop)
Lines 906-912 Link Here
906
910
907
public StringBuffer printHeader(int indent, StringBuffer output) {
911
public StringBuffer printHeader(int indent, StringBuffer output) {
908
	printModifiers(this.modifiers, output);
912
	printModifiers(this.modifiers, output);
909
	if (this.annotations != null) printAnnotations(this.annotations, output);
913
	if (this.annotations != null) {
914
		printAnnotations(this.annotations, output);
915
		output.append(' ');
916
	}
910
917
911
	switch (kind(this.modifiers)) {
918
	switch (kind(this.modifiers)) {
912
		case TypeDeclaration.CLASS_DECL :
919
		case TypeDeclaration.CLASS_DECL :
Lines 971-976 Link Here
971
		try {
978
		try {
972
			this.staticInitializerScope.insideTypeAnnotation = true;
979
			this.staticInitializerScope.insideTypeAnnotation = true;
973
			resolveAnnotations(this.staticInitializerScope, this.annotations, sourceType);
980
			resolveAnnotations(this.staticInitializerScope, this.annotations, sourceType);
981
			if (this.superclass != null) {
982
				this.superclass.resolveAnnotations(this.staticInitializerScope);
983
			}
984
			if (this.superInterfaces != null) {
985
				for (int i = 0, max = this.superInterfaces.length; i < max; i++) {
986
					this.superInterfaces[i].resolveAnnotations(this.staticInitializerScope);
987
				}
988
			}
989
			if (this.typeParameters != null) {
990
				for (int i = 0, count = this.typeParameters.length; i < count; i++) {
991
					this.typeParameters[i].resolveAnnotations(this.staticInitializerScope);
992
				}
993
			}
974
		} finally {
994
		} finally {
975
			this.staticInitializerScope.insideTypeAnnotation = old;
995
			this.staticInitializerScope.insideTypeAnnotation = old;
976
		}
996
		}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java (-3 / +68 lines)
Lines 1-16 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
15
package org.eclipse.jdt.internal.compiler.ast;
12
16
17
import java.util.List;
18
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
19
import org.eclipse.jdt.internal.compiler.ASTVisitor;
20
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
21
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
14
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
22
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
15
import org.eclipse.jdt.internal.compiler.lookup.Binding;
23
import org.eclipse.jdt.internal.compiler.lookup.Binding;
16
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
24
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
Lines 42-49 Link Here
42
		}
50
		}
43
	}
51
	}
44
52
53
	public void getAllAnnotationContexts(int targetType, int typeParameterIndex, List allAnnotationContexts) {
54
		AnnotationCollector collector = new AnnotationCollector(this, targetType, typeParameterIndex, allAnnotationContexts);
55
		if (this.annotations != null) {
56
			int annotationsLength = this.annotations.length;
57
			for (int i = 0; i < annotationsLength; i++)
58
				this.annotations[i].traverse(collector, (BlockScope) null);
59
		}
60
		switch(collector.targetType) {
61
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
62
				collector.targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND;
63
				break;
64
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
65
				collector.targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND;
66
		}
67
		if (this.type != null && ((this.type.bits & ASTNode.HasTypeAnnotations) != 0)) {
68
			collector.info2 = 0;
69
			this.type.traverse(collector, (BlockScope) null);
70
		}
71
		if (this.bounds != null) {
72
			int boundsLength = this.bounds.length;
73
			for (int i = 0; i < boundsLength; i++) {
74
				TypeReference bound = this.bounds[i];
75
				if ((bound.bits & ASTNode.HasTypeAnnotations) == 0) {
76
					continue;
77
				}
78
				collector.info2 = i + 1;
79
				bound.traverse(collector, (BlockScope) null);
80
			}
81
		}
82
	}
45
	private void internalResolve(Scope scope, boolean staticContext) {
83
	private void internalResolve(Scope scope, boolean staticContext) {
46
	    // detect variable/type name collisions
84
		// detect variable/type name collisions
47
		if (this.binding != null) {
85
		if (this.binding != null) {
48
			Binding existingType = scope.parent.getBinding(this.name, Binding.TYPE, this, false/*do not resolve hidden field*/);
86
			Binding existingType = scope.parent.getBinding(this.name, Binding.TYPE, this, false/*do not resolve hidden field*/);
49
			if (existingType != null
87
			if (existingType != null
Lines 63-72 Link Here
63
		internalResolve(scope, scope.enclosingSourceType().isStatic());
101
		internalResolve(scope, scope.enclosingSourceType().isStatic());
64
	}
102
	}
65
103
104
	public void resolveAnnotations(BlockScope scope) {
105
		if (this.annotations != null) {
106
			resolveAnnotations(scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_PARAMETER));
107
		}
108
		if (this.type != null) {
109
			this.type.resolveAnnotations(scope);
110
		}
111
		if (this.bounds != null) {
112
			for (int i = 0, max = this.bounds.length; i < max; i++) {
113
				this.bounds[i].resolveAnnotations(scope);
114
			}
115
		}
116
	}
66
	/* (non-Javadoc)
117
	/* (non-Javadoc)
67
	 * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
118
	 * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
68
	 */
119
	 */
69
	public StringBuffer printStatement(int indent, StringBuffer output) {
120
	public StringBuffer printStatement(int indent, StringBuffer output) {
121
		if (this.annotations != null) {
122
			printAnnotations(this.annotations, output);
123
			output.append(' ');
124
		}
70
		output.append(this.name);
125
		output.append(this.name);
71
		if (this.type != null) {
126
		if (this.type != null) {
72
			output.append(" extends "); //$NON-NLS-1$
127
			output.append(" extends "); //$NON-NLS-1$
Lines 82-92 Link Here
82
	}
137
	}
83
138
84
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
139
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
85
	    // nothing to do
140
		// nothing to do
86
	}
141
	}
87
142
88
	public void traverse(ASTVisitor visitor, BlockScope scope) {
143
	public void traverse(ASTVisitor visitor, BlockScope scope) {
89
		if (visitor.visit(this, scope)) {
144
		if (visitor.visit(this, scope)) {
145
			if (this.annotations != null) {
146
				int annotationsLength = this.annotations.length;
147
				for (int i = 0; i < annotationsLength; i++)
148
					this.annotations[i].traverse(visitor, scope);
149
			}
90
			if (this.type != null) {
150
			if (this.type != null) {
91
				this.type.traverse(visitor, scope);
151
				this.type.traverse(visitor, scope);
92
			}
152
			}
Lines 102-107 Link Here
102
162
103
	public void traverse(ASTVisitor visitor, ClassScope scope) {
163
	public void traverse(ASTVisitor visitor, ClassScope scope) {
104
		if (visitor.visit(this, scope)) {
164
		if (visitor.visit(this, scope)) {
165
			if (this.annotations != null) {
166
				int annotationsLength = this.annotations.length;
167
				for (int i = 0; i < annotationsLength; i++)
168
					this.annotations[i].traverse(visitor, scope);
169
			}
105
			if (this.type != null) {
170
			if (this.type != null) {
106
				this.type.traverse(visitor, scope);
171
				this.type.traverse(visitor, scope);
107
			}
172
			}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java (-12 / +290 lines)
Lines 1-23 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 * 
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
15
package org.eclipse.jdt.internal.compiler.ast;
12
16
17
import java.util.ArrayList;
18
import java.util.List;
19
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
20
import org.eclipse.jdt.internal.compiler.ASTVisitor;
21
import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext;
22
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
14
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
23
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
15
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
24
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
16
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
25
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
17
import org.eclipse.jdt.internal.compiler.impl.Constant;
26
import org.eclipse.jdt.internal.compiler.impl.Constant;
18
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.Binding;
19
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
29
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
20
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
30
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
31
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
21
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
32
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
22
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
33
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
23
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
34
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
Lines 28-39 Link Here
28
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
39
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
29
40
30
public abstract class TypeReference extends Expression {
41
public abstract class TypeReference extends Expression {
31
32
	public static final TypeReference[] NO_TYPE_ARGUMENTS = new TypeReference[0];
42
	public static final TypeReference[] NO_TYPE_ARGUMENTS = new TypeReference[0];
43
static class AnnotationCollector extends ASTVisitor {
44
	List annotationContexts;
45
	TypeReference typeReference;
46
	int targetType;
47
	Annotation[] primaryAnnotations;
48
	int info = -1;
49
	int info2 = -1;
50
	LocalVariableBinding localVariable;
51
	Annotation[][] annotationsOnDimensions;
52
	Wildcard currentWildcard;
53
54
	public AnnotationCollector(
55
			TypeParameter typeParameter,
56
			int targetType,
57
			int typeParameterIndex,
58
			List annotationContexts) {
59
		this.annotationContexts = annotationContexts;
60
		this.typeReference = typeParameter.type;
61
		this.targetType = targetType;
62
		this.primaryAnnotations = typeParameter.annotations;
63
		this.info = typeParameterIndex;
64
	}
65
66
	public AnnotationCollector(
67
			LocalDeclaration localDeclaration,
68
			int targetType,
69
			LocalVariableBinding localVariable,
70
			List annotationContexts) {
71
		this.annotationContexts = annotationContexts;
72
		this.typeReference = localDeclaration.type;
73
		this.targetType = targetType;
74
		this.primaryAnnotations = localDeclaration.annotations;
75
		this.localVariable = localVariable;
76
	}
77
78
	public AnnotationCollector(
79
			LocalDeclaration localDeclaration,
80
			int targetType,
81
			int parameterIndex,
82
			List annotationContexts) {
83
		this.annotationContexts = annotationContexts;
84
		this.typeReference = localDeclaration.type;
85
		this.targetType = targetType;
86
		this.primaryAnnotations = localDeclaration.annotations;
87
		this.info = parameterIndex;
88
	}
89
90
	public AnnotationCollector(
91
			MethodDeclaration methodDeclaration,
92
			int targetType,
93
			List annotationContexts) {
94
		this.annotationContexts = annotationContexts;
95
		this.typeReference = methodDeclaration.returnType;
96
		this.targetType = targetType;
97
		this.primaryAnnotations = methodDeclaration.annotations;
98
	}
99
100
	public AnnotationCollector(
101
			FieldDeclaration fieldDeclaration,
102
			int targetType,
103
			List annotationContexts) {
104
		this.annotationContexts = annotationContexts;
105
		this.typeReference = fieldDeclaration.type;
106
		this.targetType = targetType;
107
		this.primaryAnnotations = fieldDeclaration.annotations;
108
	}
109
	public AnnotationCollector(
110
			TypeReference typeReference,
111
			int targetType,
112
			List annotationContexts) {
113
		this.annotationContexts = annotationContexts;
114
		this.typeReference = typeReference;
115
		this.targetType = targetType;
116
	}
117
	public AnnotationCollector(
118
			TypeReference typeReference,
119
			int targetType,
120
			int info,
121
			List annotationContexts) {
122
		this.annotationContexts = annotationContexts;
123
		this.typeReference = typeReference;
124
		this.info = info;
125
		this.targetType = targetType;
126
	}
127
	public AnnotationCollector(
128
			TypeReference typeReference,
129
			int targetType,
130
			int info,
131
			int typeIndex,
132
			List annotationContexts) {
133
		this.annotationContexts = annotationContexts;
134
		this.typeReference = typeReference;
135
		this.info = info;
136
		this.targetType = targetType;
137
		this.info2 = typeIndex;
138
	}
139
	public AnnotationCollector(
140
			TypeReference typeReference,
141
			int targetType,
142
			int info,
143
			List annotationContexts,
144
			Annotation[][] annotationsOnDimensions) {
145
		this.annotationContexts = annotationContexts;
146
		this.typeReference = typeReference;
147
		this.info = info;
148
		this.targetType = targetType;
149
		this.annotationsOnDimensions = annotationsOnDimensions;
150
	}
151
	private boolean internalVisit(Annotation annotation) {
152
		AnnotationContext annotationContext = null;
153
		if (annotation.isRuntimeTypeInvisible()) {
154
			annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.INVISIBLE, this.annotationsOnDimensions);
155
		} else if (annotation.isRuntimeTypeVisible()) {
156
			annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.VISIBLE, this.annotationsOnDimensions);
157
		}
158
		if (annotationContext != null) {
159
			annotationContext.wildcard = this.currentWildcard;
160
			switch(this.targetType) {
161
				case AnnotationTargetTypeConstants.THROWS :
162
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
163
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
164
				case AnnotationTargetTypeConstants.METHOD_PARAMETER :
165
				case AnnotationTargetTypeConstants.TYPE_CAST :
166
				case AnnotationTargetTypeConstants.TYPE_INSTANCEOF :
167
				case AnnotationTargetTypeConstants.OBJECT_CREATION :
168
				case AnnotationTargetTypeConstants.CLASS_LITERAL :
169
				case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS:
170
					annotationContext.info = this.info;
171
					break;
172
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
173
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
174
					annotationContext.info2 = this.info2;
175
					annotationContext.info = this.info;
176
					break;
177
				case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
178
					annotationContext.variableBinding = this.localVariable;
179
					break;
180
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
181
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
182
					annotationContext.info2 = this.info2;
183
					annotationContext.info = this.info;
184
			}
185
			this.annotationContexts.add(annotationContext);
186
		}
187
		return true;
188
	}
189
	public boolean visit(MarkerAnnotation annotation, BlockScope scope) {
190
		return internalVisit(annotation);
191
	}
192
	public boolean visit(NormalAnnotation annotation, BlockScope scope) {
193
		return internalVisit(annotation);
194
	}
195
	public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
196
		return internalVisit(annotation);
197
	}
198
	public boolean visit(Wildcard wildcard, BlockScope scope) {
199
		this.currentWildcard = wildcard;
200
		return true;
201
	}
202
	public boolean visit(Argument argument, BlockScope scope) {
203
		if ((argument.bits & ASTNode.IsUnionType) == 0) {
204
			return true;
205
		}
206
		for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) {
207
			int startPC = this.localVariable.initializationPCs[i << 1];
208
			int endPC = this.localVariable.initializationPCs[(i << 1) + 1];
209
			if (startPC != endPC) { // only entries for non zero length
210
				return true;
211
			}
212
		}
213
		return false;
214
	}
215
	public boolean visit(Argument argument, ClassScope scope) {
216
		if ((argument.bits & ASTNode.IsUnionType) == 0) {
217
			return true;
218
		}
219
		for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) {
220
			int startPC = this.localVariable.initializationPCs[i << 1];
221
			int endPC = this.localVariable.initializationPCs[(i << 1) + 1];
222
			if (startPC != endPC) { // only entries for non zero length
223
				return true;
224
			}
225
		}
226
		return false;
227
	}
228
	public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) {
229
		for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) {
230
			int startPC = this.localVariable.initializationPCs[i << 1];
231
			int endPC = this.localVariable.initializationPCs[(i << 1) + 1];
232
			if (startPC != endPC) { // only entries for non zero length
233
				return true;
234
			}
235
		}
236
		return false;
237
	}
238
	public void endVisit(Wildcard wildcard, BlockScope scope) {
239
		this.currentWildcard = null;
240
	}
241
}
33
/*
242
/*
34
 * Answer a base type reference (can be an array of base type).
243
 * Answer a base type reference (can be an array of base type).
35
 */
244
 */
36
public static final TypeReference baseTypeReference(int baseType, int dim) {
245
public static final TypeReference baseTypeReference(int baseType, int dim, Annotation [][] dimAnnotations) {
37
246
38
	if (dim == 0) {
247
	if (dim == 0) {
39
		switch (baseType) {
248
		switch (baseType) {
Lines 59-83 Link Here
59
	}
268
	}
60
	switch (baseType) {
269
	switch (baseType) {
61
		case (TypeIds.T_void) :
270
		case (TypeIds.T_void) :
62
			return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, 0);
271
			return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, dimAnnotations, 0);
63
		case (TypeIds.T_boolean) :
272
		case (TypeIds.T_boolean) :
64
			return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, 0);
273
			return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, dimAnnotations, 0);
65
		case (TypeIds.T_char) :
274
		case (TypeIds.T_char) :
66
			return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, 0);
275
			return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, dimAnnotations, 0);
67
		case (TypeIds.T_float) :
276
		case (TypeIds.T_float) :
68
			return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, 0);
277
			return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, dimAnnotations, 0);
69
		case (TypeIds.T_double) :
278
		case (TypeIds.T_double) :
70
			return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, 0);
279
			return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, dimAnnotations, 0);
71
		case (TypeIds.T_byte) :
280
		case (TypeIds.T_byte) :
72
			return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, 0);
281
			return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, dimAnnotations, 0);
73
		case (TypeIds.T_short) :
282
		case (TypeIds.T_short) :
74
			return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, 0);
283
			return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, dimAnnotations, 0);
75
		case (TypeIds.T_int) :
284
		case (TypeIds.T_int) :
76
			return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, 0);
285
			return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, dimAnnotations, 0);
77
		default : //T_long
286
		default : //T_long
78
			return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0);
287
			return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, dimAnnotations, 0);
79
	}
288
	}
80
}
289
}
290
291
// JSR308 type annotations...
292
public Annotation[] annotations = null;
81
293
82
// allows us to trap completion & selection nodes
294
// allows us to trap completion & selection nodes
83
public void aboutToResolve(Scope scope) {
295
public void aboutToResolve(Scope scope) {
Lines 90-97 Link Here
90
	// only parameterized type references have bounds
302
	// only parameterized type references have bounds
91
}
303
}
92
public abstract TypeReference copyDims(int dim);
304
public abstract TypeReference copyDims(int dim);
305
public abstract TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions);
93
public int dimensions() {
306
public int dimensions() {
94
	return 0;
307
	return 0;
308
}
309
public AnnotationContext[] getAllAnnotationContexts(int targetType) {
310
	List allAnnotationContexts = new ArrayList();
311
	AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
312
	this.traverse(collector, (BlockScope) null);
313
	return (AnnotationContext[]) allAnnotationContexts.toArray(new AnnotationContext[allAnnotationContexts.size()]);
314
}
315
/**
316
 * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
317
 * @param targetType
318
 * @param info
319
 * @param allAnnotationContexts
320
 */
321
public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts) {
322
	AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts);
323
	this.traverse(collector, (BlockScope) null);
324
}
325
/**
326
 * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
327
 * @param targetType
328
 * @param info
329
 * @param allAnnotationContexts
330
 */
331
public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts, Annotation[][] annotationsOnDimensions) {
332
	AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts, annotationsOnDimensions);
333
	this.traverse(collector, (BlockScope) null);
334
	if (annotationsOnDimensions != null) {
335
		for (int i = 0, max = annotationsOnDimensions.length; i < max; i++) {
336
			Annotation[] annotationsOnDimension = annotationsOnDimensions[i];
337
			if (annotationsOnDimension != null) {
338
				for (int j = 0, max2 = annotationsOnDimension.length; j< max2; j++) {
339
					annotationsOnDimension[j].traverse(collector, (BlockScope) null);
340
				}
341
			}
342
		}
343
	}
344
}
345
public void getAllAnnotationContexts(int targetType, int info, int typeIndex, List allAnnotationContexts) {
346
	AnnotationCollector collector = new AnnotationCollector(this, targetType, info, typeIndex, allAnnotationContexts);
347
	this.traverse(collector, (BlockScope) null);
348
}
349
public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
350
	AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
351
	this.traverse(collector, (BlockScope) null);
352
}
353
public Annotation[][] getAnnotationsOnDimensions() {
354
	return null;
95
}
355
}
96
356
97
public abstract char[] getLastToken();
357
public abstract char[] getLastToken();
Lines 159-164 Link Here
159
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
419
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
160
		scope.problemReporter().rawTypeReference(this, type);
420
		scope.problemReporter().rawTypeReference(this, type);
161
	}
421
	}
422
	if (this.annotations != null) {
423
		switch(scope.kind) {
424
			case Scope.BLOCK_SCOPE :
425
			case Scope.METHOD_SCOPE :
426
				resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
427
				break;
428
		}
429
	}
430
162
	if (hasError) {
431
	if (hasError) {
163
		// do not store the computed type, keep the problem type instead
432
		// do not store the computed type, keep the problem type instead
164
		return type;
433
		return type;
Lines 169-174 Link Here
169
	return true;
438
	return true;
170
}
439
}
171
440
441
public boolean isParameterizedTypeReference() {
442
	return false;
443
}
172
protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) {
444
protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) {
173
	scope.problemReporter().deprecatedType(type, this, index);
445
	scope.problemReporter().deprecatedType(type, this, index);
174
}
446
}
Lines 234-237 Link Here
234
public abstract void traverse(ASTVisitor visitor, BlockScope scope);
506
public abstract void traverse(ASTVisitor visitor, BlockScope scope);
235
507
236
public abstract void traverse(ASTVisitor visitor, ClassScope scope);
508
public abstract void traverse(ASTVisitor visitor, ClassScope scope);
509
510
protected void resolveAnnotations(BlockScope scope) {
511
	if (this.annotations != null) {
512
		resolveAnnotations(scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
513
	}
514
}
237
}
515
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java (+9 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 156-159 Link Here
156
		return output;
160
		return output;
157
	}
161
	}
158
162
163
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) {
164
		// TODO Auto-generated method stub
165
		return null;
166
	}
167
159
}
168
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java (-3 / +9 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 59-65 Link Here
59
			boundType = scope.kind == Scope.CLASS_SCOPE
63
			boundType = scope.kind == Scope.CLASS_SCOPE
60
					? this.bound.resolveType((ClassScope)scope)
64
					? this.bound.resolveType((ClassScope)scope)
61
					: this.bound.resolveType((BlockScope)scope, true /* check bounds*/);
65
					: this.bound.resolveType((BlockScope)scope, true /* check bounds*/);
62
66
			this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations);
63
			if (boundType == null) {
67
			if (boundType == null) {
64
				return null;
68
				return null;
65
			}
69
			}
Lines 89-94 Link Here
89
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
93
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
90
		if (this.bound != null) {
94
		if (this.bound != null) {
91
			this.bound.resolveType(scope, checkBounds);
95
			this.bound.resolveType(scope, checkBounds);
96
			this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations);
92
		}
97
		}
93
		return null;
98
		return null;
94
	}
99
	}
Lines 96-101 Link Here
96
	public TypeBinding resolveType(ClassScope scope) {
101
	public TypeBinding resolveType(ClassScope scope) {
97
		if (this.bound != null) {
102
		if (this.bound != null) {
98
			this.bound.resolveType(scope);
103
			this.bound.resolveType(scope);
104
			this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations);
99
		}
105
		}
100
		return null;
106
		return null;
101
	}
107
	}
Lines 104-110 Link Here
104
	}
110
	}
105
111
106
	public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
112
	public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
107
	    return internalResolveType(classScope, genericType, rank);
113
		return internalResolveType(classScope, genericType, rank);
108
	}
114
	}
109
115
110
	public void traverse(ASTVisitor visitor, BlockScope scope) {
116
	public void traverse(ASTVisitor visitor, BlockScope scope) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java (-1 / +2 lines)
Lines 8-14 Link Here
8
 * This is an implementation of an early-draft specification developed under the Java
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
10
 * only. The code is not compatible with any specification of the JCP.
11
 *
11
 * 
12
 * Contributors:
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
14
 *******************************************************************************/
Lines 132-135 Link Here
132
	int ATTR_VARS = 0x4; // LocalVariableTableAttribute
132
	int ATTR_VARS = 0x4; // LocalVariableTableAttribute
133
	int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
133
	int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
134
	int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
134
	int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
135
	int ATTR_TYPE_ANNOTATION = 0x20; // annotation type annotation (jsr 308)
135
}
136
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java (+64 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.compiler.codegen;
16
17
import org.eclipse.jdt.internal.compiler.ast.Annotation;
18
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
19
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
20
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
21
22
public class AnnotationContext {
23
	public static final int VISIBLE = 0x1;
24
	public static final int INVISIBLE = 0x2;
25
	public Annotation annotation;
26
	public TypeReference typeReference;
27
	public int targetType;
28
	public int info;
29
	public int info2;
30
	public int visibility;
31
	public Annotation[] primaryAnnotations;
32
	public LocalVariableBinding variableBinding;
33
	public Annotation[][] annotationsOnDimensions;
34
	public Wildcard wildcard;
35
36
	public AnnotationContext(
37
			Annotation annotation,
38
			TypeReference typeReference,
39
			int targetType,
40
			Annotation[] primaryAnnotations,
41
			int visibility,
42
			Annotation[][] annotationsOnDimensions) {
43
		this.annotation = annotation;
44
		this.typeReference = typeReference;
45
		this.targetType = targetType;
46
		this.primaryAnnotations = primaryAnnotations;
47
		this.visibility = visibility;
48
		this.annotationsOnDimensions = annotationsOnDimensions;
49
	}
50
51
	public String toString() {
52
		return "AnnotationContext [annotation=" //$NON-NLS-1$
53
				+ this.annotation
54
				+ ", typeReference=" //$NON-NLS-1$
55
				+ this.typeReference
56
				+ ", targetType=" //$NON-NLS-1$
57
				+ this.targetType
58
				+ ", info =" //$NON-NLS-1$
59
				+ this.info
60
				+ ", boundIndex=" //$NON-NLS-1$
61
				+ this.info2
62
				+ "]"; //$NON-NLS-1$
63
	}
64
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java (+54 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.compiler.codegen;
16
17
public interface AnnotationTargetTypeConstants {
18
	int METHOD_RECEIVER = 0x06;
19
	int METHOD_RECEIVER_GENERIC_OR_ARRAY = 0x07;
20
	int METHOD_RETURN_TYPE = 0x0A;
21
	int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = 0x0B;
22
	int METHOD_PARAMETER = 0x0C;
23
	int METHOD_PARAMETER_GENERIC_OR_ARRAY = 0x0D;
24
	int FIELD = 0x0E;
25
	int FIELD_GENERIC_OR_ARRAY = 0x0F;
26
	int CLASS_TYPE_PARAMETER_BOUND = 0x10;
27
	int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x11;
28
	int METHOD_TYPE_PARAMETER_BOUND = 0x12;
29
	int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x13;
30
	int CLASS_EXTENDS_IMPLEMENTS = 0x14;
31
	int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = 0x15;
32
	int THROWS = 0x16;
33
	int THROWS_GENERIC_OR_ARRAY = 0x17;
34
	int WILDCARD_BOUND = 0x1C;
35
	int WILDCARD_BOUND_GENERIC_OR_ARRAY = 0x1D;
36
	int METHOD_TYPE_PARAMETER = 0x20;
37
	int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x21;
38
	int CLASS_TYPE_PARAMETER = 0x22;
39
	int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x23;
40
	int TYPE_CAST = 0x00;
41
	int TYPE_CAST_GENERIC_OR_ARRAY = 0x01;
42
	int TYPE_INSTANCEOF = 0x02;
43
	int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = 0x03;
44
	int OBJECT_CREATION = 0x04;
45
	int OBJECT_CREATION_GENERIC_OR_ARRAY = 0x05;
46
	int LOCAL_VARIABLE = 0x08;
47
	int LOCAL_VARIABLE_GENERIC_OR_ARRAY = 0x09;
48
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL = 0x18;
49
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = 0x19;
50
	int TYPE_ARGUMENT_METHOD_CALL = 0x1A;
51
	int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = 0x1B;
52
	int CLASS_LITERAL = 0x1E;
53
	int CLASS_LITERAL_GENERIC_OR_ARRAY = 0x1F;
54
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java (-1 / +8 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 33-36 Link Here
33
	final char[] VarargsName = "Varargs".toCharArray(); //$NON-NLS-1$
37
	final char[] VarargsName = "Varargs".toCharArray(); //$NON-NLS-1$
34
	final char[] StackMapName = "StackMap".toCharArray(); //$NON-NLS-1$
38
	final char[] StackMapName = "StackMap".toCharArray(); //$NON-NLS-1$
35
	final char[] MissingTypesName = "MissingTypes".toCharArray(); //$NON-NLS-1$
39
	final char[] MissingTypesName = "MissingTypes".toCharArray(); //$NON-NLS-1$
40
	// jsr308
41
	final char[] RuntimeVisibleTypeAnnotationsName = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
42
	final char[] RuntimeInvisibleTypeAnnotationsName = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
36
}
43
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-17 / +40 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 17-27 Link Here
17
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
21
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
18
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
22
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
19
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
23
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
24
import org.eclipse.jdt.internal.compiler.ast.Annotation;
20
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
25
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
21
import org.eclipse.jdt.internal.compiler.ast.Expression;
26
import org.eclipse.jdt.internal.compiler.ast.Expression;
22
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
27
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
23
import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
28
import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
24
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
29
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
30
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
25
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
31
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
26
import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo;
32
import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo;
27
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
33
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
Lines 631-638 Link Here
631
			writeUnsignedShort(this.constantPool.literalIndexForType(ConstantPool.JavaLangBooleanConstantPoolName));
637
			writeUnsignedShort(this.constantPool.literalIndexForType(ConstantPool.JavaLangBooleanConstantPoolName));
632
	}
638
	}
633
}
639
}
634
635
public void checkcast(TypeBinding typeBinding) {
640
public void checkcast(TypeBinding typeBinding) {
641
	this.checkcast(null, typeBinding);
642
}
643
public void checkcast(TypeReference typeReference, TypeBinding typeBinding) {
636
	this.countLabels = 0;
644
	this.countLabels = 0;
637
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
645
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
638
		resizeByteArray();
646
		resizeByteArray();
Lines 641-647 Link Here
641
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_checkcast;
649
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_checkcast;
642
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
650
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
643
}
651
}
644
645
public void d2f() {
652
public void d2f() {
646
	this.countLabels = 0;
653
	this.countLabels = 0;
647
	this.stackDepth--;
654
	this.stackDepth--;
Lines 1690-1700 Link Here
1690
            }
1697
            }
1691
    }
1698
    }
1692
}
1699
}
1693
1700
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1701
	this.generateClassLiteralAccessForType(null, accessedType, syntheticFieldBinding);
1702
}
1694
/**
1703
/**
1695
 * Macro for building a class descriptor object
1704
 * Macro for building a class descriptor object
1696
 */
1705
 */
1697
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1706
public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1698
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
1707
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
1699
		getTYPE(accessedType.id);
1708
		getTYPE(accessedType.id);
1700
		return;
1709
		return;
Lines 1847-1853 Link Here
1847
	invokeClassForName();
1856
	invokeClassForName();
1848
	int paramLength = methodBinding.parameters.length;
1857
	int paramLength = methodBinding.parameters.length;
1849
	this.generateInlinedValue(paramLength);
1858
	this.generateInlinedValue(paramLength);
1850
	newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1859
	newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1851
	if (paramLength > 0) {
1860
	if (paramLength > 0) {
1852
		dup();
1861
		dup();
1853
		for (int i = 0; i < paramLength; i++) {
1862
		for (int i = 0; i < paramLength; i++) {
Lines 1903-1909 Link Here
1903
	this.ldc(String.valueOf(methodBinding.selector));
1912
	this.ldc(String.valueOf(methodBinding.selector));
1904
	int paramLength = methodBinding.parameters.length;
1913
	int paramLength = methodBinding.parameters.length;
1905
	this.generateInlinedValue(paramLength);
1914
	this.generateInlinedValue(paramLength);
1906
	newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1915
	newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1907
	if (paramLength > 0) {
1916
	if (paramLength > 0) {
1908
		dup();
1917
		dup();
1909
		for (int i = 0; i < paramLength; i++) {
1918
		for (int i = 0; i < paramLength; i++) {
Lines 2429-2435 Link Here
2429
public void generateSyntheticBodyForEnumValueOf(SyntheticMethodBinding methodBinding) {
2438
public void generateSyntheticBodyForEnumValueOf(SyntheticMethodBinding methodBinding) {
2430
	initializeMaxLocals(methodBinding);
2439
	initializeMaxLocals(methodBinding);
2431
	final ReferenceBinding declaringClass = methodBinding.declaringClass;
2440
	final ReferenceBinding declaringClass = methodBinding.declaringClass;
2432
	generateClassLiteralAccessForType(declaringClass, null);
2441
	generateClassLiteralAccessForType(null, declaringClass, null);
2433
	aload_0();
2442
	aload_0();
2434
	invokeJavaLangEnumvalueOf(declaringClass);
2443
	invokeJavaLangEnumvalueOf(declaringClass);
2435
	this.checkcast(declaringClass);
2444
	this.checkcast(declaringClass);
Lines 2455-2461 Link Here
2455
	arraylength();
2464
	arraylength();
2456
	dup();
2465
	dup();
2457
	istore_1();
2466
	istore_1();
2458
	newArray((ArrayBinding) enumArray);
2467
	newArray(null, (ArrayBinding) enumArray);
2459
	dup();
2468
	dup();
2460
	astore_2();
2469
	astore_2();
2461
	iconst_0();
2470
	iconst_0();
Lines 3826-3837 Link Here
3826
	}
3835
	}
3827
	return (chaining & (L_OPTIMIZABLE|L_CANNOT_OPTIMIZE)) == L_OPTIMIZABLE; // check was some standards, and no case/recursive
3836
	return (chaining & (L_OPTIMIZABLE|L_CANNOT_OPTIMIZE)) == L_OPTIMIZABLE; // check was some standards, and no case/recursive
3828
}
3837
}
3829
3838
public void instance_of(TypeBinding typeBinding) {
3839
	this.instance_of(null, typeBinding);
3840
}
3830
/**
3841
/**
3831
 * We didn't call it instanceof because there is a conflit with the
3842
 * We didn't call it instanceof because there is a conflit with the
3832
 * instanceof keyword
3843
 * instanceof keyword
3833
 */
3844
 */
3834
public void instance_of(TypeBinding typeBinding) {
3845
public void instance_of(TypeReference typeReference, TypeBinding typeBinding) {
3835
	this.countLabels = 0;
3846
	this.countLabels = 0;
3836
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
3847
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
3837
		resizeByteArray();
3848
		resizeByteArray();
Lines 3869-3876 Link Here
3869
		this.stackMax = this.stackDepth;
3880
		this.stackMax = this.stackDepth;
3870
	}
3881
	}
3871
}
3882
}
3872
3883
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass, TypeReference[] typeArguments) {
3873
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) {
3874
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3884
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3875
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
3885
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
3876
		Util.recordNestedType(this.classFile, declaringClass);
3886
		Util.recordNestedType(this.classFile, declaringClass);
Lines 3904-3910 Link Here
3904
								default: 
3914
								default: 
3905
									receiverAndArgsSize++;
3915
									receiverAndArgsSize++;
3906
									break;
3916
									break;
3907
							}    						
3917
							}
3908
						}
3918
						}
3909
					}
3919
					}
3910
				}
3920
				}
Lines 3950-3955 Link Here
3950
			declaringClass.constantPoolName(), 
3960
			declaringClass.constantPoolName(), 
3951
			methodBinding.selector, 
3961
			methodBinding.selector, 
3952
			methodBinding.signature(this.classFile));
3962
			methodBinding.signature(this.classFile));
3963
}
3964
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) {
3965
	this.invoke(opcode, methodBinding, declaringClass, null);
3953
}
3966
}
3954
3967
3955
protected void invokeAccessibleObjectSetAccessible() {
3968
protected void invokeAccessibleObjectSetAccessible() {
Lines 5577-5584 Link Here
5577
	this.position++;
5590
	this.position++;
5578
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit;
5591
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit;
5579
}
5592
}
5580
5581
public void multianewarray(TypeBinding typeBinding, int dimensions) {
5593
public void multianewarray(TypeBinding typeBinding, int dimensions) {
5594
	this.multianewarray(null, typeBinding, dimensions, null);
5595
}
5596
public void multianewarray(
5597
		TypeReference typeReference,
5598
		TypeBinding typeBinding,
5599
		int dimensions,
5600
		Annotation [][] annotationsOnDimensions) {
5582
	this.countLabels = 0;
5601
	this.countLabels = 0;
5583
	this.stackDepth += (1 - dimensions);
5602
	this.stackDepth += (1 - dimensions);
5584
	if (this.classFileOffset + 3 >= this.bCodeStream.length) {
5603
	if (this.classFileOffset + 3 >= this.bCodeStream.length) {
Lines 5589-5597 Link Here
5589
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
5608
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
5590
	this.bCodeStream[this.classFileOffset++] = (byte) dimensions;
5609
	this.bCodeStream[this.classFileOffset++] = (byte) dimensions;
5591
}
5610
}
5592
5593
// We didn't call it new, because there is a conflit with the new keyword
5594
public void new_(TypeBinding typeBinding) {
5611
public void new_(TypeBinding typeBinding) {
5612
	this.new_(null, typeBinding);
5613
}
5614
// We didn't call it new, because there is a conflit with the new keyword
5615
public void new_(TypeReference typeReference, TypeBinding typeBinding) {
5595
	this.countLabels = 0;
5616
	this.countLabels = 0;
5596
	this.stackDepth++;
5617
	this.stackDepth++;
5597
	if (this.stackDepth > this.stackMax)
5618
	if (this.stackDepth > this.stackMax)
Lines 5613-5620 Link Here
5613
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_newarray;
5634
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_newarray;
5614
	this.bCodeStream[this.classFileOffset++] = (byte) array_Type;
5635
	this.bCodeStream[this.classFileOffset++] = (byte) array_Type;
5615
}
5636
}
5616
5617
public void newArray(ArrayBinding arrayBinding) {
5637
public void newArray(ArrayBinding arrayBinding) {
5638
	this.newArray(null, arrayBinding);
5639
}
5640
public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) {
5618
	TypeBinding component = arrayBinding.elementsType();
5641
	TypeBinding component = arrayBinding.elementsType();
5619
	switch (component.id) {
5642
	switch (component.id) {
5620
		case TypeIds.T_int :
5643
		case TypeIds.T_int :
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java (-1 / +6 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 20-25 Link Here
20
import org.eclipse.jdt.core.compiler.CharOperation;
24
import org.eclipse.jdt.core.compiler.CharOperation;
21
import org.eclipse.jdt.internal.compiler.ClassFile;
25
import org.eclipse.jdt.internal.compiler.ClassFile;
22
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
26
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
27
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
23
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
28
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
24
import org.eclipse.jdt.internal.compiler.lookup.Binding;
29
import org.eclipse.jdt.internal.compiler.lookup.Binding;
25
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
30
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
Lines 272-278 Link Here
272
/**
277
/**
273
 * Macro for building a class descriptor object
278
 * Macro for building a class descriptor object
274
 */
279
 */
275
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
280
public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
276
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
281
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
277
		getTYPE(accessedType.id);
282
		getTYPE(accessedType.id);
278
		return;
283
		return;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java (+116 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.compiler.codegen;
16
17
import java.util.ArrayList;
18
import java.util.List;
19
20
import org.eclipse.jdt.internal.compiler.ClassFile;
21
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
22
import org.eclipse.jdt.internal.compiler.ast.Annotation;
23
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
24
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
25
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
29
30
public class TypeAnnotationCodeStream extends StackMapFrameCodeStream {
31
	public List allTypeAnnotationContexts;
32
33
	public TypeAnnotationCodeStream(ClassFile givenClassFile) {
34
		super(givenClassFile);
35
		this.generateAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
36
		this.allTypeAnnotationContexts = new ArrayList();
37
	}
38
	private void addAnnotationContext(TypeReference typeReference, int info, int targetType, Annotation[][] annotationsOnDimensions) {
39
//		if (this.allTypeAnnotationContexts == null) {
40
//			this.allTypeAnnotationContexts = new ArrayList();
41
//		}
42
		typeReference.getAllAnnotationContexts(targetType, info, this.allTypeAnnotationContexts, annotationsOnDimensions);
43
	}
44
	private void addAnnotationContext(TypeReference typeReference, int info, int targetType) {
45
//		if (this.allTypeAnnotationContexts == null) {
46
//			this.allTypeAnnotationContexts = new ArrayList();
47
//		}
48
		typeReference.getAllAnnotationContexts(targetType, info, this.allTypeAnnotationContexts);
49
	}
50
	private void addAnnotationContext(TypeReference typeReference, int info, int typeIndex, int targetType) {
51
//		if (this.allTypeAnnotationContexts == null) {
52
//			this.allTypeAnnotationContexts = new ArrayList();
53
//		}
54
		typeReference.getAllAnnotationContexts(targetType, info, typeIndex, this.allTypeAnnotationContexts);
55
	}
56
	public void instance_of(TypeReference typeReference, TypeBinding typeBinding) {
57
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
58
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.TYPE_INSTANCEOF);
59
		}
60
		super.instance_of(typeReference, typeBinding);
61
	}
62
	public void multianewarray(
63
			TypeReference typeReference,
64
			TypeBinding typeBinding,
65
			int dimensions,
66
			Annotation [][] annotationsOnDimensions) {
67
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
68
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION, annotationsOnDimensions);
69
		}
70
		super.multianewarray(typeReference, typeBinding, dimensions, annotationsOnDimensions);
71
	}
72
	public void new_(TypeReference typeReference, TypeBinding typeBinding) {
73
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
74
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION);
75
		}
76
		super.new_(typeReference, typeBinding);
77
	}
78
	public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) {
79
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
80
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION);
81
		}
82
		super.newArray(typeReference, arrayBinding);
83
	}
84
	public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
85
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
86
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.CLASS_LITERAL);
87
		}
88
		super.generateClassLiteralAccessForType(typeReference, accessedType, syntheticFieldBinding);
89
	}
90
	public void checkcast(TypeReference typeReference, TypeBinding typeBinding) {
91
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
92
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.TYPE_CAST);
93
		}
94
		super.checkcast(typeReference, typeBinding);
95
	}
96
	public void reset(ClassFile givenClassFile) {
97
		super.reset(givenClassFile);
98
		this.allTypeAnnotationContexts = new ArrayList();
99
	}
100
	public void init(ClassFile targetClassFile) {
101
		super.init(targetClassFile);
102
		this.allTypeAnnotationContexts = new ArrayList();
103
	}
104
	public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass, TypeReference[] typeArguments) {
105
		if (typeArguments != null) {
106
			int targetType = methodBinding.isConstructor()
107
					? AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL
108
					: AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL;
109
			for (int i = 0, max = typeArguments.length; i < max; i++) {
110
				TypeReference typeArgument = typeArguments[i];
111
				addAnnotationContext(typeArgument, this.position, i, targetType);
112
			}
113
		}
114
		super.invoke(opcode, methodBinding, declaringClass, typeArguments);
115
	}
116
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java (+6 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for
14
 *     Stephan Herrmann - Contribution for
Lines 32-37 Link Here
32
	public static final int GENERIC_TYPE = TYPE | ASTNode.Bit12;
36
	public static final int GENERIC_TYPE = TYPE | ASTNode.Bit12;
33
	public static final int TYPE_PARAMETER = TYPE | ASTNode.Bit13;
37
	public static final int TYPE_PARAMETER = TYPE | ASTNode.Bit13;
34
	public static final int INTERSECTION_TYPE = TYPE | ASTNode.Bit14;
38
	public static final int INTERSECTION_TYPE = TYPE | ASTNode.Bit14;
39
	// jsr 308
40
	public static final int TYPE_USE = TYPE | ASTNode.Bit15;
35
41
36
	// Shared binding collections
42
	// Shared binding collections
37
	public static final TypeBinding[] NO_TYPES = new TypeBinding[0];
43
	public static final TypeBinding[] NO_TYPES = new TypeBinding[0];
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-2 / +25 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for bug 186342 [compiler][null] Using annotations for null checking
14
 *     Stephan Herrmann - Contribution for bug 186342 [compiler][null] Using annotations for null checking
Lines 783-788 Link Here
783
			parameterBinding.fPackage = unitPackage;
787
			parameterBinding.fPackage = unitPackage;
784
			typeParameter.binding = parameterBinding;
788
			typeParameter.binding = parameterBinding;
785
789
790
			if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
791
				switch(declaringElement.kind()) {
792
					case Binding.METHOD :
793
						MethodBinding methodBinding = (MethodBinding) declaringElement;
794
						AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod();
795
						if (sourceMethod != null) {
796
							sourceMethod.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
797
						}
798
						break;
799
					case Binding.TYPE :
800
						if (declaringElement instanceof SourceTypeBinding) {
801
							SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) declaringElement;
802
							TypeDeclaration typeDeclaration = sourceTypeBinding.scope.referenceContext;
803
							if (typeDeclaration != null) {
804
								typeDeclaration.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
805
							}
806
						}
807
				}
808
			}
786
			// detect duplicates, but keep each variable to reduce secondary errors with instantiating this generic type (assume number of variables is correct)
809
			// detect duplicates, but keep each variable to reduce secondary errors with instantiating this generic type (assume number of variables is correct)
787
			for (int j = 0; j < count; j++) {
810
			for (int j = 0; j < count; j++) {
788
				TypeVariableBinding knownVar = typeVariableBindings[j];
811
				TypeVariableBinding knownVar = typeVariableBindings[j];
Lines 1011-1018 Link Here
1011
			isSuperAccess(); this is used to determine if the discovered field is visible.
1034
			isSuperAccess(); this is used to determine if the discovered field is visible.
1012
		Only fields defined by the receiverType or its supertypes are answered;
1035
		Only fields defined by the receiverType or its supertypes are answered;
1013
		a field of an enclosing type will not be found using this API.
1036
		a field of an enclosing type will not be found using this API.
1014
    	If no visible field is discovered, null is answered.
1037
		If no visible field is discovered, null is answered.
1015
	 */
1038
	*/
1016
	public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) {
1039
	public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) {
1017
		return findField(receiverType, fieldName, invocationSite, needResolve, false);
1040
		return findField(receiverType, fieldName, invocationSite, needResolve, false);
1018
	}
1041
	}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (-1 / +8 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for bug 186342 - [compiler][null] Using annotations for null checking
14
 *     Stephan Herrmann - Contribution for bug 186342 - [compiler][null] Using annotations for null checking
Lines 109-119 Link Here
109
	long AnnotationForLocalVariable = ASTNode.Bit42L;
113
	long AnnotationForLocalVariable = ASTNode.Bit42L;
110
	long AnnotationForAnnotationType = ASTNode.Bit43L;
114
	long AnnotationForAnnotationType = ASTNode.Bit43L;
111
	long AnnotationForPackage = ASTNode.Bit44L;
115
	long AnnotationForPackage = ASTNode.Bit44L;
116
	long AnnotationForTypeUse = ASTNode.Bit54L;
117
	long AnnotationForTypeParameter = ASTNode.Bit55L;
112
	long AnnotationTargetMASK = AnnotationTarget
118
	long AnnotationTargetMASK = AnnotationTarget
113
				| AnnotationForType | AnnotationForField
119
				| AnnotationForType | AnnotationForField
114
				| AnnotationForMethod | AnnotationForParameter
120
				| AnnotationForMethod | AnnotationForParameter
115
				| AnnotationForConstructor | AnnotationForLocalVariable
121
				| AnnotationForConstructor | AnnotationForLocalVariable
116
				| AnnotationForAnnotationType | AnnotationForPackage;
122
				| AnnotationForAnnotationType | AnnotationForPackage
123
				| AnnotationForTypeUse | AnnotationForTypeParameter;
117
	// 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention
124
	// 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention
118
	long AnnotationSourceRetention = ASTNode.Bit45L;
125
	long AnnotationSourceRetention = ASTNode.Bit45L;
119
	long AnnotationClassRetention = ASTNode.Bit46L;
126
	long AnnotationClassRetention = ASTNode.Bit46L;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java (-22 / +29 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contributions for
14
 *     Stephan Herrmann - Contributions for
Lines 45-58 Link Here
45
	char[] CharArray_JAVA_IO_OBJECTSTREAMFIELD = "java.io.ObjectStreamField".toCharArray(); //$NON-NLS-1$
49
	char[] CharArray_JAVA_IO_OBJECTSTREAMFIELD = "java.io.ObjectStreamField".toCharArray(); //$NON-NLS-1$
46
	char[] ANONYM_PREFIX = "new ".toCharArray(); //$NON-NLS-1$
50
	char[] ANONYM_PREFIX = "new ".toCharArray(); //$NON-NLS-1$
47
	char[] ANONYM_SUFFIX = "(){}".toCharArray(); //$NON-NLS-1$
51
	char[] ANONYM_SUFFIX = "(){}".toCharArray(); //$NON-NLS-1$
48
    char[] WILDCARD_NAME = { '?' };
52
	char[] WILDCARD_NAME = { '?' };
49
    char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$
53
	char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$
50
    char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$
54
	char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$
51
    char[] WILDCARD_MINUS = { '-' };
55
	char[] WILDCARD_MINUS = { '-' };
52
    char[] WILDCARD_STAR = { '*' };
56
	char[] WILDCARD_STAR = { '*' };
53
    char[] WILDCARD_PLUS = { '+' };
57
	char[] WILDCARD_PLUS = { '+' };
54
    char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture#".toCharArray(); //$NON-NLS-1$
58
	char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture#".toCharArray(); //$NON-NLS-1$
55
    char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$
59
	char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$
56
	char[] WILDCARD_CAPTURE = { '!' };
60
	char[] WILDCARD_CAPTURE = { '!' };
57
	char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
61
	char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
58
	char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
62
	char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
Lines 64-85 Link Here
64
	char[] BOOLEAN = "boolean".toCharArray(); //$NON-NLS-1$
68
	char[] BOOLEAN = "boolean".toCharArray(); //$NON-NLS-1$
65
	char[] NULL = "null".toCharArray(); //$NON-NLS-1$
69
	char[] NULL = "null".toCharArray(); //$NON-NLS-1$
66
	char[] VOID = "void".toCharArray(); //$NON-NLS-1$
70
	char[] VOID = "void".toCharArray(); //$NON-NLS-1$
67
    char[] VALUE = "value".toCharArray(); //$NON-NLS-1$
71
	char[] VALUE = "value".toCharArray(); //$NON-NLS-1$
68
    char[] VALUES = "values".toCharArray(); //$NON-NLS-1$
72
	char[] VALUES = "values".toCharArray(); //$NON-NLS-1$
69
    char[] VALUEOF = "valueOf".toCharArray(); //$NON-NLS-1$
73
	char[] VALUEOF = "valueOf".toCharArray(); //$NON-NLS-1$
70
    char[] UPPER_SOURCE = "SOURCE".toCharArray(); //$NON-NLS-1$
74
	char[] UPPER_SOURCE = "SOURCE".toCharArray(); //$NON-NLS-1$
71
    char[] UPPER_CLASS = "CLASS".toCharArray(); //$NON-NLS-1$
75
	char[] UPPER_CLASS = "CLASS".toCharArray(); //$NON-NLS-1$
72
    char[] UPPER_RUNTIME = "RUNTIME".toCharArray(); //$NON-NLS-1$
76
	char[] UPPER_RUNTIME = "RUNTIME".toCharArray(); //$NON-NLS-1$
73
	char[] ANNOTATION_PREFIX = "@".toCharArray(); //$NON-NLS-1$
77
	char[] ANNOTATION_PREFIX = "@".toCharArray(); //$NON-NLS-1$
74
	char[] ANNOTATION_SUFFIX = "()".toCharArray(); //$NON-NLS-1$
78
	char[] ANNOTATION_SUFFIX = "()".toCharArray(); //$NON-NLS-1$
75
    char[] TYPE = "TYPE".toCharArray(); //$NON-NLS-1$
79
	char[] TYPE = "TYPE".toCharArray(); //$NON-NLS-1$
76
    char[] UPPER_FIELD = "FIELD".toCharArray(); //$NON-NLS-1$
80
	char[] UPPER_FIELD = "FIELD".toCharArray(); //$NON-NLS-1$
77
    char[] UPPER_METHOD = "METHOD".toCharArray(); //$NON-NLS-1$
81
	char[] UPPER_METHOD = "METHOD".toCharArray(); //$NON-NLS-1$
78
    char[] UPPER_PARAMETER = "PARAMETER".toCharArray(); //$NON-NLS-1$
82
	char[] UPPER_PARAMETER = "PARAMETER".toCharArray(); //$NON-NLS-1$
79
    char[] UPPER_CONSTRUCTOR = "CONSTRUCTOR".toCharArray(); //$NON-NLS-1$
83
	char[] UPPER_CONSTRUCTOR = "CONSTRUCTOR".toCharArray(); //$NON-NLS-1$
80
    char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$
84
	char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$
81
    char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$
85
	char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$
82
    char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$
86
	char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$
87
	// jsr308
88
	char[] TYPE_USE_TARGET  = "TYPE_USE".toCharArray(); //$NON-NLS-1$
89
	char[] TYPE_PARAMETER_TARGET = "TYPE_PARAMETER".toCharArray(); //$NON-NLS-1$
83
90
84
	// Constant compound names
91
	// Constant compound names
85
	char[][] JAVA_LANG = {JAVA, LANG};
92
	char[][] JAVA_LANG = {JAVA, LANG};
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-500 / +1474 lines)
Lines 71-76 Link Here
71
	//expression stack
71
	//expression stack
72
	protected final static int ExpressionStackIncrement = 100;
72
	protected final static int ExpressionStackIncrement = 100;
73
73
74
	// annotation stack
75
	protected final static int TypeAnnotationStackIncrement = 100;
76
	
74
	protected final static int GenericsStackIncrement = 10;
77
	protected final static int GenericsStackIncrement = 10;
75
78
76
	private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
79
	private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
Lines 788-794 Link Here
788
	protected int[] expressionLengthStack;
791
	protected int[] expressionLengthStack;
789
	protected int expressionPtr;
792
	protected int expressionPtr;
790
	protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
793
	protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
794
	protected int unattachedAnnotationPtr;  // used for figuring out whether some set of annotations are annotating a dimension or not.
791
	public int firstToken ; // handle for multiple parsing goals
795
	public int firstToken ; // handle for multiple parsing goals
796
	
797
	/* jsr308 -- Type annotation management, we now maintain type annotations in a separate stack
798
	   as otherwise they get interspersed with other expressions and some of the code is not prepared
799
	   to handle such interleaving and will look ugly if changed. 
800
	   
801
	   See consumeArrayCreationExpressionWithoutInitializer for example. 
802
	   
803
	   See that annotations gets pushed into expression stack the moment an annotation is discovered and
804
	   get moved to the new type annotations stack only later when the annotation is recognized to be a
805
	   type annotation. Where ambiguities exist (i.e 1.7 annotation occurs in a place sanctioned for an
806
	   1.5 type annotation, the annotation continues to stay in the expression stack, but in these case
807
	   interleaving is not an issue.
808
	*/  
809
	protected int typeAnnotationPtr;
810
	protected int typeAnnotationLengthPtr;
811
	protected Annotation [] typeAnnotationStack = new Annotation[TypeAnnotationStackIncrement];
812
	protected int [] typeAnnotationLengthStack;
792
	// generics management
813
	// generics management
793
	protected int genericsIdentifiersLengthPtr;
814
	protected int genericsIdentifiersLengthPtr;
794
	protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement];
815
	protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement];
Lines 884-889 Link Here
884
	this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8;
905
	this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8;
885
	this.astLengthStack = new int[50];
906
	this.astLengthStack = new int[50];
886
	this.expressionLengthStack = new int[30];
907
	this.expressionLengthStack = new int[30];
908
	this.typeAnnotationLengthStack = new int[30];
887
	this.intStack = new int[50];
909
	this.intStack = new int[50];
888
	this.identifierStack = new char[30][];
910
	this.identifierStack = new char[30][];
889
	this.identifierLengthStack = new int[30];
911
	this.identifierLengthStack = new int[30];
Lines 1232-1237 Link Here
1232
	}
1254
	}
1233
}
1255
}
1234
protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(TypeReference rightSide, int dim) {
1256
protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(TypeReference rightSide, int dim) {
1257
	Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
1235
	int nameSize = this.identifierLengthStack[this.identifierLengthPtr];
1258
	int nameSize = this.identifierLengthStack[this.identifierLengthPtr];
1236
	int tokensSize = nameSize;
1259
	int tokensSize = nameSize;
1237
	if (rightSide instanceof ParameterizedSingleTypeReference) {
1260
	if (rightSide instanceof ParameterizedSingleTypeReference) {
Lines 1287-1293 Link Here
1287
		typeArguments[nameSize - 1] = currentTypeArguments;
1310
		typeArguments[nameSize - 1] = currentTypeArguments;
1288
	}
1311
	}
1289
	this.identifierLengthPtr--;
1312
	this.identifierLengthPtr--;
1290
	return new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions);
1313
	ParameterizedQualifiedTypeReference typeRef = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, annotationsOnDimensions, positions);
1314
	int length;
1315
	if (this.typeAnnotationLengthPtr >= 0 && (length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
1316
		System.arraycopy(
1317
			this.typeAnnotationStack,
1318
			(this.typeAnnotationPtr -= length) + 1,
1319
			typeRef.annotations = new Annotation[length],
1320
			0,
1321
			length);
1322
		typeRef.sourceStart = typeRef.annotations[0].sourceStart;
1323
		typeRef.bits |= ASTNode.HasTypeAnnotations;
1324
	}
1325
	return typeRef;
1291
}
1326
}
1292
protected void concatExpressionLists() {
1327
protected void concatExpressionLists() {
1293
	this.expressionLengthStack[--this.expressionLengthPtr]++;
1328
	this.expressionLengthStack[--this.expressionLengthPtr]++;
Lines 1630-1637 Link Here
1630
	this.expressionLengthPtr -- ;
1665
	this.expressionLengthPtr -- ;
1631
	arrayAllocation.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--];
1666
	arrayAllocation.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--];
1632
1667
1633
	arrayAllocation.type = getTypeReference(0);
1634
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1635
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1668
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1636
	this.expressionPtr -= length ;
1669
	this.expressionPtr -= length ;
1637
	System.arraycopy(
1670
	System.arraycopy(
Lines 1640-1645 Link Here
1640
		arrayAllocation.dimensions = new Expression[length],
1673
		arrayAllocation.dimensions = new Expression[length],
1641
		0,
1674
		0,
1642
		length);
1675
		length);
1676
	Annotation[][] annotationsOnDimensions = getAnnotationsOnDimensions(length);
1677
	arrayAllocation.annotationsOnDimensions = annotationsOnDimensions;
1678
	if (annotationsOnDimensions != null) {
1679
		arrayAllocation.bits |= ASTNode.HasTypeAnnotations;
1680
	}
1681
	arrayAllocation.type = getTypeReference(0);
1682
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1683
1643
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1684
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1644
	if (arrayAllocation.initializer == null) {
1685
	if (arrayAllocation.initializer == null) {
1645
		arrayAllocation.sourceEnd = this.endStatementPosition;
1686
		arrayAllocation.sourceEnd = this.endStatementPosition;
Lines 1654-1661 Link Here
1654
1695
1655
	int length;
1696
	int length;
1656
	ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression();
1697
	ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression();
1657
	arrayAllocation.type = getTypeReference(0);
1658
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1659
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1698
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1660
	this.expressionPtr -= length ;
1699
	this.expressionPtr -= length ;
1661
	System.arraycopy(
1700
	System.arraycopy(
Lines 1664-1669 Link Here
1664
		arrayAllocation.dimensions = new Expression[length],
1703
		arrayAllocation.dimensions = new Expression[length],
1665
		0,
1704
		0,
1666
		length);
1705
		length);
1706
	Annotation[][] annotationsOnDimensions = getAnnotationsOnDimensions(length);
1707
	arrayAllocation.annotationsOnDimensions = annotationsOnDimensions;
1708
	if (annotationsOnDimensions != null) {
1709
		arrayAllocation.bits |= ASTNode.HasTypeAnnotations;
1710
	}
1711
	arrayAllocation.type = getTypeReference(0);
1712
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1667
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1713
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1668
	if (arrayAllocation.initializer == null) {
1714
	if (arrayAllocation.initializer == null) {
1669
		arrayAllocation.sourceEnd = this.endStatementPosition;
1715
		arrayAllocation.sourceEnd = this.endStatementPosition;
Lines 2059-2065 Link Here
2059
	pushOnAstStack(caseStatement);
2105
	pushOnAstStack(caseStatement);
2060
}
2106
}
2061
protected void consumeCastExpressionLL1() {
2107
protected void consumeCastExpressionLL1() {
2062
	//CastExpression ::= '(' Expression ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
2108
	//CastExpression ::= '(' Name ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
2063
	// Expression is used in order to make the grammar LL1
2109
	// Expression is used in order to make the grammar LL1
2064
2110
2065
	//optimize push/pop
2111
	//optimize push/pop
Lines 2074-2079 Link Here
2074
	this.expressionLengthPtr -- ;
2120
	this.expressionLengthPtr -- ;
2075
	updateSourcePosition(cast);
2121
	updateSourcePosition(cast);
2076
	cast.sourceEnd=exp.sourceEnd;
2122
	cast.sourceEnd=exp.sourceEnd;
2123
}
2124
protected void consumeCastExpressionLL1WithTypeAnnotations() {
2125
	// CastExpression ::= '(' Modifiers Name ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
2126
	// Expression is used in order to make the grammar LL1
2127
2128
	//optimize push/pop
2129
2130
	// pop the expression
2131
	Expression expression = this.expressionStack[this.expressionPtr--];
2132
	this.expressionLengthPtr--;
2133
	// pop the type reference
2134
	TypeReference typeReference = (TypeReference) this.expressionStack[this.expressionPtr--];
2135
	this.expressionLengthPtr--;
2136
	
2137
	int length;
2138
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2139
		System.arraycopy(
2140
				this.expressionStack,
2141
				(this.expressionPtr -= length) + 1,
2142
				typeReference.annotations = new Annotation[length],
2143
				0,
2144
				length);
2145
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2146
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2147
			typeReferenceSourceStart = this.modifiersSourceStart;
2148
		}
2149
		typeReference.sourceStart = typeReferenceSourceStart;
2150
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2151
	}
2152
	Expression cast;
2153
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2154
	// pop the two positions for left and right parenthesis 
2155
	updateSourcePosition(cast);
2156
	cast.sourceEnd = expression.sourceEnd;
2157
	if (this.modifiers != ClassFileConstants.AccDefault) {
2158
		problemReporter().invalidLocationForModifiers(typeReference);
2159
	}
2160
	resetModifiers();
2077
}
2161
}
2078
protected void consumeCastExpressionWithGenericsArray() {
2162
protected void consumeCastExpressionWithGenericsArray() {
2079
	// CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2163
	// CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
Lines 2092-2097 Link Here
2092
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2176
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2093
	cast.sourceEnd = exp.sourceEnd;
2177
	cast.sourceEnd = exp.sourceEnd;
2094
}
2178
}
2179
protected void consumeCastExpressionWithGenericsArrayWithTypeAnnotations() {
2180
	// CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
2181
	int end = this.intStack[this.intPtr--];
2182
	int dim = this.intStack[this.intPtr--];
2183
2184
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2185
	TypeReference typeReference = getTypeReference(dim);
2186
	
2187
	// pop expression
2188
	Expression expression = this.expressionStack[this.expressionPtr--];
2189
	this.expressionLengthPtr--;
2190
2191
	int length;
2192
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2193
		System.arraycopy(
2194
				this.expressionStack,
2195
				(this.expressionPtr -= length) + 1,
2196
				typeReference.annotations = new Annotation[length],
2197
				0,
2198
				length);
2199
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2200
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2201
			typeReferenceSourceStart = this.modifiersSourceStart;
2202
		}
2203
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2204
		typeReference.sourceStart = typeReferenceSourceStart;
2205
	}
2206
	Expression cast;
2207
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2208
	this.intPtr--;
2209
	typeReference.sourceEnd = end - 1;
2210
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2211
	cast.sourceEnd = expression.sourceEnd;
2212
	if (this.modifiers != ClassFileConstants.AccDefault) {
2213
		problemReporter().invalidLocationForModifiers(typeReference);
2214
	}
2215
	resetModifiers();
2216
}
2095
protected void consumeCastExpressionWithNameArray() {
2217
protected void consumeCastExpressionWithNameArray() {
2096
	// CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2218
	// CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2097
2219
Lines 2109-2114 Link Here
2109
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2231
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2110
	cast.sourceEnd = exp.sourceEnd;
2232
	cast.sourceEnd = exp.sourceEnd;
2111
}
2233
}
2234
protected void consumeCastExpressionWithNameArrayWithTypeAnnotations() {
2235
	// CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
2236
2237
	int end = this.intStack[this.intPtr--];
2238
2239
	// handle type arguments
2240
	pushOnGenericsLengthStack(0);
2241
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2242
2243
	// pop expression
2244
	Expression expression = this.expressionStack[this.expressionPtr--];
2245
	this.expressionLengthPtr--;
2246
	TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]);
2247
2248
	int length;
2249
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2250
		System.arraycopy(
2251
				this.expressionStack,
2252
				(this.expressionPtr -= length) + 1,
2253
				typeReference.annotations = new Annotation[length],
2254
				0,
2255
				length);
2256
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2257
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2258
			typeReferenceSourceStart = this.modifiersSourceStart;
2259
		}
2260
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2261
		typeReference.sourceStart = typeReferenceSourceStart;
2262
	}
2263
	Expression cast;
2264
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2265
	typeReference.sourceEnd = end - 1;
2266
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2267
	cast.sourceEnd = expression.sourceEnd;
2268
	if (this.modifiers != ClassFileConstants.AccDefault) {
2269
		problemReporter().invalidLocationForModifiers(typeReference);
2270
	}
2271
	resetModifiers();
2272
}
2112
protected void consumeCastExpressionWithPrimitiveType() {
2273
protected void consumeCastExpressionWithPrimitiveType() {
2113
	// CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
2274
	// CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
2114
2275
Lines 2125-2130 Link Here
2125
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2286
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2126
	cast.sourceEnd = exp.sourceEnd;
2287
	cast.sourceEnd = exp.sourceEnd;
2127
}
2288
}
2289
protected void consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations() {
2290
	// CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression
2291
2292
	//this.intStack : posOfLeftParen dim posOfRightParen
2293
	int end = this.intStack[this.intPtr--];
2294
2295
	// pop expression
2296
	Expression expression = this.expressionStack[this.expressionPtr--];
2297
	this.expressionLengthPtr--;
2298
2299
	TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]);
2300
	int length;
2301
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2302
		System.arraycopy(
2303
				this.expressionStack,
2304
				(this.expressionPtr -= length) + 1,
2305
				typeReference.annotations = new Annotation[length],
2306
				0,
2307
				length);
2308
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2309
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2310
			typeReferenceSourceStart = this.modifiersSourceStart;
2311
		}
2312
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2313
		typeReference.sourceStart = typeReferenceSourceStart;
2314
	}
2315
	
2316
	Expression cast;
2317
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2318
	
2319
	typeReference.sourceEnd = end - 1;
2320
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2321
	cast.sourceEnd = expression.sourceEnd;
2322
	if (this.modifiers != ClassFileConstants.AccDefault) {
2323
		problemReporter().invalidLocationForModifiers(typeReference);
2324
	}
2325
	resetModifiers();
2326
}
2128
protected void consumeCastExpressionWithQualifiedGenericsArray() {
2327
protected void consumeCastExpressionWithQualifiedGenericsArray() {
2129
	// CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2328
	// CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2130
	Expression exp;
2329
	Expression exp;
Lines 2133-2139 Link Here
2133
	int end = this.intStack[this.intPtr--];
2332
	int end = this.intStack[this.intPtr--];
2134
2333
2135
	int dim = this.intStack[this.intPtr--];
2334
	int dim = this.intStack[this.intPtr--];
2136
	TypeReference rightSide = getTypeReference(0);
2335
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2137
2336
2138
	ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
2337
	ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
2139
	this.intPtr--;
2338
	this.intPtr--;
Lines 2141-2146 Link Here
2141
	castType.sourceEnd = end - 1;
2340
	castType.sourceEnd = end - 1;
2142
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2341
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2143
	cast.sourceEnd = exp.sourceEnd;
2342
	cast.sourceEnd = exp.sourceEnd;
2343
}
2344
protected void consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations() {
2345
	// CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2346
	int end = this.intStack[this.intPtr--];
2347
2348
	int dim = this.intStack[this.intPtr--];
2349
	// pop expression
2350
	Expression expression = this.expressionStack[this.expressionPtr--];
2351
	this.expressionLengthPtr--;
2352
	
2353
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2354
2355
	ParameterizedQualifiedTypeReference typeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
2356
	this.intPtr--;
2357
	int length;
2358
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2359
		System.arraycopy(
2360
				this.expressionStack,
2361
				(this.expressionPtr -= length) + 1,
2362
				typeReference.annotations = new Annotation[length],
2363
				0,
2364
				length);
2365
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2366
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2367
			typeReferenceSourceStart = this.modifiersSourceStart;
2368
		}
2369
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2370
		typeReference.sourceStart = typeReferenceSourceStart;
2371
	}
2372
	Expression cast;
2373
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2374
	typeReference.sourceEnd = end - 1;
2375
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2376
	cast.sourceEnd = expression.sourceEnd;
2377
	if (this.modifiers != ClassFileConstants.AccDefault) {
2378
		problemReporter().invalidLocationForModifiers(typeReference);
2379
	}
2380
	resetModifiers();
2144
}
2381
}
2145
protected void consumeCatches() {
2382
protected void consumeCatches() {
2146
	// Catches ::= Catches CatchClause
2383
	// Catches ::= Catches CatchClause
Lines 2334-2339 Link Here
2334
	TypeReference superClass = getTypeReference(0);
2571
	TypeReference superClass = getTypeReference(0);
2335
	// There is a class declaration on the top of stack
2572
	// There is a class declaration on the top of stack
2336
	TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
2573
	TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
2574
	typeDecl.bits |= (superClass.bits & ASTNode.HasTypeAnnotations);
2337
	typeDecl.superclass = superClass;
2575
	typeDecl.superclass = superClass;
2338
	superClass.bits |= ASTNode.IsSuperType;
2576
	superClass.bits |= ASTNode.IsSuperType;
2339
	typeDecl.bodyStart = typeDecl.superclass.sourceEnd + 1;
2577
	typeDecl.bodyStart = typeDecl.superclass.sourceEnd + 1;
Lines 2355-2362 Link Here
2355
		typeDecl.superInterfaces = new TypeReference[length],
2593
		typeDecl.superInterfaces = new TypeReference[length],
2356
		0,
2594
		0,
2357
		length);
2595
		length);
2358
	for (int i = 0, max = typeDecl.superInterfaces.length; i < max; i++) {
2596
	TypeReference[] superinterfaces = typeDecl.superInterfaces;
2359
		typeDecl.superInterfaces[i].bits |= ASTNode.IsSuperType;
2597
	for (int i = 0, max = superinterfaces.length; i < max; i++) {
2598
		TypeReference typeReference = superinterfaces[i];
2599
		typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations);
2600
		typeReference.bits |= ASTNode.IsSuperType;
2360
	}
2601
	}
2361
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
2602
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
2362
	this.listLength = 0; // reset after having read super-interfaces
2603
	this.listLength = 0; // reset after having read super-interfaces
Lines 2690-2698 Link Here
2690
			}
2931
			}
2691
		}
2932
		}
2692
2933
2693
		if (!this.diet || insideFieldInitializer){
2934
		if (!this.options.ignoreMethodBodies) {
2694
			// add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere.
2935
			if (!this.diet || insideFieldInitializer){
2695
			constructorCall = SuperReference.implicitSuperConstructorCall();
2936
				// add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere.
2937
				constructorCall = SuperReference.implicitSuperConstructorCall();
2938
			}
2696
		}
2939
		}
2697
	}
2940
	}
2698
2941
Lines 2724-2729 Link Here
2724
	// ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
2967
	// ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
2725
2968
2726
	AbstractMethodDeclaration method = (AbstractMethodDeclaration)this.astStack[this.astPtr];
2969
	AbstractMethodDeclaration method = (AbstractMethodDeclaration)this.astStack[this.astPtr];
2970
2971
	// jsr308 -- consume receiver annotations
2972
	method.receiverAnnotations = null;
2973
	int length;
2974
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
2975
		System.arraycopy(
2976
				this.typeAnnotationStack,
2977
				(this.typeAnnotationPtr -= length) + 1,
2978
				method.receiverAnnotations = new Annotation[length],
2979
				0,
2980
				length);
2981
		method.bits |= ASTNode.HasTypeAnnotations;
2982
	}
2727
2983
2728
	if (this.currentToken == TokenNameLBRACE){
2984
	if (this.currentToken == TokenNameLBRACE){
2729
		method.bodyStart = this.scanner.currentPosition;
2985
		method.bodyStart = this.scanner.currentPosition;
Lines 2888-2893 Link Here
2888
}
3144
}
2889
protected void consumeDimWithOrWithOutExpr() {
3145
protected void consumeDimWithOrWithOutExpr() {
2890
	// DimWithOrWithOutExpr ::= '[' ']'
3146
	// DimWithOrWithOutExpr ::= '[' ']'
3147
	// DimWithOrWithOutExpr ::= OneOrMoreAnnotations '[' ']' 
2891
	pushOnExpressionStack(null);
3148
	pushOnExpressionStack(null);
2892
3149
2893
	if(this.currentElement != null && this.currentToken == TokenNameLBRACE) {
3150
	if(this.currentElement != null && this.currentToken == TokenNameLBRACE) {
Lines 3097-3102 Link Here
3097
			localDeclaration.annotations = new Annotation[length],
3354
			localDeclaration.annotations = new Annotation[length],
3098
			0,
3355
			0,
3099
			length);
3356
			length);
3357
		localDeclaration.bits |= ASTNode.HasTypeAnnotations;
3100
	}
3358
	}
3101
	if (hasModifiers) {
3359
	if (hasModifiers) {
3102
		localDeclaration.declarationSourceStart = declarationSourceStart;
3360
		localDeclaration.declarationSourceStart = declarationSourceStart;
Lines 3105-3110 Link Here
3105
		localDeclaration.declarationSourceStart = type.sourceStart;
3363
		localDeclaration.declarationSourceStart = type.sourceStart;
3106
	}
3364
	}
3107
	localDeclaration.type = type;
3365
	localDeclaration.type = type;
3366
	localDeclaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3108
3367
3109
	ForeachStatement iteratorForStatement =
3368
	ForeachStatement iteratorForStatement =
3110
		new ForeachStatement(
3369
		new ForeachStatement(
Lines 3195-3200 Link Here
3195
	char[] identifierName = this.identifierStack[this.identifierPtr];
3454
	char[] identifierName = this.identifierStack[this.identifierPtr];
3196
	long namePosition = this.identifierPositionStack[this.identifierPtr];
3455
	long namePosition = this.identifierPositionStack[this.identifierPtr];
3197
	int extendedDimension = this.intStack[this.intPtr--];
3456
	int extendedDimension = this.intStack[this.intPtr--];
3457
	// pop any annotations on extended dimensions now, so they don't pollute the base dimensions.
3458
	Annotation [][] annotationsOnExtendedDimensions = extendedDimension == 0 ? null : getAnnotationsOnDimensions(extendedDimension);
3198
	AbstractVariableDeclaration declaration;
3459
	AbstractVariableDeclaration declaration;
3199
	// create the ast node
3460
	// create the ast node
3200
	boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0;
3461
	boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0;
Lines 3227-3232 Link Here
3227
					declaration.annotations = new Annotation[length],
3488
					declaration.annotations = new Annotation[length],
3228
					0,
3489
					0,
3229
					length);
3490
					length);
3491
				declaration.bits |= ASTNode.HasTypeAnnotations;
3230
			}
3492
			}
3231
			type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension
3493
			type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension
3232
			if (declaration.declarationSourceStart == -1) {
3494
			if (declaration.declarationSourceStart == -1) {
Lines 3248-3253 Link Here
3248
					declaration.annotations = new Annotation[length],
3510
					declaration.annotations = new Annotation[length],
3249
					0,
3511
					0,
3250
					length);
3512
					length);
3513
				declaration.bits |= ASTNode.HasTypeAnnotations;
3251
			}
3514
			}
3252
			// Store javadoc only on first declaration as it is the same for all ones
3515
			// Store javadoc only on first declaration as it is the same for all ones
3253
			FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
3516
			FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
Lines 3265-3278 Link Here
3265
		if (annotations != null) {
3528
		if (annotations != null) {
3266
			final int annotationsLength = annotations.length;
3529
			final int annotationsLength = annotations.length;
3267
			System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength);
3530
			System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength);
3531
			declaration.bits |= ASTNode.HasTypeAnnotations;
3268
		}
3532
		}
3269
	}
3533
	}
3270
3534
3271
	if (extendedDimension == 0) {
3535
	if (extendedDimension == 0) {
3272
		declaration.type = type;
3536
		declaration.type = type;
3537
		declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3273
	} else {
3538
	} else {
3274
		int dimension = typeDim + extendedDimension;
3539
		int dimension = typeDim + extendedDimension;
3275
		declaration.type = copyDims(type, dimension);
3540
		Annotation [][] annotationsOnAllDimensions = null;
3541
		Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions();
3542
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
3543
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedDimension, annotationsOnExtendedDimensions); 
3544
			declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3545
		}
3546
		declaration.type = copyDims(type, dimension, annotationsOnAllDimensions);
3276
	}
3547
	}
3277
	this.variablesCounter[this.nestedType]++;
3548
	this.variablesCounter[this.nestedType]++;
3278
	pushOnAstStack(declaration);
3549
	pushOnAstStack(declaration);
Lines 3298-3303 Link Here
3298
		}
3569
		}
3299
		this.lastIgnoredToken = -1;
3570
		this.lastIgnoredToken = -1;
3300
	}
3571
	}
3572
}
3573
protected Annotation[][] getMergedAnnotationsOnDimensions(int dims, Annotation[][] annotationsOnDimensions,
3574
		int extendedDims, Annotation[][] annotationsOnExtendedDimensions) {
3575
3576
if (annotationsOnDimensions == null && annotationsOnExtendedDimensions == null)
3577
return null;
3578
3579
Annotation [][] mergedAnnotations = new Annotation[dims + extendedDims][];
3580
for (int i = 0; i < dims; i++) {
3581
if (annotationsOnDimensions != null) {
3582
mergedAnnotations[i] = annotationsOnDimensions[i];
3583
} else {
3584
mergedAnnotations[i] = null;
3585
}
3586
}
3587
for (int i = dims, j = 0; i < dims + extendedDims; i++, j++) {
3588
if (annotationsOnExtendedDimensions != null) {
3589
mergedAnnotations[i] = annotationsOnExtendedDimensions[j];
3590
} else {
3591
mergedAnnotations[i] = null;
3592
}
3593
}
3594
3595
return mergedAnnotations;
3301
}
3596
}
3302
protected void consumeEnumBodyNoConstants() {
3597
protected void consumeEnumBodyNoConstants() {
3303
	// nothing to do
3598
	// nothing to do
Lines 3409-3414 Link Here
3409
         enumConstant.annotations = new Annotation[length],
3704
         enumConstant.annotations = new Annotation[length],
3410
         0,
3705
         0,
3411
         length);
3706
         length);
3707
		enumConstant.bits |= ASTNode.HasTypeAnnotations;
3412
   }
3708
   }
3413
   pushOnAstStack(enumConstant);
3709
   pushOnAstStack(enumConstant);
3414
	if (this.currentElement != null){
3710
	if (this.currentElement != null){
Lines 3928-3937 Link Here
3928
		endOfEllipsis = this.intStack[this.intPtr--];
4224
		endOfEllipsis = this.intStack[this.intPtr--];
3929
	}
4225
	}
3930
	int firstDimensions = this.intStack[this.intPtr--];
4226
	int firstDimensions = this.intStack[this.intPtr--];
3931
	final int typeDimensions = firstDimensions + extendedDimensions;
4227
	TypeReference type = getUnannotatedTypeReference(extendedDimensions);
3932
	TypeReference type = getTypeReference(typeDimensions);
4228
	Annotation [] varArgsAnnotations = null;
4229
	int length;
4230
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
4231
		System.arraycopy(
4232
			this.typeAnnotationStack,
4233
			(this.typeAnnotationPtr -= length) + 1,
4234
			varArgsAnnotations = new Annotation[length],
4235
			0,
4236
			length);
4237
	} 
4238
	final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
4239
4240
	if (typeDimensions != extendedDimensions) {
4241
		// jsr308 type annotations management
4242
		Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
4243
		Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
4244
		Annotation [][] annotationsOnAllDimensions = null;
4245
		if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
4246
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
4247
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
4248
		}
4249
		type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
4250
		type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
4251
	}
3933
	if (isVarArgs) {
4252
	if (isVarArgs) {
3934
		type = copyDims(type, typeDimensions + 1);
3935
		if (extendedDimensions == 0) {
4253
		if (extendedDimensions == 0) {
3936
			type.sourceEnd = endOfEllipsis;
4254
			type.sourceEnd = endOfEllipsis;
3937
		}
4255
		}
Lines 3946-3953 Link Here
3946
			type,
4264
			type,
3947
			this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
4265
			this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
3948
	arg.declarationSourceStart = modifierPositions;
4266
	arg.declarationSourceStart = modifierPositions;
4267
	arg.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3949
	// consume annotations
4268
	// consume annotations
3950
	int length;
3951
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
4269
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
3952
		System.arraycopy(
4270
		System.arraycopy(
3953
			this.expressionStack,
4271
			this.expressionStack,
Lines 3955-3960 Link Here
3955
			arg.annotations = new Annotation[length],
4273
			arg.annotations = new Annotation[length],
3956
			0,
4274
			0,
3957
			length);
4275
			length);
4276
		arg.bits |= ASTNode.HasTypeAnnotations;
3958
		RecoveredType currentRecoveryType = this.currentRecoveryType();
4277
		RecoveredType currentRecoveryType = this.currentRecoveryType();
3959
		if (currentRecoveryType != null)
4278
		if (currentRecoveryType != null)
3960
			currentRecoveryType.annotationsConsumed(arg.annotations);
4279
			currentRecoveryType.annotationsConsumed(arg.annotations);
Lines 3974-3980 Link Here
3974
				extendedDimensions > 0) {
4293
				extendedDimensions > 0) {
3975
			problemReporter().illegalExtendedDimensions(arg);
4294
			problemReporter().illegalExtendedDimensions(arg);
3976
		}
4295
		}
4296
	} else {
4297
		// The grammar allows trailing annotations in FormalParameter as in 
4298
		// "int @NonNull[] @Misplaced parameter" in order to allow for constructs such as
4299
		// "Object @NonNull[] @Correct ... objects" -- we prune these here.
4300
		if (varArgsAnnotations != null) {
4301
			problemReporter().misplacedTypeAnnotations(varArgsAnnotations[0],
4302
					varArgsAnnotations[varArgsAnnotations.length-1]);
4303
		}
3977
	}
4304
	}
4305
}
4306
protected Annotation[][] getAnnotationsOnDimensions(int dimensionsCount) {
4307
	Annotation [][] dimensionsAnnotations = null;
4308
	if (dimensionsCount > 0) {
4309
		for (int i = 0; i < dimensionsCount; i++) {
4310
			Annotation [] annotations = null;
4311
			int length;
4312
			if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
4313
				System.arraycopy(
4314
						this.typeAnnotationStack,
4315
						(this.typeAnnotationPtr -= length) + 1,
4316
						annotations = new Annotation[length],
4317
						0,
4318
						length);
4319
				if (dimensionsAnnotations == null) {
4320
					dimensionsAnnotations = new Annotation[dimensionsCount][];
4321
				}
4322
				dimensionsAnnotations[dimensionsCount - i - 1] = annotations;
4323
			}
4324
		}
4325
	}
4326
	return dimensionsAnnotations;
3978
}
4327
}
3979
protected void consumeFormalParameterList() {
4328
protected void consumeFormalParameterList() {
3980
	// FormalParameterList ::= FormalParameterList ',' FormalParameter
4329
	// FormalParameterList ::= FormalParameterList ',' FormalParameter
Lines 4036-4041 Link Here
4036
}
4385
}
4037
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
4386
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
4038
	// InsideCastExpressionWithQualifiedGenerics ::= $empty
4387
	// InsideCastExpressionWithQualifiedGenerics ::= $empty
4388
}
4389
protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() {
4390
	// InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty
4039
}
4391
}
4040
protected void consumeInstanceOfExpression() {
4392
protected void consumeInstanceOfExpression() {
4041
	// RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
4393
	// RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
Lines 4133-4140 Link Here
4133
		typeDecl.superInterfaces = new TypeReference[length],
4485
		typeDecl.superInterfaces = new TypeReference[length],
4134
		0,
4486
		0,
4135
		length);
4487
		length);
4136
	for (int i = 0, max = typeDecl.superInterfaces.length; i < max; i++) {
4488
	TypeReference[] superinterfaces = typeDecl.superInterfaces;
4137
		typeDecl.superInterfaces[i].bits |= ASTNode.IsSuperType;
4489
	for (int i = 0, max = superinterfaces.length; i < max; i++) {
4490
		TypeReference typeReference = superinterfaces[i];
4491
		typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations);
4492
		typeReference.bits |= ASTNode.IsSuperType;
4138
	}
4493
	}
4139
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
4494
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
4140
	this.listLength = 0; // reset after having read super-interfaces
4495
	this.listLength = 0; // reset after having read super-interfaces
Lines 4494-4501 Link Here
4494
	if (isNotAbstract) {
4849
	if (isNotAbstract) {
4495
		//statements
4850
		//statements
4496
		explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
4851
		explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
4497
		if (!this.options.ignoreMethodBodies) {
4852
		if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
4498
			if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
4853
			if (this.options.ignoreMethodBodies) {
4854
				this.astPtr -= length;
4855
			} else {
4499
				System.arraycopy(
4856
				System.arraycopy(
4500
					this.astStack,
4857
					this.astStack,
4501
					(this.astPtr -= length) + 1,
4858
					(this.astPtr -= length) + 1,
Lines 4503-4511 Link Here
4503
					0,
4860
					0,
4504
					length);
4861
					length);
4505
			}
4862
			}
4506
		} else {
4507
			length = this.astLengthStack[this.astLengthPtr--];
4508
			this.astPtr -= length;
4509
		}
4863
		}
4510
	}
4864
	}
4511
4865
Lines 4590-4595 Link Here
4590
	// MethodHeaderExtendedDims ::= Dimsopt
4944
	// MethodHeaderExtendedDims ::= Dimsopt
4591
	// now we update the returnType of the method
4945
	// now we update the returnType of the method
4592
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
4946
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
4947
	// jsr308 -- consume receiver annotations
4948
	md.receiverAnnotations = null;
4949
	int length;
4950
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
4951
		System.arraycopy(
4952
			this.typeAnnotationStack,
4953
			(this.typeAnnotationPtr -= length) + 1,
4954
			md.receiverAnnotations = new Annotation[length],
4955
			0,
4956
			length);
4957
		md.bits |= ASTNode.HasTypeAnnotations;
4958
	}
4593
	int extendedDims = this.intStack[this.intPtr--];
4959
	int extendedDims = this.intStack[this.intPtr--];
4594
	if(md.isAnnotationMethod()) {
4960
	if(md.isAnnotationMethod()) {
4595
		((AnnotationMethodDeclaration)md).extendedDimensions = extendedDims;
4961
		((AnnotationMethodDeclaration)md).extendedDimensions = extendedDims;
Lines 4598-4604 Link Here
4598
		TypeReference returnType = md.returnType;
4964
		TypeReference returnType = md.returnType;
4599
		md.sourceEnd = this.endPosition;
4965
		md.sourceEnd = this.endPosition;
4600
		int dims = returnType.dimensions() + extendedDims;
4966
		int dims = returnType.dimensions() + extendedDims;
4601
		md.returnType = copyDims(returnType, dims);
4967
		Annotation [][] annotationsOnDimensions = returnType.getAnnotationsOnDimensions();
4968
		Annotation [][] annotationsOnExtendedDimensions = getAnnotationsOnDimensions(extendedDims);
4969
		Annotation [][] annotationsOnAllDimensions = null;
4970
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
4971
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(returnType.dimensions(), annotationsOnDimensions, extendedDims, annotationsOnExtendedDimensions);
4972
		}
4973
		md.returnType = copyDims(returnType, dims, annotationsOnAllDimensions);
4602
		if (this.currentToken == TokenNameLBRACE){
4974
		if (this.currentToken == TokenNameLBRACE){
4603
			md.bodyStart = this.endPosition + 1;
4975
			md.bodyStart = this.endPosition + 1;
4604
		}
4976
		}
Lines 4682-4688 Link Here
4682
	long selectorSource = this.identifierPositionStack[this.identifierPtr--];
5054
	long selectorSource = this.identifierPositionStack[this.identifierPtr--];
4683
	this.identifierLengthPtr--;
5055
	this.identifierLengthPtr--;
4684
	//type
5056
	//type
4685
	md.returnType = getTypeReference(this.intStack[this.intPtr--]);
5057
	TypeReference returnType = getTypeReference(this.intStack[this.intPtr--]);
5058
	md.returnType = returnType;
5059
	md.bits |= (returnType.bits & ASTNode.HasTypeAnnotations);
4686
5060
4687
	// consume type parameters
5061
	// consume type parameters
4688
	int length = this.genericsLengthStack[this.genericsLengthPtr--];
5062
	int length = this.genericsLengthStack[this.genericsLengthPtr--];
Lines 4908-4913 Link Here
4908
	// Resources ::= Resources ';' Resource
5282
	// Resources ::= Resources ';' Resource
4909
	concatNodeLists();
5283
	concatNodeLists();
4910
}
5284
}
5285
protected void consumeOneMoreTypeAnnotation() {
5286
	// OneOrMoreAnnotations ::= OneOrMoreAnnotations Annotation
5287
	this.expressionLengthPtr --;
5288
	Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--];
5289
	pushOnTypeAnnotationStack(annotation);
5290
	this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++;
5291
	if(!this.statementRecoveryActivated &&
5292
			this.options.sourceLevel < ClassFileConstants.JDK1_7 &&
5293
			this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
5294
		problemReporter().invalidUsageOfTypeAnnotations(annotation);
5295
}
5296
}
5297
protected void consumePotentialNameArrayType () {
5298
	
5299
	// FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId
5300
	// FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId
5301
	// PotentialNameArray -> $empty
5302
	// Dimensions including lack of have been pushed appropriately by action attached to DimsoptAnnotsopt
5303
	pushOnGenericsLengthStack(0); // handle type arguments
5304
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5305
}
5306
4911
protected void consumeNameArrayType() {
5307
protected void consumeNameArrayType() {
4912
	pushOnGenericsLengthStack(0); // handle type arguments
5308
	pushOnGenericsLengthStack(0); // handle type arguments
4913
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5309
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
Lines 4971-4979 Link Here
4971
	}
5367
	}
4972
	this.recordStringLiterals = true;
5368
	this.recordStringLiterals = true;
4973
}
5369
}
4974
protected void consumeOneDimLoop() {
5370
protected void consumeOneDimLoop(boolean expressionStackMayHaveAnnotations) {
4975
	// OneDimLoop ::= '[' ']'
5371
	// OneDimLoop ::= '[' ']'
5372
	// OneDimOrAnnot -> '[' ']'
4976
	this.dimensions++;
5373
	this.dimensions++;
5374
	if (!expressionStackMayHaveAnnotations || this.unattachedAnnotationPtr == -1 ) {
5375
		pushOnTypeAnnotationLengthStack(0); // no annotations for the current dimension.
5376
	} else { 
5377
		this.unattachedAnnotationPtr = -1;	// Leave type annotation stacks they are. 
5378
	}
5379
}
5380
protected void consumeOneDimLoopWithAnnotations() {
5381
	// OneDimLoop ::= OneOrMoreAnnotations '[' ']'
5382
	this.dimensions++;
5383
	// Top of expression stack contains annotations of length specified
5384
	// by top of expression length stack that apply to this dimension.
4977
}
5385
}
4978
protected void consumeOnlySynchronized() {
5386
protected void consumeOnlySynchronized() {
4979
	// OnlySynchronized ::= 'synchronized'
5387
	// OnlySynchronized ::= 'synchronized'
Lines 5143-5149 Link Here
5143
	pushOnGenericsLengthStack(0);
5551
	pushOnGenericsLengthStack(0);
5144
5552
5145
	pushOnExpressionStack(
5553
	pushOnExpressionStack(
5146
		new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
5554
		new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(this.intStack[this.intPtr--])));
5555
}
5556
protected void consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations() {
5557
	// PrimaryNoNewArray ::= Modifiers Name Dims '.' 'class'
5558
	this.intPtr--; // remove the class start position
5559
5560
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5561
	pushOnGenericsLengthStack(0);
5562
5563
	int classTokenSourceEnd = this.intStack[this.intPtr--];
5564
	TypeReference typeReference = getUnannotatedTypeReference(this.intStack[this.intPtr--]);
5565
	int length;
5566
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5567
		System.arraycopy(
5568
				this.expressionStack,
5569
				(this.expressionPtr -= length) + 1,
5570
				typeReference.annotations = new Annotation[length],
5571
				0,
5572
				length);
5573
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5574
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5575
			typeReferenceSourceStart = this.modifiersSourceStart;
5576
		}
5577
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5578
		typeReference.sourceStart = typeReferenceSourceStart;
5579
	}
5580
	pushOnExpressionStack(new ClassLiteralAccess(classTokenSourceEnd, typeReference));
5581
	if (this.modifiers != ClassFileConstants.AccDefault) {
5582
		problemReporter().invalidLocationForModifiers(typeReference);
5583
	}
5584
	resetModifiers();
5147
}
5585
}
5148
protected void consumePrimaryNoNewArrayName() {
5586
protected void consumePrimaryNoNewArrayName() {
5149
	// PrimaryNoNewArray ::= Name '.' 'class'
5587
	// PrimaryNoNewArray ::= Name '.' 'class'
Lines 5152-5167 Link Here
5152
	// handle type arguments
5590
	// handle type arguments
5153
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5591
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5154
	pushOnGenericsLengthStack(0);
5592
	pushOnGenericsLengthStack(0);
5155
	TypeReference typeReference = getTypeReference(0);
5593
	TypeReference typeReference = getUnannotatedTypeReference(0); // TODO (Srikanth) needs fix
5156
5594
5157
	pushOnExpressionStack(
5595
	pushOnExpressionStack(
5158
		new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
5596
		new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
5597
}
5598
protected void consumePrimaryNoNewArrayNameWithTypeAnnotations() {
5599
	// PrimaryNoNewArray ::= Modifiers Name '.' 'class'
5600
	this.intPtr--; // remove the class start position
5601
5602
	// handle type arguments
5603
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5604
	pushOnGenericsLengthStack(0);
5605
	TypeReference typeReference = getUnannotatedTypeReference(0); // TODO (Srikanth) needs fix
5606
	int length;
5607
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5608
		System.arraycopy(
5609
				this.expressionStack,
5610
				(this.expressionPtr -= length) + 1,
5611
				typeReference.annotations = new Annotation[length],
5612
				0,
5613
				length);
5614
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5615
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5616
			typeReferenceSourceStart = this.modifiersSourceStart;
5617
		}
5618
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5619
		typeReference.sourceStart = typeReferenceSourceStart;
5620
	}
5621
5622
	pushOnExpressionStack(new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
5623
	if (this.modifiers != ClassFileConstants.AccDefault) {
5624
		problemReporter().invalidLocationForModifiers(typeReference);
5625
	}
5626
	resetModifiers();
5159
}
5627
}
5160
protected void consumePrimaryNoNewArrayNameSuper() {
5628
protected void consumePrimaryNoNewArrayNameSuper() {
5161
	// PrimaryNoNewArray ::= Name '.' 'super'
5629
	// PrimaryNoNewArray ::= Name '.' 'super'
5162
	// handle type arguments
5630
	// handle type arguments
5163
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5631
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5164
	pushOnGenericsLengthStack(0);
5632
	pushOnGenericsLengthStack(0);
5633
	pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here.
5165
	TypeReference typeReference = getTypeReference(0);
5634
	TypeReference typeReference = getTypeReference(0);
5166
5635
5167
	pushOnExpressionStack(
5636
	pushOnExpressionStack(
Lines 5175-5181 Link Here
5175
	// handle type arguments
5644
	// handle type arguments
5176
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5645
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5177
	pushOnGenericsLengthStack(0); // handle type arguments
5646
	pushOnGenericsLengthStack(0); // handle type arguments
5178
5647
	pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here.
5179
	TypeReference typeReference = getTypeReference(0);
5648
	TypeReference typeReference = getTypeReference(0);
5180
5649
5181
	pushOnExpressionStack(
5650
	pushOnExpressionStack(
Lines 5188-5200 Link Here
5188
	// PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
5657
	// PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
5189
	this.intPtr--; // remove the class start position
5658
	this.intPtr--; // remove the class start position
5190
	pushOnExpressionStack(
5659
	pushOnExpressionStack(
5191
		new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
5660
		new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(this.intStack[this.intPtr--])));
5661
}
5662
protected void consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations() {
5663
	// PrimaryNoNewArray ::= Modifiers PrimitiveType Dims '.' 'class'
5664
	this.intPtr--; // remove the class start position
5665
	int classTokeSourceEnd = this.intStack[this.intPtr--];
5666
	TypeReference typeReference = getUnannotatedTypeReference(this.intStack[this.intPtr--]);
5667
	int length;
5668
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5669
		System.arraycopy(
5670
				this.expressionStack,
5671
				(this.expressionPtr -= length) + 1,
5672
				typeReference.annotations = new Annotation[length],
5673
				0,
5674
				length);
5675
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5676
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5677
			typeReferenceSourceStart = this.modifiersSourceStart;
5678
		}
5679
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5680
		typeReference.sourceStart = typeReferenceSourceStart;
5681
	}
5682
	pushOnExpressionStack(new ClassLiteralAccess(classTokeSourceEnd, typeReference));
5683
	if (this.modifiers != ClassFileConstants.AccDefault) {
5684
		problemReporter().invalidLocationForModifiers(typeReference);
5685
	}
5686
	resetModifiers();
5192
}
5687
}
5193
protected void consumePrimaryNoNewArrayPrimitiveType() {
5688
protected void consumePrimaryNoNewArrayPrimitiveType() {
5194
	// PrimaryNoNewArray ::= PrimitiveType '.' 'class'
5689
	// PrimaryNoNewArray ::= PrimitiveType '.' 'class'
5195
	this.intPtr--; // remove the class start position
5690
	this.intPtr--; // remove the class start position
5196
	pushOnExpressionStack(
5691
	pushOnExpressionStack(
5197
		new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(0)));
5692
		new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(0)));
5693
}
5694
protected void consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations() {
5695
	// PrimaryNoNewArray ::= Modifiers PrimitiveType '.' 'class'
5696
	this.intPtr--; // remove the class start position
5697
	int classTokenSourceEnd = this.intStack[this.intPtr--];
5698
	TypeReference typeReference = getUnannotatedTypeReference(0);
5699
	int length;
5700
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5701
		System.arraycopy(
5702
				this.expressionStack,
5703
				(this.expressionPtr -= length) + 1,
5704
				typeReference.annotations = new Annotation[length],
5705
				0,
5706
				length);
5707
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5708
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5709
			typeReferenceSourceStart = this.modifiersSourceStart;
5710
		}
5711
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5712
		typeReference.sourceStart = typeReferenceSourceStart;
5713
	}
5714
	pushOnExpressionStack(new ClassLiteralAccess(classTokenSourceEnd, typeReference));
5715
	if (this.modifiers != ClassFileConstants.AccDefault) {
5716
		problemReporter().invalidLocationForModifiers(typeReference);
5717
	}
5718
	resetModifiers();
5198
}
5719
}
5199
protected void consumePrimaryNoNewArrayThis() {
5720
protected void consumePrimaryNoNewArrayThis() {
5200
	// PrimaryNoNewArray ::= 'this'
5721
	// PrimaryNoNewArray ::= 'this'
Lines 5325-7140 Link Here
5325
	// PushRPAREN ::= ')'
5846
	// PushRPAREN ::= ')'
5326
	pushOnIntStack(this.rParenPos);
5847
	pushOnIntStack(this.rParenPos);
5327
}
5848
}
5849
protected void consumeUnannotatedType() {
5850
	/* We go through some song & dance here to get the type annotations stacks
5851
	   to reflect the fact that this type was unannotated. Using a dummy non-terminal
5852
	   with an empty rhs leads to conflicts in many places :-(
5853
	*/
5854
	pushOnTypeAnnotationLengthStack(0); // either done or else made room.
5855
	int dims = this.intStack[this.intPtr];
5856
	if (dims != 0) {
5857
		System.arraycopy(
5858
				this.typeAnnotationLengthStack,
5859
				this.typeAnnotationLengthPtr - dims,
5860
				this.typeAnnotationLengthStack,
5861
				this.typeAnnotationLengthPtr - dims + 1,
5862
				dims);
5863
		this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims] = 0; // tag type as unannotated
5864
	}
5865
}
5866
protected void consumeAnnotatedType() {
5867
	/* We go through some song & dance here to get the type annotations stacks
5868
	   to reflect the fact that this type was unannotated. Using a dummy non-terminal
5869
	   with an empty rhs leads to conflicts in many places :-(
5870
	*/
5871
	int dims = this.intStack[this.intPtr];
5872
	if (dims != 0) {
5873
		int counter = 0;
5874
		for (int i = 0; i < dims; i++) {
5875
			// we count existing dimensions with annotations
5876
			counter += this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1 + i];
5877
		}
5878
		System.arraycopy(
5879
				this.typeAnnotationLengthStack,
5880
				this.typeAnnotationLengthPtr - dims + 1,
5881
				this.typeAnnotationLengthStack,
5882
				this.typeAnnotationLengthPtr - dims + 2,
5883
				dims);
5884
		int length = this.expressionLengthStack[this.expressionLengthPtr--];
5885
		this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1] = length;
5886
		int typeAnnotationStackLength = this.typeAnnotationStack.length;
5887
		if (this.typeAnnotationPtr + counter + length >= typeAnnotationStackLength) {
5888
			System.arraycopy(
5889
					this.typeAnnotationStack,
5890
					0,
5891
					this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement],
5892
					0,
5893
					typeAnnotationStackLength);
5894
		}
5895
		System.arraycopy(
5896
				this.typeAnnotationStack,
5897
				this.typeAnnotationPtr - counter + 1,
5898
				this.typeAnnotationStack,
5899
				this.typeAnnotationPtr - counter + 1 + length,
5900
				counter);
5901
		System.arraycopy(
5902
				this.expressionStack,
5903
				(this.expressionPtr -= length) + 1,
5904
				this.typeAnnotationStack,
5905
				this.typeAnnotationPtr - counter + 1,
5906
				length);
5907
		this.typeAnnotationPtr += length;
5908
		this.typeAnnotationLengthPtr++;
5909
	} else {
5910
		int length = this.expressionLengthStack[this.expressionLengthPtr--];
5911
		int typeAnnotationStackLength = this.typeAnnotationStack.length;
5912
		if (this.typeAnnotationPtr + length >= typeAnnotationStackLength) {
5913
			System.arraycopy(
5914
					this.typeAnnotationStack,
5915
					0,
5916
					this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement],
5917
					0,
5918
					typeAnnotationStackLength);
5919
		}
5920
		System.arraycopy(
5921
				this.expressionStack,
5922
				(this.expressionPtr -= length) + 1,
5923
				this.typeAnnotationStack,
5924
				this.typeAnnotationPtr + 1,
5925
				length);
5926
		this.typeAnnotationPtr += length;
5927
		pushOnTypeAnnotationLengthStack(length);
5928
	}
5929
//	if (this.modifiers != ClassFileConstants.AccDefault) {
5930
//		problemReporter().invalidLocationForModifiers(typeReference);
5931
//	}
5932
//	resetModifiers();
5933
}
5934
protected void consumeTypeAnnotation (boolean markAsUnattached) {
5935
	if(!this.statementRecoveryActivated &&
5936
			this.options.sourceLevel < ClassFileConstants.JDK1_7 &&
5937
			this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
5938
		problemReporter().invalidUsageOfTypeAnnotations((Annotation) this.expressionStack[this.expressionPtr]);
5939
	}
5940
	this.expressionLengthPtr --;
5941
	Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--];
5942
	pushOnTypeAnnotationStack(annotation);
5943
	if (markAsUnattached) {
5944
		if (this.unattachedAnnotationPtr == -1) {
5945
			this.unattachedAnnotationPtr = this.typeAnnotationPtr;
5946
		} else {
5947
			this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++;
5948
		}
5949
	} 
5950
}
5951
protected void consumeDimsWithTrailingAnnotsopt() {
5952
	// DimsoptAnnotsopt -> DimsAnnotLoop
5953
	pushOnIntStack(this.dimensions);
5954
	this.dimensions = 0;
5955
	if (this.unattachedAnnotationPtr == -1) {
5956
		pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg)
5957
	} else {
5958
		this.unattachedAnnotationPtr = -1;  // reset this and leave the annotation stacks as they are.
5959
	}
5960
}
5961
protected void consumeZeroTypeAnnotations(boolean shouldPush) {
5962
	if (shouldPush) {
5963
		pushOnTypeAnnotationLengthStack(0);
5964
	} else {
5965
		this.typeAnnotationLengthPtr --; // pop the 0 from the length stack
5966
	}
5967
}
5968
protected void consumeEmptyDimsoptAnnotsopt() {
5969
	// DimsoptAnnotsopt ::= $empty
5970
	pushOnIntStack(0);  // signal a non array
5971
	pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg)
5972
}
5973
protected void consumeRightParenForUnannotatedTypeCast() {
5974
	consumeUnannotatedType();
5975
	// PushRPAREN ::= ')'
5976
	pushOnIntStack(this.rParenPos);
5977
}
5978
protected void consumeRightParenForNameUnannotatedTypeCast() {
5979
	pushOnIntStack(0);  // signal a non array
5980
	consumeUnannotatedType();
5981
	// remove the fake dimension
5982
	this.intPtr--;
5983
	// PushRPAREN ::= ')'
5984
	pushOnIntStack(this.rParenPos);
5985
}
5986
protected void consumeRightParenForAnnotatedTypeCast() {
5987
	consumeUnannotatedType();
5988
	// PushRPAREN ::= ')'
5989
	pushOnIntStack(this.rParenPos);
5990
}
5991
protected void consumeRightParenForNameAndAnnotatedTypeCast() {
5992
	// push a zero for dimensions
5993
	pushOnIntStack(0);
5994
	consumeUnannotatedType();
5995
	// remove the fake dimension
5996
	this.intPtr--;
5997
	// PushRPAREN ::= ')'
5998
	pushOnIntStack(this.rParenPos);
5999
}
5328
// This method is part of an automatic generation : do NOT edit-modify
6000
// This method is part of an automatic generation : do NOT edit-modify
5329
protected void consumeRule(int act) {
6001
protected void consumeRule(int act) {
5330
  switch ( act ) {
6002
  switch ( act ) {
5331
    case 30 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); }  //$NON-NLS-1$
6003
    case 32 : if (DEBUG) { System.out.println("Type ::= TypeInternal"); }  //$NON-NLS-1$
6004
		    consumeUnannotatedType();   
6005
			break;
6006
 
6007
    case 34 : if (DEBUG) { System.out.println("Type0 ::= TypeInternal"); }  //$NON-NLS-1$
6008
		    consumeUnannotatedType();   
6009
			break;
6010
 
6011
    case 35 : if (DEBUG) { System.out.println("TypeInternal ::= PrimitiveType"); }  //$NON-NLS-1$
5332
		    consumePrimitiveType();  
6012
		    consumePrimitiveType();  
5333
			break;
6013
			break;
5334
 
6014
 
5335
    case 44 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); }  //$NON-NLS-1$
6015
    case 49 : if (DEBUG) { System.out.println("ReferenceType ::= ReferenceType0"); }  //$NON-NLS-1$
5336
		    consumeReferenceType();  
6016
		    consumeUnannotatedType();   
5337
			break;
6017
			break;
5338
 
6018
 
5339
    case 48 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); }  //$NON-NLS-1$
6019
    case 50 : if (DEBUG) { System.out.println("ReferenceType ::= Modifiers ReferenceType0"); }  //$NON-NLS-1$
5340
		    consumeClassOrInterfaceName();  
6020
		    consumeAnnotatedType();   
5341
			break;
6021
			break;
5342
 
6022
 
5343
    case 49 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); }  //$NON-NLS-1$
6023
    case 51 : if (DEBUG) { System.out.println("ReferenceType0 ::= ClassOrInterfaceType0"); }  //$NON-NLS-1$
5344
		    consumeClassOrInterface();  
6024
		    consumeReferenceType();   
5345
			break;
6025
			break;
5346
 
6026
 
5347
    case 50 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); }  //$NON-NLS-1$
6027
    case 53 : if (DEBUG) { System.out.println("Annotationsopt ::="); }  //$NON-NLS-1$
5348
		    consumeGenericType();  
6028
		    consumeZeroTypeAnnotations(true);  
5349
			break;
6029
			break;
5350
 
6030
 
5351
    case 51 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); }  //$NON-NLS-1$
6031
    case 58 : if (DEBUG) { System.out.println("ClassOrInterface ::= ClassOrInterface0"); }  //$NON-NLS-1$
6032
		    consumeZeroTypeAnnotations(true);  
6033
			break;
6034
 
6035
    case 59 : if (DEBUG) { System.out.println("ClassOrInterface0 ::= Name"); }  //$NON-NLS-1$
6036
		    consumeClassOrInterfaceName();   
6037
			break;
6038
 
6039
    case 61 : if (DEBUG) { System.out.println("PopZeroTypeAnnotations ::="); }  //$NON-NLS-1$
6040
		    consumeZeroTypeAnnotations(false);  
6041
			break;
6042
 
6043
    case 62 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments..."); }  //$NON-NLS-1$
6044
		    consumeGenericType();   
6045
			break;
6046
 
6047
    case 63 : if (DEBUG) { System.out.println("GenericTypeDotName ::= GenericType DOT Name"); }  //$NON-NLS-1$
6048
		    consumeClassOrInterface();   
6049
			break;
6050
 
6051
    case 64 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); }  //$NON-NLS-1$
5352
		    consumeGenericTypeWithDiamond();  
6052
		    consumeGenericTypeWithDiamond();  
5353
			break;
6053
			break;
5354
 
6054
 
5355
    case 52 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); }  //$NON-NLS-1$
6055
    case 66 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); }  //$NON-NLS-1$
5356
		    consumeArrayTypeWithTypeArgumentsName();  
5357
			break;
5358
 
5359
    case 53 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); }  //$NON-NLS-1$
5360
		    consumePrimitiveArrayType();  
6056
		    consumePrimitiveArrayType();  
5361
			break;
6057
			break;
5362
 
6058
 
5363
    case 54 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); }  //$NON-NLS-1$
6059
    case 67 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); }  //$NON-NLS-1$
5364
		    consumeNameArrayType();  
6060
		    consumeNameArrayType();  
5365
			break;
6061
			break;
5366
 
6062
 
5367
    case 55 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); }  //$NON-NLS-1$
6063
    case 68 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); }  //$NON-NLS-1$
5368
		    consumeGenericTypeNameArrayType();  
6064
		    consumeGenericTypeNameArrayType();  
5369
			break;
6065
			break;
5370
 
6066
 
5371
    case 56 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); }  //$NON-NLS-1$
6067
    case 69 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); }  //$NON-NLS-1$
5372
		    consumeGenericTypeArrayType();  
6068
		    consumeGenericTypeArrayType();  
5373
			break;
6069
			break;
5374
 
6070
 
5375
    case 61 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); }  //$NON-NLS-1$
6071
    case 74 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); }  //$NON-NLS-1$
5376
		    consumeQualifiedName();  
6072
		    consumeQualifiedName();  
5377
			break;
6073
			break;
5378
 
6074
 
5379
    case 62 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); }  //$NON-NLS-1$
6075
    case 75 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); }  //$NON-NLS-1$
5380
		    consumeCompilationUnit();  
6076
		    consumeCompilationUnit();  
5381
			break;
6077
			break;
5382
 
6078
 
5383
    case 63 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); }  //$NON-NLS-1$
6079
    case 76 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); }  //$NON-NLS-1$
5384
		    consumeInternalCompilationUnit();  
6080
		    consumeInternalCompilationUnit();  
5385
			break;
6081
			break;
5386
 
6082
 
5387
    case 64 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
6083
    case 77 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
5388
		    consumeInternalCompilationUnit();  
6084
		    consumeInternalCompilationUnit();  
5389
			break;
6085
			break;
5390
 
6086
 
5391
    case 65 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
6087
    case 78 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
5392
		    consumeInternalCompilationUnitWithTypes();  
6088
		    consumeInternalCompilationUnitWithTypes();  
5393
			break;
6089
			break;
5394
 
6090
 
5395
    case 66 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
6091
    case 79 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
5396
		    consumeInternalCompilationUnitWithTypes();  
6092
		    consumeInternalCompilationUnitWithTypes();  
5397
			break;
6093
			break;
5398
 
6094
 
5399
    case 67 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
6095
    case 80 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
5400
		    consumeInternalCompilationUnit();  
6096
		    consumeInternalCompilationUnit();  
5401
			break;
6097
			break;
5402
 
6098
 
5403
    case 68 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); }  //$NON-NLS-1$
6099
    case 81 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); }  //$NON-NLS-1$
5404
		    consumeInternalCompilationUnitWithTypes();  
6100
		    consumeInternalCompilationUnitWithTypes();  
5405
			break;
6101
			break;
5406
 
6102
 
5407
    case 69 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
6103
    case 82 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
5408
		    consumeInternalCompilationUnitWithTypes();  
6104
		    consumeInternalCompilationUnitWithTypes();  
5409
			break;
6105
			break;
5410
 
6106
 
5411
    case 70 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); }  //$NON-NLS-1$
6107
    case 83 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); }  //$NON-NLS-1$
5412
		    consumeEmptyInternalCompilationUnit();  
6108
		    consumeEmptyInternalCompilationUnit();  
5413
			break;
6109
			break;
5414
 
6110
 
5415
    case 71 : if (DEBUG) { System.out.println("ReduceImports ::="); }  //$NON-NLS-1$
6111
    case 84 : if (DEBUG) { System.out.println("ReduceImports ::="); }  //$NON-NLS-1$
5416
		    consumeReduceImports();  
6112
		    consumeReduceImports();  
5417
			break;
6113
			break;
5418
 
6114
 
5419
    case 72 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); }  //$NON-NLS-1$
6115
    case 85 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); }  //$NON-NLS-1$
5420
		    consumeEnterCompilationUnit();  
6116
		    consumeEnterCompilationUnit();  
5421
			break;
6117
			break;
5422
 
6118
 
5423
    case 88 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); }  //$NON-NLS-1$
6119
    case 104 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); }  //$NON-NLS-1$
5424
		    consumeCatchHeader();  
6120
		    consumeCatchHeader();  
5425
			break;
6121
			break;
5426
 
6122
 
5427
    case 90 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); }  //$NON-NLS-1$
6123
    case 106 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); }  //$NON-NLS-1$
5428
		    consumeImportDeclarations();  
6124
		    consumeImportDeclarations();  
5429
			break;
6125
			break;
5430
 
6126
 
5431
    case 92 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); }  //$NON-NLS-1$
6127
    case 108 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); }  //$NON-NLS-1$
5432
		    consumeTypeDeclarations();  
6128
		    consumeTypeDeclarations();  
5433
			break;
6129
			break;
5434
 
6130
 
5435
    case 93 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); }  //$NON-NLS-1$
6131
    case 109 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); }  //$NON-NLS-1$
5436
		    consumePackageDeclaration();  
6132
		    consumePackageDeclaration();  
5437
			break;
6133
			break;
5438
 
6134
 
5439
    case 94 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); }  //$NON-NLS-1$
6135
    case 110 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); }  //$NON-NLS-1$
5440
		    consumePackageDeclarationNameWithModifiers();  
6136
		    consumePackageDeclarationNameWithModifiers();  
5441
			break;
6137
			break;
5442
 
6138
 
5443
    case 95 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); }  //$NON-NLS-1$
6139
    case 111 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); }  //$NON-NLS-1$
5444
		    consumePackageDeclarationName();  
6140
		     consumePackageDeclarationName();  
5445
			break;
6141
			break;
5446
 
6142
 
5447
    case 96 : if (DEBUG) { System.out.println("PackageComment ::="); }  //$NON-NLS-1$
6143
    case 112 : if (DEBUG) { System.out.println("PackageComment ::="); }  //$NON-NLS-1$
5448
		    consumePackageComment();  
6144
		    consumePackageComment();  
5449
			break;
6145
			break;
5450
 
6146
 
5451
    case 101 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); }  //$NON-NLS-1$
6147
    case 117 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); }  //$NON-NLS-1$
5452
		    consumeImportDeclaration();  
6148
		    consumeImportDeclaration();  
5453
			break;
6149
			break;
5454
 
6150
 
5455
    case 102 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); }  //$NON-NLS-1$
6151
    case 118 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); }  //$NON-NLS-1$
5456
		    consumeSingleTypeImportDeclarationName();  
6152
		    consumeSingleTypeImportDeclarationName();  
5457
			break;
6153
			break;
5458
 
6154
 
5459
    case 103 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
6155
    case 119 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
5460
		    consumeImportDeclaration();  
6156
		    consumeImportDeclaration();  
5461
			break;
6157
			break;
5462
 
6158
 
5463
    case 104 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); }  //$NON-NLS-1$
6159
    case 120 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); }  //$NON-NLS-1$
5464
		    consumeTypeImportOnDemandDeclarationName();  
6160
		    consumeTypeImportOnDemandDeclarationName();  
5465
			break;
6161
			break;
5466
 
6162
 
5467
     case 107 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
6163
     case 123 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
5468
		    consumeEmptyTypeDeclaration();  
6164
		    consumeEmptyTypeDeclaration();  
5469
			break;
6165
			break;
5470
 
6166
 
5471
    case 111 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); }  //$NON-NLS-1$
6167
    case 127 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); }  //$NON-NLS-1$
5472
		    consumeModifiers2();  
6168
		    consumeModifiers2();  
5473
			break;
6169
			break;
5474
 
6170
 
5475
    case 123 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); }  //$NON-NLS-1$
6171
    case 139 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); }  //$NON-NLS-1$
5476
		    consumeAnnotationAsModifier();  
6172
		    consumeAnnotationAsModifier();  
5477
			break;
6173
			break;
5478
 
6174
 
5479
    case 124 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); }  //$NON-NLS-1$
6175
    case 140 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); }  //$NON-NLS-1$
5480
		    consumeClassDeclaration();  
6176
		    consumeClassDeclaration();  
5481
			break;
6177
			break;
5482
 
6178
 
5483
    case 125 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); }  //$NON-NLS-1$
6179
    case 141 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); }  //$NON-NLS-1$
5484
		    consumeClassHeader();  
6180
		    consumeClassHeader();  
5485
			break;
6181
			break;
5486
 
6182
 
5487
    case 126 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); }  //$NON-NLS-1$
6183
    case 142 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); }  //$NON-NLS-1$
5488
		    consumeTypeHeaderNameWithTypeParameters();  
6184
		    consumeTypeHeaderNameWithTypeParameters();  
5489
			break;
6185
			break;
5490
 
6186
 
5491
    case 128 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); }  //$NON-NLS-1$
6187
    case 144 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); }  //$NON-NLS-1$
5492
		    consumeClassHeaderName1();  
6188
		    consumeClassHeaderName1();  
5493
			break;
6189
			break;
5494
 
6190
 
5495
    case 129 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); }  //$NON-NLS-1$
6191
    case 145 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); }  //$NON-NLS-1$
5496
		    consumeClassHeaderExtends();  
6192
		    consumeClassHeaderExtends();  
5497
			break;
6193
			break;
5498
 
6194
 
5499
    case 130 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); }  //$NON-NLS-1$
6195
    case 146 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); }  //$NON-NLS-1$
5500
		    consumeClassHeaderImplements();  
6196
		    consumeClassHeaderImplements();  
5501
			break;
6197
			break;
5502
 
6198
 
5503
    case 132 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); }  //$NON-NLS-1$
6199
    case 148 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); }  //$NON-NLS-1$
5504
		    consumeInterfaceTypeList();  
6200
		    consumeInterfaceTypeList();  
5505
			break;
6201
			break;
5506
 
6202
 
5507
    case 133 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); }  //$NON-NLS-1$
6203
    case 149 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); }  //$NON-NLS-1$
5508
		    consumeInterfaceType();  
6204
		    consumeInterfaceType();  
5509
			break;
6205
			break;
5510
 
6206
 
5511
    case 136 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); }  //$NON-NLS-1$
6207
    case 152 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); }  //$NON-NLS-1$
5512
		    consumeClassBodyDeclarations();  
6208
		    consumeClassBodyDeclarations();  
5513
			break;
6209
			break;
5514
 
6210
 
5515
    case 140 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); }  //$NON-NLS-1$
6211
    case 156 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); }  //$NON-NLS-1$
5516
		    consumeClassBodyDeclaration();  
6212
		    consumeClassBodyDeclaration();  
5517
			break;
6213
			break;
5518
 
6214
 
5519
    case 141 : if (DEBUG) { System.out.println("Diet ::="); }  //$NON-NLS-1$
6215
    case 157 : if (DEBUG) { System.out.println("Diet ::="); }  //$NON-NLS-1$
5520
		    consumeDiet();  
6216
		    consumeDiet();  
5521
			break;
6217
			break;
5522
6218
5523
    case 142 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); }  //$NON-NLS-1$
6219
    case 158 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); }  //$NON-NLS-1$
5524
		    consumeClassBodyDeclaration();  
6220
		    consumeClassBodyDeclaration();  
5525
			break;
6221
			break;
5526
 
6222
 
5527
    case 143 : if (DEBUG) { System.out.println("CreateInitializer ::="); }  //$NON-NLS-1$
6223
    case 159 : if (DEBUG) { System.out.println("CreateInitializer ::="); }  //$NON-NLS-1$
5528
		    consumeCreateInitializer();  
6224
		    consumeCreateInitializer();  
5529
			break;
6225
			break;
5530
6226
5531
    case 150 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
6227
    case 166 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
5532
		    consumeEmptyTypeDeclaration();  
6228
		    consumeEmptyTypeDeclaration();  
5533
			break;
6229
			break;
5534
6230
5535
    case 153 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); }  //$NON-NLS-1$
6231
    case 169 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type0..."); }  //$NON-NLS-1$
5536
		    consumeFieldDeclaration();  
6232
		    consumeFieldDeclaration();  
5537
			break;
6233
			break;
5538
 
6234
 
5539
    case 155 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); }  //$NON-NLS-1$
6235
    case 171 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); }  //$NON-NLS-1$
5540
		    consumeVariableDeclarators();  
6236
		    consumeVariableDeclarators();  
5541
			break;
6237
			break;
5542
 
6238
 
5543
    case 158 : if (DEBUG) { System.out.println("EnterVariable ::="); }  //$NON-NLS-1$
6239
    case 174 : if (DEBUG) { System.out.println("EnterVariable ::="); }  //$NON-NLS-1$
5544
		    consumeEnterVariable();  
6240
		    consumeEnterVariable();  
5545
			break;
6241
			break;
5546
 
6242
 
5547
    case 159 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); }  //$NON-NLS-1$
6243
    case 175 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); }  //$NON-NLS-1$
5548
		    consumeExitVariableWithInitialization();  
6244
		    consumeExitVariableWithInitialization();  
5549
			break;
6245
			break;
5550
 
6246
 
5551
    case 160 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); }  //$NON-NLS-1$
6247
    case 176 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); }  //$NON-NLS-1$
5552
		    consumeExitVariableWithoutInitialization();  
6248
		    consumeExitVariableWithoutInitialization();  
5553
			break;
6249
			break;
5554
 
6250
 
5555
    case 161 : if (DEBUG) { System.out.println("ForceNoDiet ::="); }  //$NON-NLS-1$
6251
    case 177 : if (DEBUG) { System.out.println("ForceNoDiet ::="); }  //$NON-NLS-1$
5556
		    consumeForceNoDiet();  
6252
		    consumeForceNoDiet();  
5557
			break;
6253
			break;
5558
 
6254
 
5559
    case 162 : if (DEBUG) { System.out.println("RestoreDiet ::="); }  //$NON-NLS-1$
6255
    case 178 : if (DEBUG) { System.out.println("RestoreDiet ::="); }  //$NON-NLS-1$
5560
		    consumeRestoreDiet();  
6256
		    consumeRestoreDiet();  
5561
			break;
6257
			break;
5562
 
6258
 
5563
    case 167 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
6259
    case 183 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
5564
		    // set to true to consume a method with a body
6260
		    // set to true to consume a method with a body
5565
 consumeMethodDeclaration(true);  
6261
 consumeMethodDeclaration(true);  
5566
			break;
6262
			break;
5567
 
6263
 
5568
    case 168 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); }  //$NON-NLS-1$
6264
    case 184 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); }  //$NON-NLS-1$
5569
		    // set to false to consume a method without body
6265
		    // set to false to consume a method without body
5570
 consumeMethodDeclaration(false);  
6266
 consumeMethodDeclaration(false);  
5571
			break;
6267
			break;
5572
 
6268
 
5573
    case 169 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); }  //$NON-NLS-1$
6269
    case 185 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); }  //$NON-NLS-1$
5574
		    consumeMethodHeader();  
6270
		    consumeMethodHeader();  
5575
			break;
6271
			break;
5576
 
6272
 
5577
    case 170 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); }  //$NON-NLS-1$
6273
    case 186 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); }  //$NON-NLS-1$
5578
		    consumeMethodHeaderNameWithTypeParameters(false);  
6274
		    consumeMethodHeaderNameWithTypeParameters(false);  
5579
			break;
6275
			break;
5580
 
6276
 
5581
    case 171 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); }  //$NON-NLS-1$
6277
    case 187 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type0 Identifier..."); }  //$NON-NLS-1$
5582
		    consumeMethodHeaderName(false);  
6278
		    consumeMethodHeaderName(false);  
5583
			break;
6279
			break;
5584
 
6280
 
5585
    case 172 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); }  //$NON-NLS-1$
6281
    case 188 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); }  //$NON-NLS-1$
5586
		    consumeMethodHeaderRightParen();  
6282
		    consumeMethodHeaderRightParen();  
5587
			break;
6283
			break;
5588
 
6284
 
5589
    case 173 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); }  //$NON-NLS-1$
6285
    case 189 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= DimsoptAnnotsopt"); }  //$NON-NLS-1$
5590
		    consumeMethodHeaderExtendedDims();  
6286
		    consumeMethodHeaderExtendedDims();  
5591
			break;
6287
			break;
5592
 
6288
 
5593
    case 174 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); }  //$NON-NLS-1$
6289
    case 190 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); }  //$NON-NLS-1$
5594
		    consumeMethodHeaderThrowsClause();  
6290
		    consumeMethodHeaderThrowsClause();  
5595
			break;
6291
			break;
5596
 
6292
 
5597
    case 175 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); }  //$NON-NLS-1$
6293
    case 191 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); }  //$NON-NLS-1$
5598
		    consumeConstructorHeader();  
6294
		    consumeConstructorHeader();  
5599
			break;
6295
			break;
5600
 
6296
 
5601
    case 176 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); }  //$NON-NLS-1$
6297
    case 192 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); }  //$NON-NLS-1$
5602
		    consumeConstructorHeaderNameWithTypeParameters();  
6298
		    consumeConstructorHeaderNameWithTypeParameters();  
5603
			break;
6299
			break;
5604
 
6300
 
5605
    case 177 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); }  //$NON-NLS-1$
6301
    case 193 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); }  //$NON-NLS-1$
5606
		    consumeConstructorHeaderName();  
6302
		    consumeConstructorHeaderName();  
5607
			break;
6303
			break;
5608
 
6304
 
5609
    case 179 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); }  //$NON-NLS-1$
6305
    case 195 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); }  //$NON-NLS-1$
5610
		    consumeFormalParameterList();  
6306
		    consumeFormalParameterList();  
5611
			break;
6307
			break;
5612
 
6308
 
5613
    case 180 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); }  //$NON-NLS-1$
6309
    case 196 : if (DEBUG) { System.out.println("PotentialNameArray ::="); }  //$NON-NLS-1$
6310
		    consumePotentialNameArrayType();  
6311
			break;
6312
 
6313
    case 197 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); }  //$NON-NLS-1$
5614
		    consumeFormalParameter(false);  
6314
		    consumeFormalParameter(false);  
5615
			break;
6315
			break;
5616
 
6316
 
5617
    case 181 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type ELLIPSIS..."); }  //$NON-NLS-1$
6317
    case 198 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); }  //$NON-NLS-1$
5618
		    consumeFormalParameter(true);  
6318
		    consumeFormalParameter(true);  
5619
			break;
6319
			break;
5620
 
6320
 
5621
    case 182 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); }  //$NON-NLS-1$
6321
    case 199 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); }  //$NON-NLS-1$
6322
		    consumeFormalParameter(false);  
6323
			break;
6324
 
6325
    case 200 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); }  //$NON-NLS-1$
6326
		    consumeFormalParameter(true);  
6327
			break;
6328
 
6329
    case 201 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); }  //$NON-NLS-1$
6330
		    consumeFormalParameter(false);  
6331
			break;
6332
 
6333
    case 202 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); }  //$NON-NLS-1$
6334
		    consumeFormalParameter(true);  
6335
			break;
6336
 
6337
    case 203 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); }  //$NON-NLS-1$
6338
		    consumeFormalParameter(false);  
6339
			break;
6340
 
6341
    case 204 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); }  //$NON-NLS-1$
6342
		    consumeFormalParameter(true);  
6343
			break;
6344
 
6345
    case 205 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); }  //$NON-NLS-1$
5622
		    consumeCatchFormalParameter();  
6346
		    consumeCatchFormalParameter();  
5623
			break;
6347
			break;
5624
 
6348
 
5625
    case 183 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); }  //$NON-NLS-1$
6349
    case 206 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); }  //$NON-NLS-1$
5626
		    consumeCatchType();  
6350
		    consumeCatchType();  
5627
			break;
6351
			break;
5628
 
6352
 
5629
    case 184 : if (DEBUG) { System.out.println("UnionType ::= Type"); }  //$NON-NLS-1$
6353
    case 207 : if (DEBUG) { System.out.println("UnionType ::= TypeInternal"); }  //$NON-NLS-1$
5630
		    consumeUnionTypeAsClassType();  
6354
		    consumeUnionTypeAsClassType();  
5631
			break;
6355
			break;
5632
 
6356
 
5633
    case 185 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); }  //$NON-NLS-1$
6357
    case 208 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); }  //$NON-NLS-1$
5634
		    consumeUnionType();  
6358
		    consumeUnionType();  
5635
			break;
6359
			break;
5636
 
6360
 
5637
    case 187 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); }  //$NON-NLS-1$
6361
    case 210 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); }  //$NON-NLS-1$
5638
		    consumeClassTypeList();  
6362
		    consumeClassTypeList();  
5639
			break;
6363
			break;
5640
 
6364
 
5641
    case 188 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); }  //$NON-NLS-1$
6365
    case 211 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); }  //$NON-NLS-1$
5642
		    consumeClassTypeElt();  
6366
		    consumeClassTypeElt();  
5643
			break;
6367
			break;
5644
 
6368
 
5645
    case 189 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); }  //$NON-NLS-1$
6369
    case 212 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); }  //$NON-NLS-1$
5646
		    consumeMethodBody();  
6370
		    consumeMethodBody();  
5647
			break;
6371
			break;
5648
 
6372
 
5649
    case 190 : if (DEBUG) { System.out.println("NestedMethod ::="); }  //$NON-NLS-1$
6373
    case 213 : if (DEBUG) { System.out.println("NestedMethod ::="); }  //$NON-NLS-1$
5650
		    consumeNestedMethod();  
6374
		    consumeNestedMethod();  
5651
			break;
6375
			break;
5652
 
6376
 
5653
    case 191 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); }  //$NON-NLS-1$
6377
    case 214 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); }  //$NON-NLS-1$
5654
		    consumeStaticInitializer();  
6378
		    consumeStaticInitializer();  
5655
			break;
6379
			break;
5656
6380
5657
    case 192 : if (DEBUG) { System.out.println("StaticOnly ::= static"); }  //$NON-NLS-1$
6381
    case 215 : if (DEBUG) { System.out.println("StaticOnly ::= static"); }  //$NON-NLS-1$
5658
		    consumeStaticOnly();  
6382
		    consumeStaticOnly();  
5659
			break;
6383
			break;
5660
 
6384
 
5661
    case 193 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); }  //$NON-NLS-1$
6385
    case 216 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); }  //$NON-NLS-1$
5662
		    consumeConstructorDeclaration() ;  
6386
		    consumeConstructorDeclaration() ;  
5663
			break;
6387
			break;
5664
 
6388
 
5665
    case 194 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); }  //$NON-NLS-1$
6389
    case 217 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); }  //$NON-NLS-1$
5666
		    consumeInvalidConstructorDeclaration() ;  
6390
		    consumeInvalidConstructorDeclaration() ;  
5667
			break;
6391
			break;
5668
 
6392
 
5669
    case 195 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); }  //$NON-NLS-1$
6393
    case 218 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); }  //$NON-NLS-1$
5670
		    consumeExplicitConstructorInvocation(0, THIS_CALL);  
6394
		    consumeExplicitConstructorInvocation(0, THIS_CALL);  
5671
			break;
6395
			break;
5672
 
6396
 
5673
    case 196 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); }  //$NON-NLS-1$
6397
    case 219 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); }  //$NON-NLS-1$
5674
		    consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL);  
6398
		    consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL);  
5675
			break;
6399
			break;
5676
 
6400
 
5677
    case 197 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); }  //$NON-NLS-1$
6401
    case 220 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); }  //$NON-NLS-1$
5678
		    consumeExplicitConstructorInvocation(0,SUPER_CALL);  
6402
		    consumeExplicitConstructorInvocation(0,SUPER_CALL);  
5679
			break;
6403
			break;
5680
 
6404
 
5681
    case 198 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); }  //$NON-NLS-1$
6405
    case 221 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); }  //$NON-NLS-1$
5682
		    consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL);  
6406
		    consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL);  
5683
			break;
6407
			break;
5684
 
6408
 
5685
    case 199 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); }  //$NON-NLS-1$
6409
    case 222 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); }  //$NON-NLS-1$
5686
		    consumeExplicitConstructorInvocation(1, SUPER_CALL);  
6410
		    consumeExplicitConstructorInvocation(1, SUPER_CALL);  
5687
			break;
6411
			break;
5688
 
6412
 
5689
    case 200 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
6413
    case 223 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
5690
		    consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL);  
6414
		    consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL);  
5691
			break;
6415
			break;
5692
 
6416
 
5693
    case 201 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); }  //$NON-NLS-1$
6417
    case 224 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); }  //$NON-NLS-1$
5694
		    consumeExplicitConstructorInvocation(2, SUPER_CALL);  
6418
		    consumeExplicitConstructorInvocation(2, SUPER_CALL);  
5695
			break;
6419
			break;
5696
 
6420
 
5697
    case 202 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
6421
    case 225 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
5698
		    consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL);  
6422
		    consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL);  
5699
			break;
6423
			break;
5700
 
6424
 
5701
    case 203 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); }  //$NON-NLS-1$
6425
    case 226 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); }  //$NON-NLS-1$
5702
		    consumeExplicitConstructorInvocation(1, THIS_CALL);  
6426
		    consumeExplicitConstructorInvocation(1, THIS_CALL);  
5703
			break;
6427
			break;
5704
 
6428
 
5705
    case 204 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
6429
    case 227 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
5706
		    consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL);  
6430
		    consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL);  
5707
			break;
6431
			break;
5708
 
6432
 
5709
    case 205 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); }  //$NON-NLS-1$
6433
    case 228 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); }  //$NON-NLS-1$
5710
		    consumeExplicitConstructorInvocation(2, THIS_CALL);  
6434
		    consumeExplicitConstructorInvocation(2, THIS_CALL);  
5711
			break;
6435
			break;
5712
 
6436
 
5713
    case 206 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
6437
    case 229 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
5714
		    consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL);  
6438
		    consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL);  
5715
			break;
6439
			break;
5716
 
6440
 
5717
    case 207 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); }  //$NON-NLS-1$
6441
    case 230 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); }  //$NON-NLS-1$
5718
		    consumeInterfaceDeclaration();  
6442
		    consumeInterfaceDeclaration();  
5719
			break;
6443
			break;
5720
 
6444
 
5721
    case 208 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); }  //$NON-NLS-1$
6445
    case 231 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); }  //$NON-NLS-1$
5722
		    consumeInterfaceHeader();  
6446
		    consumeInterfaceHeader();  
5723
			break;
6447
			break;
5724
 
6448
 
5725
    case 209 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); }  //$NON-NLS-1$
6449
    case 232 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); }  //$NON-NLS-1$
5726
		    consumeTypeHeaderNameWithTypeParameters();  
6450
		    consumeTypeHeaderNameWithTypeParameters();  
5727
			break;
6451
			break;
5728
 
6452
 
5729
    case 211 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); }  //$NON-NLS-1$
6453
    case 234 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); }  //$NON-NLS-1$
5730
		    consumeInterfaceHeaderName1();  
6454
		    consumeInterfaceHeaderName1();  
5731
			break;
6455
			break;
5732
 
6456
 
5733
    case 212 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); }  //$NON-NLS-1$
6457
    case 235 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); }  //$NON-NLS-1$
5734
		    consumeInterfaceHeaderExtends();  
6458
		    consumeInterfaceHeaderExtends();  
5735
			break;
6459
			break;
5736
 
6460
 
5737
    case 215 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); }  //$NON-NLS-1$
6461
    case 238 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); }  //$NON-NLS-1$
5738
		    consumeInterfaceMemberDeclarations();  
6462
		    consumeInterfaceMemberDeclarations();  
5739
			break;
6463
			break;
5740
 
6464
 
5741
    case 216 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
6465
    case 239 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
5742
		    consumeEmptyTypeDeclaration();  
6466
		    consumeEmptyTypeDeclaration();  
5743
			break;
6467
			break;
5744
 
6468
 
5745
    case 217 : if (DEBUG) { System.out.println("PushDefault ::="); }  //$NON-NLS-1$
6469
    case 240 : if (DEBUG) { System.out.println("PushDefault ::="); }  //$NON-NLS-1$
5746
		    consumeInterfaceMethodDefault();  
6470
		    consumeInterfaceMethodDefault();  
5747
			break;
6471
			break;
5748
 
6472
 
5749
    case 219 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader default..."); }  //$NON-NLS-1$
6473
    case 242 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader default..."); }  //$NON-NLS-1$
5750
		    consumeInterfaceMethodDeclaration(true);  
6474
		    consumeInterfaceMethodDeclaration(true);  
5751
			break;
6475
			break;
5752
 
6476
 
5753
    case 220 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
6477
    case 243 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
5754
		    consumeInterfaceMethodDeclaration(false);  
6478
		    consumeInterfaceMethodDeclaration(false);  
5755
			break;
6479
			break;
5756
 
6480
 
5757
    case 221 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
6481
    case 244 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
5758
		    consumeInvalidConstructorDeclaration(true);  
6482
		    consumeInvalidConstructorDeclaration(true);  
5759
			break;
6483
			break;
5760
 
6484
 
5761
    case 222 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
6485
    case 245 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
5762
		    consumeInvalidConstructorDeclaration(false);  
6486
		    consumeInvalidConstructorDeclaration(false);  
5763
			break;
6487
			break;
5764
 
6488
 
5765
    case 233 : if (DEBUG) { System.out.println("PushLeftBrace ::="); }  //$NON-NLS-1$
6489
    case 256 : if (DEBUG) { System.out.println("PushLeftBrace ::="); }  //$NON-NLS-1$
5766
		    consumePushLeftBrace();  
6490
		    consumePushLeftBrace();  
5767
			break;
6491
			break;
5768
 
6492
 
5769
    case 234 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); }  //$NON-NLS-1$
6493
    case 257 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); }  //$NON-NLS-1$
5770
		    consumeEmptyArrayInitializer();  
6494
		    consumeEmptyArrayInitializer();  
5771
			break;
6495
			break;
5772
 
6496
 
5773
    case 235 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
6497
    case 258 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
5774
		    consumeArrayInitializer();  
6498
		    consumeArrayInitializer();  
5775
			break;
6499
			break;
5776
 
6500
 
5777
    case 236 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
6501
    case 259 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
5778
		    consumeArrayInitializer();  
6502
		    consumeArrayInitializer();  
5779
			break;
6503
			break;
5780
 
6504
 
5781
    case 238 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); }  //$NON-NLS-1$
6505
    case 261 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); }  //$NON-NLS-1$
5782
		    consumeVariableInitializers();  
6506
		    consumeVariableInitializers();  
5783
			break;
6507
			break;
5784
 
6508
 
5785
    case 239 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); }  //$NON-NLS-1$
6509
    case 262 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); }  //$NON-NLS-1$
5786
		    consumeBlock();  
6510
		    consumeBlock();  
5787
			break;
6511
			break;
5788
 
6512
 
5789
    case 240 : if (DEBUG) { System.out.println("OpenBlock ::="); }  //$NON-NLS-1$
6513
    case 263 : if (DEBUG) { System.out.println("OpenBlock ::="); }  //$NON-NLS-1$
5790
		    consumeOpenBlock() ;  
6514
		    consumeOpenBlock() ;  
5791
			break;
6515
			break;
5792
 
6516
 
5793
    case 242 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); }  //$NON-NLS-1$
6517
    case 265 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); }  //$NON-NLS-1$
5794
		    consumeBlockStatements() ;  
6518
		    consumeBlockStatements() ;  
5795
			break;
6519
			break;
5796
 
6520
 
5797
    case 246 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); }  //$NON-NLS-1$
6521
    case 269 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); }  //$NON-NLS-1$
5798
		    consumeInvalidInterfaceDeclaration();  
6522
		    consumeInvalidInterfaceDeclaration();  
5799
			break;
6523
			break;
5800
 
6524
 
5801
    case 247 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); }  //$NON-NLS-1$
6525
    case 270 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); }  //$NON-NLS-1$
5802
		    consumeInvalidAnnotationTypeDeclaration();  
6526
		    consumeInvalidAnnotationTypeDeclaration();  
5803
			break;
6527
			break;
5804
 
6528
 
5805
    case 248 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); }  //$NON-NLS-1$
6529
    case 271 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); }  //$NON-NLS-1$
5806
		    consumeInvalidEnumDeclaration();  
6530
		    consumeInvalidEnumDeclaration();  
5807
			break;
6531
			break;
5808
 
6532
 
5809
    case 249 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); }  //$NON-NLS-1$
6533
    case 272 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); }  //$NON-NLS-1$
5810
		    consumeLocalVariableDeclarationStatement();  
6534
		    consumeLocalVariableDeclarationStatement();  
5811
			break;
6535
			break;
5812
 
6536
 
5813
    case 250 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); }  //$NON-NLS-1$
6537
    case 273 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type0 PushModifiers..."); }  //$NON-NLS-1$
5814
		    consumeLocalVariableDeclaration();  
6538
		    consumeLocalVariableDeclaration();  
5815
			break;
6539
			break;
5816
 
6540
 
5817
    case 251 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); }  //$NON-NLS-1$
6541
    case 274 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type0..."); }  //$NON-NLS-1$
5818
		    consumeLocalVariableDeclaration();  
6542
		    consumeLocalVariableDeclaration();  
5819
			break;
6543
			break;
5820
 
6544
 
5821
    case 252 : if (DEBUG) { System.out.println("PushModifiers ::="); }  //$NON-NLS-1$
6545
    case 275 : if (DEBUG) { System.out.println("PushModifiers ::="); }  //$NON-NLS-1$
5822
		    consumePushModifiers();  
6546
		    consumePushModifiers();  
5823
			break;
6547
			break;
5824
 
6548
 
5825
    case 253 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); }  //$NON-NLS-1$
6549
    case 276 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); }  //$NON-NLS-1$
5826
		    consumePushModifiersForHeader();  
6550
		    consumePushModifiersForHeader();  
5827
			break;
6551
			break;
5828
 
6552
 
5829
    case 254 : if (DEBUG) { System.out.println("PushRealModifiers ::="); }  //$NON-NLS-1$
6553
    case 277 : if (DEBUG) { System.out.println("PushRealModifiers ::="); }  //$NON-NLS-1$
5830
		    consumePushRealModifiers();  
6554
		    consumePushRealModifiers();  
5831
			break;
6555
			break;
5832
 
6556
 
5833
    case 281 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); }  //$NON-NLS-1$
6557
    case 304 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); }  //$NON-NLS-1$
5834
		    consumeEmptyStatement();  
6558
		    consumeEmptyStatement();  
5835
			break;
6559
			break;
5836
 
6560
 
5837
    case 282 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); }  //$NON-NLS-1$
6561
    case 305 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); }  //$NON-NLS-1$
5838
		    consumeStatementLabel() ;  
6562
		    consumeStatementLabel() ;  
5839
			break;
6563
			break;
5840
 
6564
 
5841
    case 283 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); }  //$NON-NLS-1$
6565
    case 306 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); }  //$NON-NLS-1$
5842
		    consumeStatementLabel() ;  
6566
		    consumeStatementLabel() ;  
5843
			break;
6567
			break;
5844
 
6568
 
5845
    case 284 : if (DEBUG) { System.out.println("Label ::= Identifier"); }  //$NON-NLS-1$
6569
    case 307 : if (DEBUG) { System.out.println("Label ::= Identifier"); }  //$NON-NLS-1$
5846
		    consumeLabel() ;  
6570
		    consumeLabel();  
5847
			break;
6571
			break;
5848
 
6572
 
5849
     case 285 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); }  //$NON-NLS-1$
6573
     case 308 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); }  //$NON-NLS-1$
5850
		    consumeExpressionStatement();  
6574
		    consumeExpressionStatement();  
5851
			break;
6575
			break;
5852
 
6576
 
5853
    case 294 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6577
    case 317 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5854
		    consumeStatementIfNoElse();  
6578
		    consumeStatementIfNoElse();  
5855
			break;
6579
			break;
5856
 
6580
 
5857
    case 295 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6581
    case 318 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5858
		    consumeStatementIfWithElse();  
6582
		    consumeStatementIfWithElse();  
5859
			break;
6583
			break;
5860
 
6584
 
5861
    case 296 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); }  //$NON-NLS-1$
6585
    case 319 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); }  //$NON-NLS-1$
5862
		    consumeStatementIfWithElse();  
6586
		    consumeStatementIfWithElse();  
5863
			break;
6587
			break;
5864
 
6588
 
5865
    case 297 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6589
    case 320 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5866
		    consumeStatementSwitch() ;  
6590
		    consumeStatementSwitch() ;  
5867
			break;
6591
			break;
5868
 
6592
 
5869
    case 298 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); }  //$NON-NLS-1$
6593
    case 321 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); }  //$NON-NLS-1$
5870
		    consumeEmptySwitchBlock() ;  
6594
		    consumeEmptySwitchBlock() ;  
5871
			break;
6595
			break;
5872
 
6596
 
5873
    case 301 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); }  //$NON-NLS-1$
6597
    case 324 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); }  //$NON-NLS-1$
5874
		    consumeSwitchBlock() ;  
6598
		    consumeSwitchBlock() ;  
5875
			break;
6599
			break;
5876
 
6600
 
5877
    case 303 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); }  //$NON-NLS-1$
6601
    case 326 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); }  //$NON-NLS-1$
5878
		    consumeSwitchBlockStatements() ;  
6602
		    consumeSwitchBlockStatements() ;  
5879
			break;
6603
			break;
5880
 
6604
 
5881
    case 304 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); }  //$NON-NLS-1$
6605
    case 327 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); }  //$NON-NLS-1$
5882
		    consumeSwitchBlockStatement() ;  
6606
		    consumeSwitchBlockStatement() ;  
5883
			break;
6607
			break;
5884
 
6608
 
5885
    case 306 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); }  //$NON-NLS-1$
6609
    case 329 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); }  //$NON-NLS-1$
5886
		    consumeSwitchLabels() ;  
6610
		    consumeSwitchLabels() ;  
5887
			break;
6611
			break;
5888
 
6612
 
5889
     case 307 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); }  //$NON-NLS-1$
6613
     case 330 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); }  //$NON-NLS-1$
5890
		    consumeCaseLabel();  
6614
		    consumeCaseLabel();  
5891
			break;
6615
			break;
5892
 
6616
 
5893
     case 308 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); }  //$NON-NLS-1$
6617
     case 331 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); }  //$NON-NLS-1$
5894
		    consumeDefaultLabel();  
6618
		    consumeDefaultLabel();  
5895
			break;
6619
			break;
5896
 
6620
 
5897
    case 309 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6621
    case 332 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5898
		    consumeStatementWhile() ;  
6622
		    consumeStatementWhile() ;  
5899
			break;
6623
			break;
5900
 
6624
 
5901
    case 310 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); }  //$NON-NLS-1$
6625
    case 333 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); }  //$NON-NLS-1$
5902
		    consumeStatementWhile() ;  
6626
		    consumeStatementWhile() ;  
5903
			break;
6627
			break;
5904
 
6628
 
5905
    case 311 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); }  //$NON-NLS-1$
6629
    case 334 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); }  //$NON-NLS-1$
5906
		    consumeStatementDo() ;  
6630
		    consumeStatementDo() ;  
5907
			break;
6631
			break;
5908
 
6632
 
5909
    case 312 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); }  //$NON-NLS-1$
6633
    case 335 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); }  //$NON-NLS-1$
5910
		    consumeStatementFor() ;  
6634
		    consumeStatementFor() ;  
5911
			break;
6635
			break;
5912
 
6636
 
5913
    case 313 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); }  //$NON-NLS-1$
6637
    case 336 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); }  //$NON-NLS-1$
5914
		    consumeStatementFor() ;  
6638
		    consumeStatementFor() ;  
5915
			break;
6639
			break;
5916
 
6640
 
5917
    case 314 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); }  //$NON-NLS-1$
6641
    case 337 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); }  //$NON-NLS-1$
5918
		    consumeForInit() ;  
6642
		    consumeForInit() ;  
5919
			break;
6643
			break;
5920
 
6644
 
5921
    case 318 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); }  //$NON-NLS-1$
6645
    case 341 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); }  //$NON-NLS-1$
5922
		    consumeStatementExpressionList() ;  
6646
		    consumeStatementExpressionList() ;  
5923
			break;
6647
			break;
5924
 
6648
 
5925
    case 319 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); }  //$NON-NLS-1$
6649
    case 342 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); }  //$NON-NLS-1$
5926
		    consumeSimpleAssertStatement() ;  
6650
		    consumeSimpleAssertStatement() ;  
5927
			break;
6651
			break;
5928
 
6652
 
5929
    case 320 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); }  //$NON-NLS-1$
6653
    case 343 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); }  //$NON-NLS-1$
5930
		    consumeAssertStatement() ;  
6654
		    consumeAssertStatement() ;  
5931
			break;
6655
			break;
5932
 
6656
 
5933
    case 321 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); }  //$NON-NLS-1$
6657
    case 344 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); }  //$NON-NLS-1$
5934
		    consumeStatementBreak() ;  
6658
		    consumeStatementBreak() ;  
5935
			break;
6659
			break;
5936
 
6660
 
5937
    case 322 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); }  //$NON-NLS-1$
6661
    case 345 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); }  //$NON-NLS-1$
5938
		    consumeStatementBreakWithLabel() ;  
6662
		    consumeStatementBreakWithLabel() ;  
5939
			break;
6663
			break;
5940
 
6664
 
5941
    case 323 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); }  //$NON-NLS-1$
6665
    case 346 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); }  //$NON-NLS-1$
5942
		    consumeStatementContinue() ;  
6666
		    consumeStatementContinue() ;  
5943
			break;
6667
			break;
5944
 
6668
 
5945
    case 324 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); }  //$NON-NLS-1$
6669
    case 347 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); }  //$NON-NLS-1$
5946
		    consumeStatementContinueWithLabel() ;  
6670
		    consumeStatementContinueWithLabel() ;  
5947
			break;
6671
			break;
5948
 
6672
 
5949
    case 325 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); }  //$NON-NLS-1$
6673
    case 348 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); }  //$NON-NLS-1$
5950
		    consumeStatementReturn() ;  
6674
		    consumeStatementReturn() ;  
5951
			break;
6675
			break;
5952
 
6676
 
5953
    case 326 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); }  //$NON-NLS-1$
6677
    case 349 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); }  //$NON-NLS-1$
5954
		    consumeStatementThrow();  
6678
		    consumeStatementThrow();  
5955
			break;
6679
			break;
5956
 
6680
 
5957
    case 327 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); }  //$NON-NLS-1$
6681
    case 350 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); }  //$NON-NLS-1$
5958
		    consumeStatementSynchronized();  
6682
		    consumeStatementSynchronized();  
5959
			break;
6683
			break;
5960
 
6684
 
5961
    case 328 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); }  //$NON-NLS-1$
6685
    case 351 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); }  //$NON-NLS-1$
5962
		    consumeOnlySynchronized();  
6686
		    consumeOnlySynchronized();  
5963
			break;
6687
			break;
5964
 
6688
 
5965
    case 329 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); }  //$NON-NLS-1$
6689
    case 352 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); }  //$NON-NLS-1$
5966
		    consumeStatementTry(false, false);  
6690
		    consumeStatementTry(false, false);  
5967
			break;
6691
			break;
5968
 
6692
 
5969
    case 330 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); }  //$NON-NLS-1$
6693
    case 353 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); }  //$NON-NLS-1$
5970
		    consumeStatementTry(true, false);  
6694
		    consumeStatementTry(true, false);  
5971
			break;
6695
			break;
5972
 
6696
 
5973
    case 331 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); }  //$NON-NLS-1$
6697
    case 354 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); }  //$NON-NLS-1$
5974
		    consumeStatementTry(false, true);  
6698
		    consumeStatementTry(false, true);  
5975
			break;
6699
			break;
5976
 
6700
 
5977
    case 332 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); }  //$NON-NLS-1$
6701
    case 355 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); }  //$NON-NLS-1$
5978
		    consumeStatementTry(true, true);  
6702
		    consumeStatementTry(true, true);  
5979
			break;
6703
			break;
5980
 
6704
 
5981
    case 333 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); }  //$NON-NLS-1$
6705
    case 356 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); }  //$NON-NLS-1$
5982
		    consumeResourceSpecification();  
6706
		    consumeResourceSpecification();  
5983
			break;
6707
			break;
5984
 
6708
 
5985
    case 334 : if (DEBUG) { System.out.println(";opt ::="); }  //$NON-NLS-1$
6709
    case 357 : if (DEBUG) { System.out.println(";opt ::="); }  //$NON-NLS-1$
5986
		    consumeResourceOptionalTrailingSemiColon(false);  
6710
		    consumeResourceOptionalTrailingSemiColon(false);  
5987
			break;
6711
			break;
5988
 
6712
 
5989
    case 335 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); }  //$NON-NLS-1$
6713
    case 358 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); }  //$NON-NLS-1$
5990
		    consumeResourceOptionalTrailingSemiColon(true);  
6714
		    consumeResourceOptionalTrailingSemiColon(true);  
5991
			break;
6715
			break;
5992
 
6716
 
5993
    case 336 : if (DEBUG) { System.out.println("Resources ::= Resource"); }  //$NON-NLS-1$
6717
    case 359 : if (DEBUG) { System.out.println("Resources ::= Resource"); }  //$NON-NLS-1$
5994
		    consumeSingleResource();  
6718
		    consumeSingleResource();  
5995
			break;
6719
			break;
5996
 
6720
 
5997
    case 337 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); }  //$NON-NLS-1$
6721
    case 360 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); }  //$NON-NLS-1$
5998
		    consumeMultipleResources();  
6722
		    consumeMultipleResources();  
5999
			break;
6723
			break;
6000
 
6724
 
6001
    case 338 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); }  //$NON-NLS-1$
6725
    case 361 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); }  //$NON-NLS-1$
6002
		    consumeResourceOptionalTrailingSemiColon(true);  
6726
		    consumeResourceOptionalTrailingSemiColon(true);  
6003
			break;
6727
			break;
6004
 
6728
 
6005
    case 339 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); }  //$NON-NLS-1$
6729
    case 362 : if (DEBUG) { System.out.println("Resource ::= TypeInternal PushModifiers..."); }  //$NON-NLS-1$
6006
		    consumeResourceAsLocalVariableDeclaration();  
6730
		    consumeResourceAsLocalVariableDeclaration();  
6007
			break;
6731
			break;
6008
 
6732
 
6009
    case 340 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); }  //$NON-NLS-1$
6733
    case 363 : if (DEBUG) { System.out.println("Resource ::= Modifiers TypeInternal PushRealModifiers..."); }  //$NON-NLS-1$
6010
		    consumeResourceAsLocalVariableDeclaration();  
6734
		    consumeResourceAsLocalVariableDeclaration();  
6011
			break;
6735
			break;
6012
 
6736
 
6013
    case 342 : if (DEBUG) { System.out.println("ExitTryBlock ::="); }  //$NON-NLS-1$
6737
    case 365 : if (DEBUG) { System.out.println("ExitTryBlock ::="); }  //$NON-NLS-1$
6014
		    consumeExitTryBlock();  
6738
		    consumeExitTryBlock();  
6015
			break;
6739
			break;
6016
 
6740
 
6017
    case 344 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); }  //$NON-NLS-1$
6741
    case 367 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); }  //$NON-NLS-1$
6018
		    consumeCatches();  
6742
		    consumeCatches();  
6019
			break;
6743
			break;
6020
 
6744
 
6021
    case 345 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); }  //$NON-NLS-1$
6745
    case 368 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); }  //$NON-NLS-1$
6022
		    consumeStatementCatch() ;  
6746
		    consumeStatementCatch() ;  
6023
			break;
6747
			break;
6024
 
6748
 
6025
    case 347 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); }  //$NON-NLS-1$
6749
    case 370 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); }  //$NON-NLS-1$
6026
		    consumeLeftParen();  
6750
		    consumeLeftParen();  
6027
			break;
6751
			break;
6028
 
6752
 
6029
    case 348 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); }  //$NON-NLS-1$
6753
    case 371 : if (DEBUG) { System.out.println("PushRPARENForUnannotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6754
		    consumeRightParenForUnannotatedTypeCast();  
6755
			break;
6756
 
6757
    case 372 : if (DEBUG) { System.out.println("PushRPARENForNameUnannotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6758
		    consumeRightParenForNameUnannotatedTypeCast();  
6759
			break;
6760
 
6761
    case 373 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); }  //$NON-NLS-1$
6030
		    consumeRightParen();  
6762
		    consumeRightParen();  
6031
			break;
6763
			break;
6032
 
6764
 
6033
    case 353 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); }  //$NON-NLS-1$
6765
    case 374 : if (DEBUG) { System.out.println("PushRPARENForAnnotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6766
		    consumeRightParenForAnnotatedTypeCast();  
6767
			break;
6768
 
6769
    case 375 : if (DEBUG) { System.out.println("PushRPARENForNameAndAnnotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6770
		    consumeRightParenForNameAndAnnotatedTypeCast();  
6771
			break;
6772
 
6773
    case 380 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); }  //$NON-NLS-1$
6034
		    consumePrimaryNoNewArrayThis();  
6774
		    consumePrimaryNoNewArrayThis();  
6035
			break;
6775
			break;
6036
 
6776
 
6037
    case 354 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); }  //$NON-NLS-1$
6777
    case 381 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); }  //$NON-NLS-1$
6038
		    consumePrimaryNoNewArray();  
6778
		    consumePrimaryNoNewArray();  
6039
			break;
6779
			break;
6040
 
6780
 
6041
    case 355 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); }  //$NON-NLS-1$
6781
    case 382 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); }  //$NON-NLS-1$
6042
		    consumePrimaryNoNewArrayWithName();  
6782
		    consumePrimaryNoNewArrayWithName();  
6043
			break;
6783
			break;
6044
 
6784
 
6045
    case 358 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); }  //$NON-NLS-1$
6785
    case 385 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); }  //$NON-NLS-1$
6046
		    consumePrimaryNoNewArrayNameThis();  
6786
		    consumePrimaryNoNewArrayNameThis();  
6047
			break;
6787
			break;
6048
 
6788
 
6049
    case 359 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); }  //$NON-NLS-1$
6789
    case 386 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); }  //$NON-NLS-1$
6050
		    consumePrimaryNoNewArrayNameSuper();  
6790
		    consumePrimaryNoNewArrayNameSuper();  
6051
			break;
6791
			break;
6052
 
6792
 
6053
    case 360 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); }  //$NON-NLS-1$
6793
    case 387 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name DOT class"); }  //$NON-NLS-1$
6794
		    consumePrimaryNoNewArrayNameWithTypeAnnotations();  
6795
			break;
6796
 
6797
    case 388 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name Dims DOT class"); }  //$NON-NLS-1$
6798
		    consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations();  
6799
			break;
6800
 
6801
    case 389 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType Dims DOT"); }  //$NON-NLS-1$
6802
		    consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations();  
6803
			break;
6804
 
6805
    case 390 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType DOT class"); }  //$NON-NLS-1$
6806
		    consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations();  
6807
			break;
6808
 
6809
    case 391 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); }  //$NON-NLS-1$
6054
		    consumePrimaryNoNewArrayName();  
6810
		    consumePrimaryNoNewArrayName();  
6055
			break;
6811
			break;
6056
 
6812
 
6057
    case 361 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); }  //$NON-NLS-1$
6813
    case 392 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); }  //$NON-NLS-1$
6058
		    consumePrimaryNoNewArrayArrayType();  
6814
		    consumePrimaryNoNewArrayArrayType();  
6059
			break;
6815
			break;
6060
 
6816
 
6061
    case 362 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); }  //$NON-NLS-1$
6817
    case 393 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); }  //$NON-NLS-1$
6062
		    consumePrimaryNoNewArrayPrimitiveArrayType();  
6818
		    consumePrimaryNoNewArrayPrimitiveArrayType();  
6063
			break;
6819
			break;
6064
 
6820
 
6065
    case 363 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); }  //$NON-NLS-1$
6821
    case 394 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); }  //$NON-NLS-1$
6066
		    consumePrimaryNoNewArrayPrimitiveType();  
6822
		    consumePrimaryNoNewArrayPrimitiveType();  
6067
			break;
6823
			break;
6068
 
6824
 
6069
    case 369 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name COLON_COLON..."); }  //$NON-NLS-1$
6825
    case 400 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name COLON_COLON..."); }  //$NON-NLS-1$
6070
		    consumeReferenceExpressionNameForm();  
6826
		    consumeReferenceExpressionNameForm();  
6071
			break;
6827
			break;
6072
 
6828
 
6073
    case 370 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); }  //$NON-NLS-1$
6829
    case 401 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); }  //$NON-NLS-1$
6074
		    consumeReferenceExpressionTypeForm(false);  
6830
		    consumeReferenceExpressionTypeForm(false);  
6075
			break;
6831
			break;
6076
 
6832
 
6077
    case 371 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); }  //$NON-NLS-1$
6833
    case 402 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name..."); }  //$NON-NLS-1$
6078
		    consumeReferenceExpressionTypeForm(true);  
6834
		    consumeReferenceExpressionTypeForm(true);  
6079
			break;
6835
			break;
6080
 
6836
 
6081
    case 372 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); }  //$NON-NLS-1$
6837
    case 403 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); }  //$NON-NLS-1$
6082
		    consumeReferenceExpressionPrimaryForm();  
6838
		    consumeReferenceExpressionPrimaryForm();  
6083
			break;
6839
			break;
6084
 
6840
 
6085
    case 373 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); }  //$NON-NLS-1$
6841
    case 404 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); }  //$NON-NLS-1$
6086
		    consumeReferenceExpressionSuperForm();  
6842
		    consumeReferenceExpressionSuperForm();  
6087
			break;
6843
			break;
6088
 
6844
 
6089
    case 374 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); }  //$NON-NLS-1$
6845
    case 405 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); }  //$NON-NLS-1$
6090
		    consumeEmptyTypeArguments();  
6846
		    consumeEmptyTypeArguments();  
6091
			break;
6847
			break;
6092
 
6848
 
6093
    case 376 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); }  //$NON-NLS-1$
6849
    case 407 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); }  //$NON-NLS-1$
6094
		    consumeIdentifierOrNew(false);  
6850
		    consumeIdentifierOrNew(false);  
6095
			break;
6851
			break;
6096
 
6852
 
6097
    case 377 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); }  //$NON-NLS-1$
6853
    case 408 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); }  //$NON-NLS-1$
6098
		    consumeIdentifierOrNew(true);  
6854
		    consumeIdentifierOrNew(true);  
6099
			break;
6855
			break;
6100
 
6856
 
6101
    case 378 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); }  //$NON-NLS-1$
6857
    case 409 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); }  //$NON-NLS-1$
6102
		    consumeLambdaExpression();  
6858
		    consumeLambdaExpression();  
6103
			break;
6859
			break;
6104
 
6860
 
6105
    case 379 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier"); }  //$NON-NLS-1$
6861
    case 410 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier"); }  //$NON-NLS-1$
6106
		    consumeTypeElidedLambdaParameter(false);  
6862
		    consumeTypeElidedLambdaParameter(false);  
6107
			break;
6863
			break;
6108
 
6864
 
6109
    case 383 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); }  //$NON-NLS-1$
6865
    case 414 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); }  //$NON-NLS-1$
6110
		    consumeFormalParameterList();  
6866
		    consumeFormalParameterList();  
6111
			break;
6867
			break;
6112
 
6868
 
6113
    case 384 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); }  //$NON-NLS-1$
6869
    case 415 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); }  //$NON-NLS-1$
6114
		    consumeTypeElidedLambdaParameter(true);  
6870
		    consumeTypeElidedLambdaParameter(true);  
6115
			break;
6871
			break;
6116
 
6872
 
6117
    case 386 : if (DEBUG) { System.out.println("LambdaBody ::= NestedType NestedMethod LBRACE..."); }  //$NON-NLS-1$
6873
    case 417 : if (DEBUG) { System.out.println("LambdaBody ::= NestedType NestedMethod LBRACE..."); }  //$NON-NLS-1$
6118
		    consumeBlock();  
6874
		    consumeBlock();  
6119
			break;
6875
			break;
6120
 
6876
 
6121
    case 387 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); }  //$NON-NLS-1$
6877
    case 418 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); }  //$NON-NLS-1$
6122
		    consumeElidedLeftBraceAndReturn();  
6878
		    consumeElidedLeftBraceAndReturn();  
6123
			break;
6879
			break;
6124
 
6880
 
6125
    case 388 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); }  //$NON-NLS-1$
6881
    case 419 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); }  //$NON-NLS-1$
6126
		    consumeAllocationHeader();  
6882
		    consumeAllocationHeader();  
6127
			break;
6883
			break;
6128
 
6884
 
6129
    case 389 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); }  //$NON-NLS-1$
6885
    case 420 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); }  //$NON-NLS-1$
6130
		    consumeClassInstanceCreationExpressionWithTypeArguments();  
6886
		    consumeClassInstanceCreationExpressionWithTypeArguments();  
6131
			break;
6887
			break;
6132
 
6888
 
6133
    case 390 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); }  //$NON-NLS-1$
6889
    case 421 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); }  //$NON-NLS-1$
6134
		    consumeClassInstanceCreationExpression();  
6890
		    consumeClassInstanceCreationExpression();  
6135
			break;
6891
			break;
6136
 
6892
 
6137
    case 391 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
6893
    case 422 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
6138
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
6894
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
6139
			break;
6895
			break;
6140
 
6896
 
6141
    case 392 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
6897
    case 423 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
6142
		    consumeClassInstanceCreationExpressionQualified() ;  
6898
		    consumeClassInstanceCreationExpressionQualified() ;  
6143
			break;
6899
			break;
6144
 
6900
 
6145
    case 393 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
6901
    case 424 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
6146
		    consumeClassInstanceCreationExpressionQualified() ;  
6902
		    consumeClassInstanceCreationExpressionQualified() ;  
6147
			break;
6903
			break;
6148
 
6904
 
6149
    case 394 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
6905
    case 425 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
6150
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
6906
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
6151
			break;
6907
			break;
6152
 
6908
 
6153
    case 395 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); }  //$NON-NLS-1$
6909
    case 426 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); }  //$NON-NLS-1$
6154
		    consumeEnterInstanceCreationArgumentList();  
6910
		    consumeEnterInstanceCreationArgumentList();  
6155
			break;
6911
			break;
6156
 
6912
 
6157
    case 396 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); }  //$NON-NLS-1$
6913
    case 427 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); }  //$NON-NLS-1$
6158
		    consumeClassInstanceCreationExpressionName() ;  
6914
		    consumeClassInstanceCreationExpressionName() ;  
6159
			break;
6915
			break;
6160
 
6916
 
6161
    case 397 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); }  //$NON-NLS-1$
6917
    case 428 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); }  //$NON-NLS-1$
6162
		    consumeClassBodyopt();  
6918
		    consumeClassBodyopt();  
6163
			break;
6919
			break;
6164
 
6920
 
6165
    case 399 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
6921
    case 430 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
6166
		    consumeEnterAnonymousClassBody(false);  
6922
		    consumeEnterAnonymousClassBody(false);  
6167
			break;
6923
			break;
6168
 
6924
 
6169
    case 400 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); }  //$NON-NLS-1$
6925
    case 431 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); }  //$NON-NLS-1$
6170
		    consumeClassBodyopt();  
6926
		    consumeClassBodyopt();  
6171
			break;
6927
			break;
6172
 
6928
 
6173
    case 402 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
6929
    case 433 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
6174
		    consumeEnterAnonymousClassBody(true);  
6930
		    consumeEnterAnonymousClassBody(true);  
6175
			break;
6931
			break;
6176
 
6932
 
6177
    case 404 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); }  //$NON-NLS-1$
6933
    case 435 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); }  //$NON-NLS-1$
6178
		    consumeArgumentList();  
6934
		    consumeArgumentList();  
6179
			break;
6935
			break;
6180
 
6936
 
6181
    case 405 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); }  //$NON-NLS-1$
6937
    case 436 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new Annotationsopt PrimitiveType"); }  //$NON-NLS-1$
6182
		    consumeArrayCreationHeader();  
6938
		    consumeArrayCreationHeader();  
6183
			break;
6939
			break;
6184
 
6940
 
6185
    case 406 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); }  //$NON-NLS-1$
6941
    case 437 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); }  //$NON-NLS-1$
6186
		    consumeArrayCreationHeader();  
6942
		    consumeArrayCreationHeader();  
6187
			break;
6943
			break;
6188
 
6944
 
6189
    case 407 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
6945
    case 438 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
6190
		    consumeArrayCreationExpressionWithoutInitializer();  
6946
		    consumeArrayCreationExpressionWithoutInitializer();  
6191
			break;
6947
			break;
6192
 
6948
 
6193
    case 408 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); }  //$NON-NLS-1$
6949
    case 439 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new Annotationsopt"); }  //$NON-NLS-1$
6194
		    consumeArrayCreationExpressionWithInitializer();  
6950
		    consumeArrayCreationExpressionWithInitializer();  
6195
			break;
6951
			break;
6196
 
6952
 
6197
    case 409 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
6953
    case 440 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
6198
		    consumeArrayCreationExpressionWithoutInitializer();  
6954
		    consumeArrayCreationExpressionWithoutInitializer();  
6199
			break;
6955
			break;
6200
 
6956
 
6201
    case 410 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); }  //$NON-NLS-1$
6957
    case 441 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); }  //$NON-NLS-1$
6202
		    consumeArrayCreationExpressionWithInitializer();  
6958
		    consumeArrayCreationExpressionWithInitializer();  
6203
			break;
6959
			break;
6204
 
6960
 
6205
    case 412 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); }  //$NON-NLS-1$
6961
    case 443 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); }  //$NON-NLS-1$
6206
		    consumeDimWithOrWithOutExprs();  
6962
		    consumeDimWithOrWithOutExprs();  
6207
			break;
6963
			break;
6208
 
6964
 
6209
     case 414 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
6965
     case 446 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET..."); }  //$NON-NLS-1$
6210
		    consumeDimWithOrWithOutExpr();  
6966
		    consumeDimWithOrWithOutExpr();  
6211
			break;
6967
			break;
6212
 
6968
 
6213
     case 415 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); }  //$NON-NLS-1$
6969
     case 447 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotations LBRACKET..."); }  //$NON-NLS-1$
6970
		    consumeDimWithOrWithOutExpr();  
6971
			break;
6972
 
6973
     case 448 : if (DEBUG) { System.out.println("DimsoptAnnotsopt ::="); }  //$NON-NLS-1$
6974
		    consumeEmptyDimsoptAnnotsopt();  
6975
			break;
6976
 
6977
     case 449 : if (DEBUG) { System.out.println("DimsoptAnnotsopt -> DimsAnnotLoop"); }  //$NON-NLS-1$
6978
		    consumeDimsWithTrailingAnnotsopt();  
6979
			break;
6980
 
6981
     case 452 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= Annotation"); }  //$NON-NLS-1$
6982
		    consumeTypeAnnotation(true);  
6983
			break;
6984
 
6985
     case 453 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
6986
		    consumeOneDimLoop(true);  
6987
			break;
6988
 
6989
     case 454 : if (DEBUG) { System.out.println("TypeAnnotations ::= Annotation"); }  //$NON-NLS-1$
6990
		    consumeTypeAnnotation(false);  
6991
			break;
6992
 
6993
     case 455 : if (DEBUG) { System.out.println("TypeAnnotations ::= TypeAnnotations Annotation"); }  //$NON-NLS-1$
6994
		    consumeOneMoreTypeAnnotation();  
6995
			break;
6996
 
6997
     case 456 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); }  //$NON-NLS-1$
6214
		    consumeDims();  
6998
		    consumeDims();  
6215
			break;
6999
			break;
6216
 
7000
 
6217
     case 418 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
7001
     case 459 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
6218
		    consumeOneDimLoop();  
7002
		    consumeOneDimLoop(false);  
6219
			break;
7003
			break;
6220
 
7004
 
6221
    case 419 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); }  //$NON-NLS-1$
7005
     case 460 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); }  //$NON-NLS-1$
7006
		    consumeOneDimLoopWithAnnotations();  
7007
			break;
7008
 
7009
    case 461 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); }  //$NON-NLS-1$
6222
		    consumeFieldAccess(false);  
7010
		    consumeFieldAccess(false);  
6223
			break;
7011
			break;
6224
 
7012
 
6225
    case 420 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); }  //$NON-NLS-1$
7013
    case 462 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); }  //$NON-NLS-1$
6226
		    consumeFieldAccess(true);  
7014
		    consumeFieldAccess(true);  
6227
			break;
7015
			break;
6228
 
7016
 
6229
    case 421 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
7017
    case 463 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
6230
		    consumeMethodInvocationName();  
7018
		    consumeMethodInvocationName();  
6231
			break;
7019
			break;
6232
 
7020
 
6233
    case 422 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
7021
    case 464 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
6234
		    consumeMethodInvocationNameWithTypeArguments();  
7022
		    consumeMethodInvocationNameWithTypeArguments();  
6235
			break;
7023
			break;
6236
 
7024
 
6237
    case 423 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
7025
    case 465 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
6238
		    consumeMethodInvocationPrimaryWithTypeArguments();  
7026
		    consumeMethodInvocationPrimaryWithTypeArguments();  
6239
			break;
7027
			break;
6240
 
7028
 
6241
    case 424 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); }  //$NON-NLS-1$
7029
    case 466 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); }  //$NON-NLS-1$
6242
		    consumeMethodInvocationPrimary();  
7030
		    consumeMethodInvocationPrimary();  
6243
			break;
7031
			break;
6244
 
7032
 
6245
    case 425 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
7033
    case 467 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
6246
		    consumeMethodInvocationSuperWithTypeArguments();  
7034
		    consumeMethodInvocationSuperWithTypeArguments();  
6247
			break;
7035
			break;
6248
 
7036
 
6249
    case 426 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); }  //$NON-NLS-1$
7037
    case 468 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); }  //$NON-NLS-1$
6250
		    consumeMethodInvocationSuper();  
7038
		    consumeMethodInvocationSuper();  
6251
			break;
7039
			break;
6252
 
7040
 
6253
    case 427 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); }  //$NON-NLS-1$
7041
    case 469 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); }  //$NON-NLS-1$
6254
		    consumeArrayAccess(true);  
7042
		    consumeArrayAccess(true);  
6255
			break;
7043
			break;
6256
 
7044
 
6257
    case 428 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); }  //$NON-NLS-1$
7045
    case 470 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); }  //$NON-NLS-1$
6258
		    consumeArrayAccess(false);  
7046
		    consumeArrayAccess(false);  
6259
			break;
7047
			break;
6260
 
7048
 
6261
    case 429 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); }  //$NON-NLS-1$
7049
    case 471 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); }  //$NON-NLS-1$
6262
		    consumeArrayAccess(false);  
7050
		    consumeArrayAccess(false);  
6263
			break;
7051
			break;
6264
 
7052
 
6265
    case 431 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); }  //$NON-NLS-1$
7053
    case 473 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); }  //$NON-NLS-1$
6266
		    consumePostfixExpression();  
7054
		    consumePostfixExpression();  
6267
			break;
7055
			break;
6268
 
7056
 
6269
    case 434 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); }  //$NON-NLS-1$
7057
    case 476 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); }  //$NON-NLS-1$
6270
		    consumeUnaryExpression(OperatorIds.PLUS,true);  
7058
		    consumeUnaryExpression(OperatorIds.PLUS,true);  
6271
			break;
7059
			break;
6272
 
7060
 
6273
    case 435 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); }  //$NON-NLS-1$
7061
    case 477 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); }  //$NON-NLS-1$
6274
		    consumeUnaryExpression(OperatorIds.MINUS,true);  
7062
		    consumeUnaryExpression(OperatorIds.MINUS,true);  
6275
			break;
7063
			break;
6276
 
7064
 
6277
    case 436 : if (DEBUG) { System.out.println("PushPosition ::="); }  //$NON-NLS-1$
7065
    case 478 : if (DEBUG) { System.out.println("PushPosition ::="); }  //$NON-NLS-1$
6278
		    consumePushPosition();  
7066
		    consumePushPosition();  
6279
			break;
7067
			break;
6280
 
7068
 
6281
    case 439 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
7069
    case 481 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
6282
		    consumeUnaryExpression(OperatorIds.PLUS);  
7070
		    consumeUnaryExpression(OperatorIds.PLUS);  
6283
			break;
7071
			break;
6284
 
7072
 
6285
    case 440 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
7073
    case 482 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
6286
		    consumeUnaryExpression(OperatorIds.MINUS);  
7074
		    consumeUnaryExpression(OperatorIds.MINUS);  
6287
			break;
7075
			break;
6288
 
7076
 
6289
    case 442 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); }  //$NON-NLS-1$
7077
    case 484 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); }  //$NON-NLS-1$
6290
		    consumeUnaryExpression(OperatorIds.PLUS,false);  
7078
		    consumeUnaryExpression(OperatorIds.PLUS,false);  
6291
			break;
7079
			break;
6292
 
7080
 
6293
    case 443 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); }  //$NON-NLS-1$
7081
    case 485 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); }  //$NON-NLS-1$
6294
		    consumeUnaryExpression(OperatorIds.MINUS,false);  
7082
		    consumeUnaryExpression(OperatorIds.MINUS,false);  
6295
			break;
7083
			break;
6296
 
7084
 
6297
    case 445 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); }  //$NON-NLS-1$
7085
    case 487 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); }  //$NON-NLS-1$
6298
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
7086
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
6299
			break;
7087
			break;
6300
 
7088
 
6301
    case 446 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); }  //$NON-NLS-1$
7089
    case 488 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); }  //$NON-NLS-1$
6302
		    consumeUnaryExpression(OperatorIds.NOT);  
7090
		    consumeUnaryExpression(OperatorIds.NOT);  
6303
			break;
7091
			break;
6304
 
7092
 
6305
    case 448 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); }  //$NON-NLS-1$
7093
    case 490 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); }  //$NON-NLS-1$
6306
		    consumeCastExpressionWithPrimitiveType();  
7094
		    consumeCastExpressionWithPrimitiveType();  
6307
			break;
7095
			break;
6308
 
7096
 
6309
    case 449 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
7097
    case 491 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers PrimitiveType..."); }  //$NON-NLS-1$
7098
		    consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations();  
7099
			break;
7100
 
7101
    case 492 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6310
		    consumeCastExpressionWithGenericsArray();  
7102
		    consumeCastExpressionWithGenericsArray();  
6311
			break;
7103
			break;
6312
 
7104
 
6313
    case 450 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
7105
    case 493 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); }  //$NON-NLS-1$
7106
		    consumeCastExpressionWithGenericsArrayWithTypeAnnotations();  
7107
			break;
7108
 
7109
    case 494 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6314
		    consumeCastExpressionWithQualifiedGenericsArray();  
7110
		    consumeCastExpressionWithQualifiedGenericsArray();  
6315
			break;
7111
			break;
6316
 
7112
 
6317
    case 451 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); }  //$NON-NLS-1$
7113
    case 495 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); }  //$NON-NLS-1$
7114
		    consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations();  
7115
			break;
7116
 
7117
    case 496 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6318
		    consumeCastExpressionLL1();  
7118
		    consumeCastExpressionLL1();  
6319
			break;
7119
			break;
6320
 
7120
 
6321
    case 452 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); }  //$NON-NLS-1$
7121
    case 497 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); }  //$NON-NLS-1$
7122
		    consumeCastExpressionLL1WithTypeAnnotations();  
7123
			break;
7124
 
7125
    case 498 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); }  //$NON-NLS-1$
6322
		    consumeCastExpressionWithNameArray();  
7126
		    consumeCastExpressionWithNameArray();  
6323
			break;
7127
			break;
6324
 
7128
 
6325
    case 453 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); }  //$NON-NLS-1$
7129
    case 499 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name Dims..."); }  //$NON-NLS-1$
7130
		    consumeCastExpressionWithNameArrayWithTypeAnnotations();  
7131
			break;
7132
 
7133
    case 500 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); }  //$NON-NLS-1$
6326
		    consumeOnlyTypeArgumentsForCastExpression();  
7134
		    consumeOnlyTypeArgumentsForCastExpression();  
6327
			break;
7135
			break;
6328
 
7136
 
6329
    case 454 : if (DEBUG) { System.out.println("InsideCastExpression ::="); }  //$NON-NLS-1$
7137
    case 501 : if (DEBUG) { System.out.println("InsideCastExpression ::="); }  //$NON-NLS-1$
6330
		    consumeInsideCastExpression();  
7138
		    consumeInsideCastExpression();  
6331
			break;
7139
			break;
6332
 
7140
 
6333
    case 455 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); }  //$NON-NLS-1$
7141
    case 502 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); }  //$NON-NLS-1$
6334
		    consumeInsideCastExpressionLL1();  
7142
		    consumeInsideCastExpressionLL1();  
6335
			break;
7143
			break;
6336
 
7144
 
6337
    case 456 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); }  //$NON-NLS-1$
7145
    case 503 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); }  //$NON-NLS-1$
6338
		    consumeInsideCastExpressionWithQualifiedGenerics();  
7146
		    consumeInsideCastExpressionWithQualifiedGenerics();  
6339
			break;
7147
			break;
6340
 
7148
 
6341
    case 458 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
7149
    case 504 : if (DEBUG) { System.out.println("InsideCastExpressionWithAnnotatedQualifiedGenerics ::="); }  //$NON-NLS-1$
7150
		    consumeInsideCastExpressionWithAnnotatedQualifiedGenerics();  
7151
			break;
7152
 
7153
    case 506 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6342
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
7154
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
6343
			break;
7155
			break;
6344
 
7156
 
6345
    case 459 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
7157
    case 507 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6346
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
7158
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
6347
			break;
7159
			break;
6348
 
7160
 
6349
    case 460 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
7161
    case 508 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6350
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
7162
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
6351
			break;
7163
			break;
6352
 
7164
 
6353
    case 462 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); }  //$NON-NLS-1$
7165
    case 510 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); }  //$NON-NLS-1$
6354
		    consumeBinaryExpression(OperatorIds.PLUS);  
7166
		    consumeBinaryExpression(OperatorIds.PLUS);  
6355
			break;
7167
			break;
6356
 
7168
 
6357
    case 463 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); }  //$NON-NLS-1$
7169
    case 511 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); }  //$NON-NLS-1$
6358
		    consumeBinaryExpression(OperatorIds.MINUS);  
7170
		    consumeBinaryExpression(OperatorIds.MINUS);  
6359
			break;
7171
			break;
6360
 
7172
 
6361
    case 465 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); }  //$NON-NLS-1$
7173
    case 513 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); }  //$NON-NLS-1$
6362
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
7174
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
6363
			break;
7175
			break;
6364
 
7176
 
6365
    case 466 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); }  //$NON-NLS-1$
7177
    case 514 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); }  //$NON-NLS-1$
6366
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
7178
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
6367
			break;
7179
			break;
6368
 
7180
 
6369
    case 467 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
7181
    case 515 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
6370
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
7182
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
6371
			break;
7183
			break;
6372
 
7184
 
6373
    case 469 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); }  //$NON-NLS-1$
7185
    case 517 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); }  //$NON-NLS-1$
6374
		    consumeBinaryExpression(OperatorIds.LESS);  
7186
		    consumeBinaryExpression(OperatorIds.LESS);  
6375
			break;
7187
			break;
6376
 
7188
 
6377
    case 470 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); }  //$NON-NLS-1$
7189
    case 518 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); }  //$NON-NLS-1$
6378
		    consumeBinaryExpression(OperatorIds.GREATER);  
7190
		    consumeBinaryExpression(OperatorIds.GREATER);  
6379
			break;
7191
			break;
6380
 
7192
 
6381
    case 471 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); }  //$NON-NLS-1$
7193
    case 519 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); }  //$NON-NLS-1$
6382
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
7194
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
6383
			break;
7195
			break;
6384
 
7196
 
6385
    case 472 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); }  //$NON-NLS-1$
7197
    case 520 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); }  //$NON-NLS-1$
6386
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
7198
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
6387
			break;
7199
			break;
6388
 
7200
 
6389
    case 474 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); }  //$NON-NLS-1$
7201
    case 522 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); }  //$NON-NLS-1$
6390
		    consumeInstanceOfExpression();  
7202
		    consumeInstanceOfExpression();  
6391
			break;
7203
			break;
6392
 
7204
 
6393
    case 476 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); }  //$NON-NLS-1$
7205
    case 524 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); }  //$NON-NLS-1$
6394
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
7206
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
6395
			break;
7207
			break;
6396
 
7208
 
6397
    case 477 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); }  //$NON-NLS-1$
7209
    case 525 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); }  //$NON-NLS-1$
6398
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
7210
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
6399
			break;
7211
			break;
6400
 
7212
 
6401
    case 479 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); }  //$NON-NLS-1$
7213
    case 527 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); }  //$NON-NLS-1$
6402
		    consumeBinaryExpression(OperatorIds.AND);  
7214
		    consumeBinaryExpression(OperatorIds.AND);  
6403
			break;
7215
			break;
6404
 
7216
 
6405
    case 481 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); }  //$NON-NLS-1$
7217
    case 529 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); }  //$NON-NLS-1$
6406
		    consumeBinaryExpression(OperatorIds.XOR);  
7218
		    consumeBinaryExpression(OperatorIds.XOR);  
6407
			break;
7219
			break;
6408
 
7220
 
6409
    case 483 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); }  //$NON-NLS-1$
7221
    case 531 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); }  //$NON-NLS-1$
6410
		    consumeBinaryExpression(OperatorIds.OR);  
7222
		    consumeBinaryExpression(OperatorIds.OR);  
6411
			break;
7223
			break;
6412
 
7224
 
6413
    case 485 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); }  //$NON-NLS-1$
7225
    case 533 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); }  //$NON-NLS-1$
6414
		    consumeBinaryExpression(OperatorIds.AND_AND);  
7226
		    consumeBinaryExpression(OperatorIds.AND_AND);  
6415
			break;
7227
			break;
6416
 
7228
 
6417
    case 487 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
7229
    case 535 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
6418
		    consumeBinaryExpression(OperatorIds.OR_OR);  
7230
		    consumeBinaryExpression(OperatorIds.OR_OR);  
6419
			break;
7231
			break;
6420
 
7232
 
6421
    case 489 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
7233
    case 537 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
6422
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
7234
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
6423
			break;
7235
			break;
6424
 
7236
 
6425
    case 492 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); }  //$NON-NLS-1$
7237
    case 540 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); }  //$NON-NLS-1$
6426
		    consumeAssignment();  
7238
		    consumeAssignment();  
6427
			break;
7239
			break;
6428
 
7240
 
6429
    case 494 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); }  //$NON-NLS-1$
7241
    case 542 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); }  //$NON-NLS-1$
6430
		    ignoreExpressionAssignment(); 
7242
		    ignoreExpressionAssignment(); 
6431
			break;
7243
			break;
6432
 
7244
 
6433
    case 495 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); }  //$NON-NLS-1$
7245
    case 543 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); }  //$NON-NLS-1$
6434
		    consumeAssignmentOperator(EQUAL);  
7246
		    consumeAssignmentOperator(EQUAL);  
6435
			break;
7247
			break;
6436
 
7248
 
6437
    case 496 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); }  //$NON-NLS-1$
7249
    case 544 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); }  //$NON-NLS-1$
6438
		    consumeAssignmentOperator(MULTIPLY);  
7250
		    consumeAssignmentOperator(MULTIPLY);  
6439
			break;
7251
			break;
6440
 
7252
 
6441
    case 497 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); }  //$NON-NLS-1$
7253
    case 545 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); }  //$NON-NLS-1$
6442
		    consumeAssignmentOperator(DIVIDE);  
7254
		    consumeAssignmentOperator(DIVIDE);  
6443
			break;
7255
			break;
6444
 
7256
 
6445
    case 498 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); }  //$NON-NLS-1$
7257
    case 546 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); }  //$NON-NLS-1$
6446
		    consumeAssignmentOperator(REMAINDER);  
7258
		    consumeAssignmentOperator(REMAINDER);  
6447
			break;
7259
			break;
6448
 
7260
 
6449
    case 499 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); }  //$NON-NLS-1$
7261
    case 547 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); }  //$NON-NLS-1$
6450
		    consumeAssignmentOperator(PLUS);  
7262
		    consumeAssignmentOperator(PLUS);  
6451
			break;
7263
			break;
6452
 
7264
 
6453
    case 500 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); }  //$NON-NLS-1$
7265
    case 548 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); }  //$NON-NLS-1$
6454
		    consumeAssignmentOperator(MINUS);  
7266
		    consumeAssignmentOperator(MINUS);  
6455
			break;
7267
			break;
6456
 
7268
 
6457
    case 501 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); }  //$NON-NLS-1$
7269
    case 549 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); }  //$NON-NLS-1$
6458
		    consumeAssignmentOperator(LEFT_SHIFT);  
7270
		    consumeAssignmentOperator(LEFT_SHIFT);  
6459
			break;
7271
			break;
6460
 
7272
 
6461
    case 502 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
7273
    case 550 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
6462
		    consumeAssignmentOperator(RIGHT_SHIFT);  
7274
		    consumeAssignmentOperator(RIGHT_SHIFT);  
6463
			break;
7275
			break;
6464
 
7276
 
6465
    case 503 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
7277
    case 551 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
6466
		    consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);  
7278
		    consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);  
6467
			break;
7279
			break;
6468
 
7280
 
6469
    case 504 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); }  //$NON-NLS-1$
7281
    case 552 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); }  //$NON-NLS-1$
6470
		    consumeAssignmentOperator(AND);  
7282
		    consumeAssignmentOperator(AND);  
6471
			break;
7283
			break;
6472
 
7284
 
6473
    case 505 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); }  //$NON-NLS-1$
7285
    case 553 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); }  //$NON-NLS-1$
6474
		    consumeAssignmentOperator(XOR);  
7286
		    consumeAssignmentOperator(XOR);  
6475
			break;
7287
			break;
6476
 
7288
 
6477
    case 506 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); }  //$NON-NLS-1$
7289
    case 554 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); }  //$NON-NLS-1$
6478
		    consumeAssignmentOperator(OR);  
7290
		    consumeAssignmentOperator(OR);  
6479
			break;
7291
			break;
6480
 
7292
 
6481
    case 507 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); }  //$NON-NLS-1$
7293
    case 555 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); }  //$NON-NLS-1$
6482
		    consumeExpression();  
7294
		    consumeExpression();  
6483
			break;
7295
			break;
6484
 
7296
 
6485
    case 510 : if (DEBUG) { System.out.println("Expressionopt ::="); }  //$NON-NLS-1$
7297
    case 558 : if (DEBUG) { System.out.println("Expressionopt ::="); }  //$NON-NLS-1$
6486
		    consumeEmptyExpression();  
7298
		    consumeEmptyExpression();  
6487
			break;
7299
			break;
6488
 
7300
 
6489
    case 515 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); }  //$NON-NLS-1$
7301
    case 563 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); }  //$NON-NLS-1$
6490
		    consumeEmptyClassBodyDeclarationsopt();  
7302
		    consumeEmptyClassBodyDeclarationsopt();  
6491
			break;
7303
			break;
6492
 
7304
 
6493
    case 516 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7305
    case 564 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
6494
		    consumeClassBodyDeclarationsopt();  
7306
		    consumeClassBodyDeclarationsopt();  
6495
			break;
7307
			break;
6496
 
7308
 
6497
     case 517 : if (DEBUG) { System.out.println("Modifiersopt ::="); }  //$NON-NLS-1$
7309
     case 565 : if (DEBUG) { System.out.println("Modifiersopt ::="); }  //$NON-NLS-1$
6498
		    consumeDefaultModifiers();  
7310
		    consumeDefaultModifiers();  
6499
			break;
7311
			break;
6500
 
7312
 
6501
    case 518 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); }  //$NON-NLS-1$
7313
    case 566 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); }  //$NON-NLS-1$
6502
		    consumeModifiers();  
7314
		    consumeModifiers();  
6503
			break;
7315
			break;
6504
 
7316
 
6505
    case 519 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); }  //$NON-NLS-1$
7317
    case 567 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); }  //$NON-NLS-1$
6506
		    consumeEmptyBlockStatementsopt();  
7318
		    consumeEmptyBlockStatementsopt();  
6507
			break;
7319
			break;
6508
 
7320
 
6509
     case 521 : if (DEBUG) { System.out.println("Dimsopt ::="); }  //$NON-NLS-1$
7321
     case 569 : if (DEBUG) { System.out.println("Dimsopt ::="); }  //$NON-NLS-1$
6510
		    consumeEmptyDimsopt();  
7322
		    consumeEmptyDimsopt();  
6511
			break;
7323
			break;
6512
 
7324
 
6513
     case 523 : if (DEBUG) { System.out.println("ArgumentListopt ::="); }  //$NON-NLS-1$
7325
     case 571 : if (DEBUG) { System.out.println("ArgumentListopt ::="); }  //$NON-NLS-1$
6514
		    consumeEmptyArgumentListopt();  
7326
		    consumeEmptyArgumentListopt();  
6515
			break;
7327
			break;
6516
 
7328
 
6517
    case 527 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); }  //$NON-NLS-1$
7329
    case 575 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); }  //$NON-NLS-1$
6518
		    consumeFormalParameterListopt();  
7330
		    consumeFormalParameterListopt();  
6519
			break;
7331
			break;
6520
 
7332
 
6521
     case 531 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); }  //$NON-NLS-1$
7333
     case 579 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); }  //$NON-NLS-1$
6522
		    consumeEmptyInterfaceMemberDeclarationsopt();  
7334
		    consumeEmptyInterfaceMemberDeclarationsopt();  
6523
			break;
7335
			break;
6524
 
7336
 
6525
     case 532 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7337
     case 580 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
6526
		    consumeInterfaceMemberDeclarationsopt();  
7338
		    consumeInterfaceMemberDeclarationsopt();  
6527
			break;
7339
			break;
6528
 
7340
 
6529
    case 533 : if (DEBUG) { System.out.println("NestedType ::="); }  //$NON-NLS-1$
7341
    case 581 : if (DEBUG) { System.out.println("NestedType ::="); }  //$NON-NLS-1$
6530
		    consumeNestedType();  
7342
		    consumeNestedType();  
6531
			break;
7343
			break;
6532
7344
6533
     case 534 : if (DEBUG) { System.out.println("ForInitopt ::="); }  //$NON-NLS-1$
7345
     case 582 : if (DEBUG) { System.out.println("ForInitopt ::="); }  //$NON-NLS-1$
6534
		    consumeEmptyForInitopt();  
7346
		    consumeEmptyForInitopt();  
6535
			break;
7347
			break;
6536
 
7348
 
6537
     case 536 : if (DEBUG) { System.out.println("ForUpdateopt ::="); }  //$NON-NLS-1$
7349
     case 584 : if (DEBUG) { System.out.println("ForUpdateopt ::="); }  //$NON-NLS-1$
6538
		    consumeEmptyForUpdateopt();  
7350
		    consumeEmptyForUpdateopt();  
6539
			break;
7351
			break;
6540
 
7352
 
6541
     case 540 : if (DEBUG) { System.out.println("Catchesopt ::="); }  //$NON-NLS-1$
7353
     case 588 : if (DEBUG) { System.out.println("Catchesopt ::="); }  //$NON-NLS-1$
6542
		    consumeEmptyCatchesopt();  
7354
		    consumeEmptyCatchesopt();  
6543
			break;
7355
			break;
6544
 
7356
 
6545
     case 542 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); }  //$NON-NLS-1$
7357
     case 590 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); }  //$NON-NLS-1$
6546
		    consumeEnumDeclaration();  
7358
		    consumeEnumDeclaration();  
6547
			break;
7359
			break;
6548
 
7360
 
6549
     case 543 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); }  //$NON-NLS-1$
7361
     case 591 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); }  //$NON-NLS-1$
6550
		    consumeEnumHeader();  
7362
		    consumeEnumHeader();  
6551
			break;
7363
			break;
6552
 
7364
 
6553
     case 544 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); }  //$NON-NLS-1$
7365
     case 592 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); }  //$NON-NLS-1$
6554
		    consumeEnumHeaderName();  
7366
		    consumeEnumHeaderName();  
6555
			break;
7367
			break;
6556
 
7368
 
6557
     case 545 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); }  //$NON-NLS-1$
7369
     case 593 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); }  //$NON-NLS-1$
6558
		    consumeEnumHeaderNameWithTypeParameters();  
7370
		    consumeEnumHeaderNameWithTypeParameters();  
6559
			break;
7371
			break;
6560
 
7372
 
6561
     case 546 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); }  //$NON-NLS-1$
7373
     case 594 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); }  //$NON-NLS-1$
6562
		    consumeEnumBodyNoConstants();  
7374
		    consumeEnumBodyNoConstants();  
6563
			break;
7375
			break;
6564
 
7376
 
6565
     case 547 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); }  //$NON-NLS-1$
7377
     case 595 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); }  //$NON-NLS-1$
6566
		    consumeEnumBodyNoConstants();  
7378
		    consumeEnumBodyNoConstants();  
6567
			break;
7379
			break;
6568
 
7380
 
6569
     case 548 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); }  //$NON-NLS-1$
7381
     case 596 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); }  //$NON-NLS-1$
6570
		    consumeEnumBodyWithConstants();  
7382
		    consumeEnumBodyWithConstants();  
6571
			break;
7383
			break;
6572
 
7384
 
6573
     case 549 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); }  //$NON-NLS-1$
7385
     case 597 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); }  //$NON-NLS-1$
6574
		    consumeEnumBodyWithConstants();  
7386
		    consumeEnumBodyWithConstants();  
6575
			break;
7387
			break;
6576
 
7388
 
6577
    case 551 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); }  //$NON-NLS-1$
7389
    case 599 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); }  //$NON-NLS-1$
6578
		    consumeEnumConstants();  
7390
		    consumeEnumConstants();  
6579
			break;
7391
			break;
6580
 
7392
 
6581
    case 552 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); }  //$NON-NLS-1$
7393
    case 600 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); }  //$NON-NLS-1$
6582
		    consumeEnumConstantHeaderName();  
7394
		    consumeEnumConstantHeaderName();  
6583
			break;
7395
			break;
6584
 
7396
 
6585
    case 553 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); }  //$NON-NLS-1$
7397
    case 601 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); }  //$NON-NLS-1$
6586
		    consumeEnumConstantHeader();  
7398
		    consumeEnumConstantHeader();  
6587
			break;
7399
			break;
6588
 
7400
 
6589
    case 554 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); }  //$NON-NLS-1$
7401
    case 602 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); }  //$NON-NLS-1$
6590
		    consumeEnumConstantWithClassBody();  
7402
		    consumeEnumConstantWithClassBody();  
6591
			break;
7403
			break;
6592
 
7404
 
6593
    case 555 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); }  //$NON-NLS-1$
7405
    case 603 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); }  //$NON-NLS-1$
6594
		    consumeEnumConstantNoClassBody();  
7406
		    consumeEnumConstantNoClassBody();  
6595
			break;
7407
			break;
6596
 
7408
 
6597
    case 556 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
7409
    case 604 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
6598
		    consumeArguments();  
7410
		    consumeArguments();  
6599
			break;
7411
			break;
6600
 
7412
 
6601
    case 557 : if (DEBUG) { System.out.println("Argumentsopt ::="); }  //$NON-NLS-1$
7413
    case 605 : if (DEBUG) { System.out.println("Argumentsopt ::="); }  //$NON-NLS-1$
6602
		    consumeEmptyArguments();  
7414
		    consumeEmptyArguments();  
6603
			break;
7415
			break;
6604
 
7416
 
6605
    case 559 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); }  //$NON-NLS-1$
7417
    case 607 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); }  //$NON-NLS-1$
6606
		    consumeEnumDeclarations();  
7418
		    consumeEnumDeclarations();  
6607
			break;
7419
			break;
6608
 
7420
 
6609
    case 560 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); }  //$NON-NLS-1$
7421
    case 608 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); }  //$NON-NLS-1$
6610
		    consumeEmptyEnumDeclarations();  
7422
		    consumeEmptyEnumDeclarations();  
6611
			break;
7423
			break;
6612
 
7424
 
6613
    case 562 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); }  //$NON-NLS-1$
7425
    case 610 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); }  //$NON-NLS-1$
6614
		    consumeEnhancedForStatement();  
7426
		    consumeEnhancedForStatement();  
6615
			break;
7427
			break;
6616
 
7428
 
6617
    case 563 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); }  //$NON-NLS-1$
7429
    case 611 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); }  //$NON-NLS-1$
6618
		    consumeEnhancedForStatement();  
7430
		    consumeEnhancedForStatement();  
6619
			break;
7431
			break;
6620
 
7432
 
6621
    case 564 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); }  //$NON-NLS-1$
7433
    case 612 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type0..."); }  //$NON-NLS-1$
6622
		    consumeEnhancedForStatementHeaderInit(false);  
7434
		    consumeEnhancedForStatementHeaderInit(false);  
6623
			break;
7435
			break;
6624
 
7436
 
6625
    case 565 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); }  //$NON-NLS-1$
7437
    case 613 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); }  //$NON-NLS-1$
6626
		    consumeEnhancedForStatementHeaderInit(true);  
7438
		    consumeEnhancedForStatementHeaderInit(true);  
6627
			break;
7439
			break;
6628
 
7440
 
6629
    case 566 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); }  //$NON-NLS-1$
7441
    case 614 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); }  //$NON-NLS-1$
6630
		    consumeEnhancedForStatementHeader();  
7442
		    consumeEnhancedForStatementHeader();  
6631
			break;
7443
			break;
6632
 
7444
 
6633
    case 567 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); }  //$NON-NLS-1$
7445
    case 615 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); }  //$NON-NLS-1$
6634
		    consumeImportDeclaration();  
7446
		    consumeImportDeclaration();  
6635
			break;
7447
			break;
6636
 
7448
 
6637
    case 568 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); }  //$NON-NLS-1$
7449
    case 616 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); }  //$NON-NLS-1$
6638
		    consumeSingleStaticImportDeclarationName();  
7450
		    consumeSingleStaticImportDeclarationName();  
6639
			break;
7451
			break;
6640
 
7452
 
6641
    case 569 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
7453
    case 617 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
6642
		    consumeImportDeclaration();  
7454
		    consumeImportDeclaration();  
6643
			break;
7455
			break;
6644
 
7456
 
6645
    case 570 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); }  //$NON-NLS-1$
7457
    case 618 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); }  //$NON-NLS-1$
6646
		    consumeStaticImportOnDemandDeclarationName();  
7458
		    consumeStaticImportOnDemandDeclarationName();  
6647
			break;
7459
			break;
6648
 
7460
 
6649
    case 571 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
7461
    case 619 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
6650
		    consumeTypeArguments();  
7462
		    consumeTypeArguments();  
6651
			break;
7463
			break;
6652
 
7464
 
6653
    case 572 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
7465
    case 620 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
6654
		    consumeOnlyTypeArguments();  
7466
		    consumeOnlyTypeArguments();  
6655
			break;
7467
			break;
6656
 
7468
 
6657
    case 574 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
7469
    case 622 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
6658
		    consumeTypeArgumentList1();  
7470
		    consumeTypeArgumentList1();  
6659
			break;
7471
			break;
6660
 
7472
 
6661
    case 576 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); }  //$NON-NLS-1$
7473
    case 624 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); }  //$NON-NLS-1$
6662
		    consumeTypeArgumentList();  
7474
		    consumeTypeArgumentList();  
6663
			break;
7475
			break;
6664
 
7476
 
6665
    case 577 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); }  //$NON-NLS-1$
7477
    case 625 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); }  //$NON-NLS-1$
6666
		    consumeTypeArgument();  
7478
		    consumeTypeArgument();  
6667
			break;
7479
			break;
6668
 
7480
 
6669
    case 581 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); }  //$NON-NLS-1$
7481
    case 629 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); }  //$NON-NLS-1$
6670
		    consumeReferenceType1();  
7482
		    consumeReferenceType1();  
6671
			break;
7483
			break;
6672
 
7484
 
6673
    case 582 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
7485
    case 630 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
6674
		    consumeTypeArgumentReferenceType1();  
7486
		    consumeTypeArgumentReferenceType1();  
6675
			break;
7487
			break;
6676
 
7488
 
6677
    case 584 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
7489
    case 631 : if (DEBUG) { System.out.println("ReferenceType1 ::= Modifiers ClassOrInterface LESS..."); }  //$NON-NLS-1$
7490
		    consumeTypeArgumentReferenceType1WithTypeAnnotations();  
7491
			break;
7492
 
7493
    case 633 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
6678
		    consumeTypeArgumentList2();  
7494
		    consumeTypeArgumentList2();  
6679
			break;
7495
			break;
6680
 
7496
 
6681
    case 587 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); }  //$NON-NLS-1$
7497
    case 636 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); }  //$NON-NLS-1$
6682
		    consumeReferenceType2();  
7498
		    consumeReferenceType2();  
6683
			break;
7499
			break;
6684
 
7500
 
6685
    case 588 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
7501
    case 637 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
6686
		    consumeTypeArgumentReferenceType2();  
7502
		    consumeTypeArgumentReferenceType2();  
6687
			break;
7503
			break;
6688
 
7504
 
6689
    case 590 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
7505
    case 638 : if (DEBUG) { System.out.println("ReferenceType2 ::= Modifiers ClassOrInterface LESS..."); }  //$NON-NLS-1$
7506
		    consumeTypeArgumentReferenceType2WithTypeAnnotations();  
7507
			break;
7508
 
7509
    case 640 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
6690
		    consumeTypeArgumentList3();  
7510
		    consumeTypeArgumentList3();  
6691
			break;
7511
			break;
6692
 
7512
 
6693
    case 593 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
7513
    case 643 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
6694
		    consumeReferenceType3();  
7514
		    consumeReferenceType3();  
6695
			break;
7515
			break;
6696
 
7516
 
6697
    case 594 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); }  //$NON-NLS-1$
7517
    case 644 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); }  //$NON-NLS-1$
6698
		    consumeWildcard();  
7518
		    consumeWildcard();  
6699
			break;
7519
			break;
6700
 
7520
 
6701
    case 595 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); }  //$NON-NLS-1$
7521
    case 645 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); }  //$NON-NLS-1$
6702
		    consumeWildcardWithBounds();  
7522
		    consumeWildcardWithBounds();  
6703
			break;
7523
			break;
6704
 
7524
 
6705
    case 596 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); }  //$NON-NLS-1$
7525
    case 646 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); }  //$NON-NLS-1$
6706
		    consumeWildcardBoundsExtends();  
7526
		    consumeWildcardBoundsExtends();  
6707
			break;
7527
			break;
6708
 
7528
 
6709
    case 597 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); }  //$NON-NLS-1$
7529
    case 647 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); }  //$NON-NLS-1$
6710
		    consumeWildcardBoundsSuper();  
7530
		    consumeWildcardBoundsSuper();  
6711
			break;
7531
			break;
6712
 
7532
 
6713
    case 598 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); }  //$NON-NLS-1$
7533
    case 648 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); }  //$NON-NLS-1$
6714
		    consumeWildcard1();  
7534
		    consumeWildcard1();  
6715
			break;
7535
			break;
6716
 
7536
 
6717
    case 599 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); }  //$NON-NLS-1$
7537
    case 649 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); }  //$NON-NLS-1$
6718
		    consumeWildcard1WithBounds();  
7538
		    consumeWildcard1WithBounds();  
6719
			break;
7539
			break;
6720
 
7540
 
6721
    case 600 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); }  //$NON-NLS-1$
7541
    case 650 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); }  //$NON-NLS-1$
6722
		    consumeWildcardBounds1Extends();  
7542
		    consumeWildcardBounds1Extends();  
6723
			break;
7543
			break;
6724
 
7544
 
6725
    case 601 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); }  //$NON-NLS-1$
7545
    case 651 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); }  //$NON-NLS-1$
6726
		    consumeWildcardBounds1Super();  
7546
		    consumeWildcardBounds1Super();  
6727
			break;
7547
			break;
6728
 
7548
 
6729
    case 602 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); }  //$NON-NLS-1$
7549
    case 652 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); }  //$NON-NLS-1$
6730
		    consumeWildcard2();  
7550
		    consumeWildcard2();  
6731
			break;
7551
			break;
6732
 
7552
 
6733
    case 603 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); }  //$NON-NLS-1$
7553
    case 653 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); }  //$NON-NLS-1$
6734
		    consumeWildcard2WithBounds();  
7554
		    consumeWildcard2WithBounds();  
6735
			break;
7555
			break;
6736
 
7556
 
6737
    case 604 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); }  //$NON-NLS-1$
7557
    case 654 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); }  //$NON-NLS-1$
6738
		    consumeWildcardBounds2Extends();  
7558
		    consumeWildcardBounds2Extends();  
6739
			break;
7559
			break;
6740
 
7560
 
6741
    case 605 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); }  //$NON-NLS-1$
7561
    case 655 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); }  //$NON-NLS-1$
6742
		    consumeWildcardBounds2Super();  
7562
		    consumeWildcardBounds2Super();  
6743
			break;
7563
			break;
6744
 
7564
 
6745
    case 606 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
7565
    case 656 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
6746
		    consumeWildcard3();  
7566
		    consumeWildcard3();  
6747
			break;
7567
			break;
6748
 
7568
 
6749
    case 607 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); }  //$NON-NLS-1$
7569
    case 657 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); }  //$NON-NLS-1$
6750
		    consumeWildcard3WithBounds();  
7570
		    consumeWildcard3WithBounds();  
6751
			break;
7571
			break;
6752
 
7572
 
6753
    case 608 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); }  //$NON-NLS-1$
7573
    case 658 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); }  //$NON-NLS-1$
6754
		    consumeWildcardBounds3Extends();  
7574
		    consumeWildcardBounds3Extends();  
6755
			break;
7575
			break;
6756
 
7576
 
6757
    case 609 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); }  //$NON-NLS-1$
7577
    case 659 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); }  //$NON-NLS-1$
6758
		    consumeWildcardBounds3Super();  
7578
		    consumeWildcardBounds3Super();  
6759
			break;
7579
			break;
6760
 
7580
 
6761
    case 610 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); }  //$NON-NLS-1$
7581
    case 660 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); }  //$NON-NLS-1$
7582
		    consumeZeroTypeAnnotations(true);  
7583
			break;
7584
 
7585
    case 661 : if (DEBUG) { System.out.println("TypeParameterHeader ::= PushZeroTypeAnnotations..."); }  //$NON-NLS-1$
6762
		    consumeTypeParameterHeader();  
7586
		    consumeTypeParameterHeader();  
6763
			break;
7587
			break;
6764
 
7588
 
6765
    case 611 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); }  //$NON-NLS-1$
7589
    case 662 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotations Identifier"); }  //$NON-NLS-1$
7590
		    consumeTypeParameterHeader();  
7591
			break;
7592
 
7593
    case 663 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); }  //$NON-NLS-1$
6766
		    consumeTypeParameters();  
7594
		    consumeTypeParameters();  
6767
			break;
7595
			break;
6768
 
7596
 
6769
    case 613 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
7597
    case 665 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
6770
		    consumeTypeParameterList();  
7598
		    consumeTypeParameterList();  
6771
			break;
7599
			break;
6772
 
7600
 
6773
    case 615 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7601
    case 667 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6774
		    consumeTypeParameterWithExtends();  
7602
		    consumeTypeParameterWithExtends();  
6775
			break;
7603
			break;
6776
 
7604
 
6777
    case 616 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7605
    case 668 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6778
		    consumeTypeParameterWithExtendsAndBounds();  
7606
		    consumeTypeParameterWithExtendsAndBounds();  
6779
			break;
7607
			break;
6780
 
7608
 
6781
    case 618 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); }  //$NON-NLS-1$
7609
    case 670 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); }  //$NON-NLS-1$
6782
		    consumeAdditionalBoundList();  
7610
		    consumeAdditionalBoundList();  
6783
			break;
7611
			break;
6784
 
7612
 
6785
    case 619 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); }  //$NON-NLS-1$
7613
    case 671 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); }  //$NON-NLS-1$
6786
		    consumeAdditionalBound();  
7614
		    consumeAdditionalBound();  
6787
			break;
7615
			break;
6788
 
7616
 
6789
    case 621 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
7617
    case 673 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
6790
		    consumeTypeParameterList1();  
7618
		    consumeTypeParameterList1();  
6791
			break;
7619
			break;
6792
 
7620
 
6793
    case 622 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); }  //$NON-NLS-1$
7621
    case 674 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); }  //$NON-NLS-1$
6794
		    consumeTypeParameter1();  
7622
		    consumeTypeParameter1();  
6795
			break;
7623
			break;
6796
 
7624
 
6797
    case 623 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7625
    case 675 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6798
		    consumeTypeParameter1WithExtends();  
7626
		    consumeTypeParameter1WithExtends();  
6799
			break;
7627
			break;
6800
 
7628
 
6801
    case 624 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7629
    case 676 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6802
		    consumeTypeParameter1WithExtendsAndBounds();  
7630
		    consumeTypeParameter1WithExtendsAndBounds();  
6803
			break;
7631
			break;
6804
 
7632
 
6805
    case 626 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); }  //$NON-NLS-1$
7633
    case 678 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); }  //$NON-NLS-1$
6806
		    consumeAdditionalBoundList1();  
7634
		    consumeAdditionalBoundList1();  
6807
			break;
7635
			break;
6808
 
7636
 
6809
    case 627 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); }  //$NON-NLS-1$
7637
    case 679 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); }  //$NON-NLS-1$
6810
		    consumeAdditionalBound1();  
7638
		    consumeAdditionalBound1();  
6811
			break;
7639
			break;
6812
 
7640
 
6813
    case 633 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); }  //$NON-NLS-1$
7641
    case 685 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); }  //$NON-NLS-1$
6814
		    consumeUnaryExpression(OperatorIds.PLUS);  
7642
		    consumeUnaryExpression(OperatorIds.PLUS);  
6815
			break;
7643
			break;
6816
 
7644
 
6817
    case 634 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); }  //$NON-NLS-1$
7645
    case 686 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); }  //$NON-NLS-1$
6818
		    consumeUnaryExpression(OperatorIds.MINUS);  
7646
		    consumeUnaryExpression(OperatorIds.MINUS);  
6819
			break;
7647
			break;
6820
 
7648
 
6821
    case 637 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); }  //$NON-NLS-1$
7649
    case 689 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); }  //$NON-NLS-1$
6822
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
7650
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
6823
			break;
7651
			break;
6824
 
7652
 
6825
    case 638 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); }  //$NON-NLS-1$
7653
    case 690 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); }  //$NON-NLS-1$
6826
		    consumeUnaryExpression(OperatorIds.NOT);  
7654
		    consumeUnaryExpression(OperatorIds.NOT);  
6827
			break;
7655
			break;
6828
 
7656
 
6829
    case 641 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
7657
    case 693 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
6830
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
7658
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
6831
			break;
7659
			break;
6832
 
7660
 
6833
    case 642 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); }  //$NON-NLS-1$
7661
    case 694 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); }  //$NON-NLS-1$
6834
		    consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);  
7662
		    consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);  
6835
			break;
7663
			break;
6836
 
7664
 
6837
    case 643 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
7665
    case 695 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
6838
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
7666
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
6839
			break;
7667
			break;
6840
 
7668
 
6841
    case 644 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); }  //$NON-NLS-1$
7669
    case 696 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); }  //$NON-NLS-1$
6842
		    consumeBinaryExpressionWithName(OperatorIds.DIVIDE);  
7670
		    consumeBinaryExpressionWithName(OperatorIds.DIVIDE);  
6843
			break;
7671
			break;
6844
 
7672
 
6845
    case 645 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
7673
    case 697 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
6846
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
7674
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
6847
			break;
7675
			break;
6848
 
7676
 
6849
    case 646 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); }  //$NON-NLS-1$
7677
    case 698 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); }  //$NON-NLS-1$
6850
		    consumeBinaryExpressionWithName(OperatorIds.REMAINDER);  
7678
		    consumeBinaryExpressionWithName(OperatorIds.REMAINDER);  
6851
			break;
7679
			break;
6852
 
7680
 
6853
    case 648 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
7681
    case 700 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
6854
		    consumeBinaryExpression(OperatorIds.PLUS);  
7682
		    consumeBinaryExpression(OperatorIds.PLUS);  
6855
			break;
7683
			break;
6856
 
7684
 
6857
    case 649 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); }  //$NON-NLS-1$
7685
    case 701 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); }  //$NON-NLS-1$
6858
		    consumeBinaryExpressionWithName(OperatorIds.PLUS);  
7686
		    consumeBinaryExpressionWithName(OperatorIds.PLUS);  
6859
			break;
7687
			break;
6860
 
7688
 
6861
    case 650 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
7689
    case 702 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
6862
		    consumeBinaryExpression(OperatorIds.MINUS);  
7690
		    consumeBinaryExpression(OperatorIds.MINUS);  
6863
			break;
7691
			break;
6864
 
7692
 
6865
    case 651 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); }  //$NON-NLS-1$
7693
    case 703 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); }  //$NON-NLS-1$
6866
		    consumeBinaryExpressionWithName(OperatorIds.MINUS);  
7694
		    consumeBinaryExpressionWithName(OperatorIds.MINUS);  
6867
			break;
7695
			break;
6868
 
7696
 
6869
    case 653 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
7697
    case 705 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
6870
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
7698
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
6871
			break;
7699
			break;
6872
 
7700
 
6873
    case 654 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); }  //$NON-NLS-1$
7701
    case 706 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); }  //$NON-NLS-1$
6874
		    consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);  
7702
		    consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);  
6875
			break;
7703
			break;
6876
 
7704
 
6877
    case 655 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
7705
    case 707 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
6878
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
7706
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
6879
			break;
7707
			break;
6880
 
7708
 
6881
    case 656 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); }  //$NON-NLS-1$
7709
    case 708 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); }  //$NON-NLS-1$
6882
		    consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);  
7710
		    consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);  
6883
			break;
7711
			break;
6884
 
7712
 
6885
    case 657 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
7713
    case 709 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
6886
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
7714
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
6887
			break;
7715
			break;
6888
 
7716
 
6889
    case 658 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); }  //$NON-NLS-1$
7717
    case 710 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); }  //$NON-NLS-1$
6890
		    consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
7718
		    consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
6891
			break;
7719
			break;
6892
 
7720
 
6893
    case 660 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
7721
    case 712 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
6894
		    consumeBinaryExpression(OperatorIds.LESS);  
7722
		    consumeBinaryExpression(OperatorIds.LESS);  
6895
			break;
7723
			break;
6896
 
7724
 
6897
    case 661 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); }  //$NON-NLS-1$
7725
    case 713 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); }  //$NON-NLS-1$
6898
		    consumeBinaryExpressionWithName(OperatorIds.LESS);  
7726
		    consumeBinaryExpressionWithName(OperatorIds.LESS);  
6899
			break;
7727
			break;
6900
 
7728
 
6901
    case 662 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
7729
    case 714 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
6902
		    consumeBinaryExpression(OperatorIds.GREATER);  
7730
		    consumeBinaryExpression(OperatorIds.GREATER);  
6903
			break;
7731
			break;
6904
 
7732
 
6905
    case 663 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); }  //$NON-NLS-1$
7733
    case 715 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); }  //$NON-NLS-1$
6906
		    consumeBinaryExpressionWithName(OperatorIds.GREATER);  
7734
		    consumeBinaryExpressionWithName(OperatorIds.GREATER);  
6907
			break;
7735
			break;
6908
 
7736
 
6909
    case 664 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
7737
    case 716 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
6910
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
7738
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
6911
			break;
7739
			break;
6912
 
7740
 
6913
    case 665 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); }  //$NON-NLS-1$
7741
    case 717 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); }  //$NON-NLS-1$
6914
		    consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);  
7742
		    consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);  
6915
			break;
7743
			break;
6916
 
7744
 
6917
    case 666 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
7745
    case 718 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
6918
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
7746
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
6919
			break;
7747
			break;
6920
 
7748
 
6921
    case 667 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); }  //$NON-NLS-1$
7749
    case 719 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); }  //$NON-NLS-1$
6922
		    consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);  
7750
		    consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);  
6923
			break;
7751
			break;
6924
 
7752
 
6925
    case 669 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); }  //$NON-NLS-1$
7753
    case 721 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); }  //$NON-NLS-1$
6926
		    consumeInstanceOfExpressionWithName();  
7754
		    consumeInstanceOfExpressionWithName();  
6927
			break;
7755
			break;
6928
 
7756
 
6929
    case 670 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); }  //$NON-NLS-1$
7757
    case 722 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); }  //$NON-NLS-1$
6930
		    consumeInstanceOfExpression();  
7758
		    consumeInstanceOfExpression();  
6931
			break;
7759
			break;
6932
 
7760
 
6933
    case 672 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
7761
    case 724 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
6934
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
7762
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
6935
			break;
7763
			break;
6936
 
7764
 
6937
    case 673 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); }  //$NON-NLS-1$
7765
    case 725 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); }  //$NON-NLS-1$
6938
		    consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);  
7766
		    consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);  
6939
			break;
7767
			break;
6940
 
7768
 
6941
    case 674 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
7769
    case 726 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
6942
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
7770
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
6943
			break;
7771
			break;
6944
 
7772
 
6945
    case 675 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); }  //$NON-NLS-1$
7773
    case 727 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); }  //$NON-NLS-1$
6946
		    consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);  
7774
		    consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);  
6947
			break;
7775
			break;
6948
 
7776
 
6949
    case 677 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); }  //$NON-NLS-1$
7777
    case 729 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); }  //$NON-NLS-1$
6950
		    consumeBinaryExpression(OperatorIds.AND);  
7778
		    consumeBinaryExpression(OperatorIds.AND);  
6951
			break;
7779
			break;
6952
 
7780
 
6953
    case 678 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); }  //$NON-NLS-1$
7781
    case 730 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); }  //$NON-NLS-1$
6954
		    consumeBinaryExpressionWithName(OperatorIds.AND);  
7782
		    consumeBinaryExpressionWithName(OperatorIds.AND);  
6955
			break;
7783
			break;
6956
 
7784
 
6957
    case 680 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
7785
    case 732 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
6958
		    consumeBinaryExpression(OperatorIds.XOR);  
7786
		    consumeBinaryExpression(OperatorIds.XOR);  
6959
			break;
7787
			break;
6960
 
7788
 
6961
    case 681 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); }  //$NON-NLS-1$
7789
    case 733 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); }  //$NON-NLS-1$
6962
		    consumeBinaryExpressionWithName(OperatorIds.XOR);  
7790
		    consumeBinaryExpressionWithName(OperatorIds.XOR);  
6963
			break;
7791
			break;
6964
 
7792
 
6965
    case 683 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
7793
    case 735 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
6966
		    consumeBinaryExpression(OperatorIds.OR);  
7794
		    consumeBinaryExpression(OperatorIds.OR);  
6967
			break;
7795
			break;
6968
 
7796
 
6969
    case 684 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); }  //$NON-NLS-1$
7797
    case 736 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); }  //$NON-NLS-1$
6970
		    consumeBinaryExpressionWithName(OperatorIds.OR);  
7798
		    consumeBinaryExpressionWithName(OperatorIds.OR);  
6971
			break;
7799
			break;
6972
 
7800
 
6973
    case 686 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); }  //$NON-NLS-1$
7801
    case 738 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); }  //$NON-NLS-1$
6974
		    consumeBinaryExpression(OperatorIds.AND_AND);  
7802
		    consumeBinaryExpression(OperatorIds.AND_AND);  
6975
			break;
7803
			break;
6976
 
7804
 
6977
    case 687 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); }  //$NON-NLS-1$
7805
    case 739 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); }  //$NON-NLS-1$
6978
		    consumeBinaryExpressionWithName(OperatorIds.AND_AND);  
7806
		    consumeBinaryExpressionWithName(OperatorIds.AND_AND);  
6979
			break;
7807
			break;
6980
 
7808
 
6981
    case 689 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); }  //$NON-NLS-1$
7809
    case 741 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); }  //$NON-NLS-1$
6982
		    consumeBinaryExpression(OperatorIds.OR_OR);  
7810
		    consumeBinaryExpression(OperatorIds.OR_OR);  
6983
			break;
7811
			break;
6984
 
7812
 
6985
    case 690 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); }  //$NON-NLS-1$
7813
    case 742 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); }  //$NON-NLS-1$
6986
		    consumeBinaryExpressionWithName(OperatorIds.OR_OR);  
7814
		    consumeBinaryExpressionWithName(OperatorIds.OR_OR);  
6987
			break;
7815
			break;
6988
 
7816
 
6989
    case 692 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); }  //$NON-NLS-1$
7817
    case 744 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); }  //$NON-NLS-1$
6990
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
7818
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
6991
			break;
7819
			break;
6992
 
7820
 
6993
    case 693 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); }  //$NON-NLS-1$
7821
    case 745 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); }  //$NON-NLS-1$
6994
		    consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;  
7822
		    consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;  
6995
			break;
7823
			break;
6996
 
7824
 
6997
    case 697 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
7825
    case 749 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
6998
		    consumeAnnotationTypeDeclarationHeaderName() ;  
7826
		    consumeAnnotationTypeDeclarationHeaderName() ;  
6999
			break;
7827
			break;
7000
 
7828
 
7001
    case 698 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
7829
    case 750 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
7002
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
7830
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
7003
			break;
7831
			break;
7004
 
7832
 
7005
    case 699 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
7833
    case 751 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
7006
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
7834
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
7007
			break;
7835
			break;
7008
 
7836
 
7009
    case 700 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
7837
    case 752 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
7010
		    consumeAnnotationTypeDeclarationHeaderName() ;  
7838
		    consumeAnnotationTypeDeclarationHeaderName() ;  
7011
			break;
7839
			break;
7012
 
7840
 
7013
    case 701 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); }  //$NON-NLS-1$
7841
    case 753 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); }  //$NON-NLS-1$
7014
		    consumeAnnotationTypeDeclarationHeader() ;  
7842
		    consumeAnnotationTypeDeclarationHeader() ;  
7015
			break;
7843
			break;
7016
 
7844
 
7017
    case 702 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); }  //$NON-NLS-1$
7845
    case 754 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); }  //$NON-NLS-1$
7018
		    consumeAnnotationTypeDeclaration() ;  
7846
		    consumeAnnotationTypeDeclaration() ;  
7019
			break;
7847
			break;
7020
 
7848
 
7021
    case 704 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); }  //$NON-NLS-1$
7849
    case 756 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); }  //$NON-NLS-1$
7022
		    consumeEmptyAnnotationTypeMemberDeclarationsopt() ;  
7850
		    consumeEmptyAnnotationTypeMemberDeclarationsopt() ;  
7023
			break;
7851
			break;
7024
 
7852
 
7025
    case 705 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7853
    case 757 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7026
		    consumeAnnotationTypeMemberDeclarationsopt() ;  
7854
		    consumeAnnotationTypeMemberDeclarationsopt() ;  
7027
			break;
7855
			break;
7028
 
7856
 
7029
    case 707 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); }  //$NON-NLS-1$
7857
    case 759 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); }  //$NON-NLS-1$
7030
		    consumeAnnotationTypeMemberDeclarations() ;  
7858
		    consumeAnnotationTypeMemberDeclarations() ;  
7031
			break;
7859
			break;
7032
 
7860
 
7033
    case 708 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); }  //$NON-NLS-1$
7861
    case 760 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); }  //$NON-NLS-1$
7034
		    consumeMethodHeaderNameWithTypeParameters(true);  
7862
		    consumeMethodHeaderNameWithTypeParameters(true);  
7035
			break;
7863
			break;
7036
 
7864
 
7037
    case 709 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); }  //$NON-NLS-1$
7865
    case 761 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type0..."); }  //$NON-NLS-1$
7038
		    consumeMethodHeaderName(true);  
7866
		    consumeMethodHeaderName(true);  
7039
			break;
7867
			break;
7040
 
7868
 
7041
    case 710 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); }  //$NON-NLS-1$
7869
    case 762 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); }  //$NON-NLS-1$
7042
		    consumeEmptyMethodHeaderDefaultValue() ;  
7870
		    consumeEmptyMethodHeaderDefaultValue() ;  
7043
			break;
7871
			break;
7044
 
7872
 
7045
    case 711 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); }  //$NON-NLS-1$
7873
    case 763 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); }  //$NON-NLS-1$
7046
		    consumeMethodHeaderDefaultValue();  
7874
		    consumeMethodHeaderDefaultValue();  
7047
			break;
7875
			break;
7048
 
7876
 
7049
    case 712 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); }  //$NON-NLS-1$
7877
    case 764 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); }  //$NON-NLS-1$
7050
		    consumeMethodHeader();  
7878
		    consumeMethodHeader();  
7051
			break;
7879
			break;
7052
 
7880
 
7053
    case 713 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); }  //$NON-NLS-1$
7881
    case 765 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); }  //$NON-NLS-1$
7054
		    consumeAnnotationTypeMemberDeclaration() ;  
7882
		    consumeAnnotationTypeMemberDeclaration() ;  
7055
			break;
7883
			break;
7056
 
7884
 
7057
    case 721 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); }  //$NON-NLS-1$
7885
    case 773 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); }  //$NON-NLS-1$
7058
		    consumeAnnotationName() ;  
7886
		    consumeAnnotationName() ;  
7059
			break;
7887
			break;
7060
 
7888
 
7061
    case 722 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
7889
    case 774 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
7062
		    consumeNormalAnnotation() ;  
7890
		    consumeNormalAnnotation() ;  
7063
			break;
7891
			break;
7064
 
7892
 
7065
    case 723 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); }  //$NON-NLS-1$
7893
    case 775 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); }  //$NON-NLS-1$
7066
		    consumeEmptyMemberValuePairsopt() ;  
7894
		    consumeEmptyMemberValuePairsopt() ;  
7067
			break;
7895
			break;
7068
 
7896
 
7069
    case 726 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); }  //$NON-NLS-1$
7897
    case 778 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); }  //$NON-NLS-1$
7070
		    consumeMemberValuePairs() ;  
7898
		    consumeMemberValuePairs() ;  
7071
			break;
7899
			break;
7072
 
7900
 
7073
    case 727 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); }  //$NON-NLS-1$
7901
    case 779 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); }  //$NON-NLS-1$
7074
		    consumeMemberValuePair() ;  
7902
		    consumeMemberValuePair() ;  
7075
			break;
7903
			break;
7076
 
7904
 
7077
    case 728 : if (DEBUG) { System.out.println("EnterMemberValue ::="); }  //$NON-NLS-1$
7905
    case 780 : if (DEBUG) { System.out.println("EnterMemberValue ::="); }  //$NON-NLS-1$
7078
		    consumeEnterMemberValue() ;  
7906
		    consumeEnterMemberValue() ;  
7079
			break;
7907
			break;
7080
 
7908
 
7081
    case 729 : if (DEBUG) { System.out.println("ExitMemberValue ::="); }  //$NON-NLS-1$
7909
    case 781 : if (DEBUG) { System.out.println("ExitMemberValue ::="); }  //$NON-NLS-1$
7082
		    consumeExitMemberValue() ;  
7910
		    consumeExitMemberValue() ;  
7083
			break;
7911
			break;
7084
 
7912
 
7085
    case 731 : if (DEBUG) { System.out.println("MemberValue ::= Name"); }  //$NON-NLS-1$
7913
    case 783 : if (DEBUG) { System.out.println("MemberValue ::= Name"); }  //$NON-NLS-1$
7086
		    consumeMemberValueAsName() ;  
7914
		    consumeMemberValueAsName() ;  
7087
			break;
7915
			break;
7088
 
7916
 
7089
    case 734 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7917
    case 786 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7090
		    consumeMemberValueArrayInitializer() ;  
7918
		    consumeMemberValueArrayInitializer() ;  
7091
			break;
7919
			break;
7092
 
7920
 
7093
    case 735 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7921
    case 787 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7094
		    consumeMemberValueArrayInitializer() ;  
7922
		    consumeMemberValueArrayInitializer() ;  
7095
			break;
7923
			break;
7096
 
7924
 
7097
    case 736 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7925
    case 788 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7098
		    consumeEmptyMemberValueArrayInitializer() ;  
7926
		    consumeEmptyMemberValueArrayInitializer() ;  
7099
			break;
7927
			break;
7100
 
7928
 
7101
    case 737 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7929
    case 789 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7102
		    consumeEmptyMemberValueArrayInitializer() ;  
7930
		    consumeEmptyMemberValueArrayInitializer() ;  
7103
			break;
7931
			break;
7104
 
7932
 
7105
    case 738 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); }  //$NON-NLS-1$
7933
    case 790 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); }  //$NON-NLS-1$
7106
		    consumeEnterMemberValueArrayInitializer() ;  
7934
		    consumeEnterMemberValueArrayInitializer() ;  
7107
			break;
7935
			break;
7108
 
7936
 
7109
    case 740 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); }  //$NON-NLS-1$
7937
    case 792 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); }  //$NON-NLS-1$
7110
		    consumeMemberValues() ;  
7938
		    consumeMemberValues() ;  
7111
			break;
7939
			break;
7112
 
7940
 
7113
    case 741 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); }  //$NON-NLS-1$
7941
    case 793 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); }  //$NON-NLS-1$
7114
		    consumeMarkerAnnotation() ;  
7942
		    consumeMarkerAnnotation() ;  
7115
			break;
7943
			break;
7116
 
7944
 
7117
    case 742 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); }  //$NON-NLS-1$
7945
    case 794 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); }  //$NON-NLS-1$
7118
		    consumeSingleMemberAnnotationMemberValue() ;  
7946
		    consumeSingleMemberAnnotationMemberValue() ;  
7119
			break;
7947
			break;
7120
 
7948
 
7121
    case 743 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
7949
    case 795 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
7122
		    consumeSingleMemberAnnotation() ;  
7950
		    consumeSingleMemberAnnotation() ;  
7123
			break;
7951
			break;
7124
 
7952
 
7125
    case 744 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); }  //$NON-NLS-1$
7953
    case 796 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); }  //$NON-NLS-1$
7126
		    consumeRecoveryMethodHeaderNameWithTypeParameters();  
7954
		    consumeRecoveryMethodHeaderNameWithTypeParameters();  
7127
			break;
7955
			break;
7128
 
7956
 
7129
    case 745 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); }  //$NON-NLS-1$
7957
    case 797 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type0..."); }  //$NON-NLS-1$
7130
		    consumeRecoveryMethodHeaderName();  
7958
		    consumeRecoveryMethodHeaderName();  
7131
			break;
7959
			break;
7132
 
7960
 
7133
    case 746 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
7961
    case 798 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
7134
		    consumeMethodHeader();  
7962
		    consumeMethodHeader();  
7135
			break;
7963
			break;
7136
 
7964
 
7137
    case 747 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
7965
    case 799 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
7138
		    consumeMethodHeader();  
7966
		    consumeMethodHeader();  
7139
			break;
7967
			break;
7140
 
7968
 
Lines 8287-8296 Link Here
8287
	pushOnGenericsStack(getTypeReference(0));
9115
	pushOnGenericsStack(getTypeReference(0));
8288
	this.intPtr--;
9116
	this.intPtr--;
8289
}
9117
}
9118
protected void consumeTypeArgumentReferenceType1WithTypeAnnotations() {
9119
	concatGenericsLists();
9120
	TypeReference typeReference = getUnannotatedTypeReference(0);
9121
	// copy from expression stack to type annotation stack
9122
	int length;
9123
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
9124
		System.arraycopy(
9125
				this.expressionStack,
9126
				(this.expressionPtr -= length) + 1,
9127
				typeReference.annotations = new Annotation[length],
9128
				0,
9129
				length);
9130
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
9131
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
9132
			typeReferenceSourceStart = this.modifiersSourceStart;
9133
		}
9134
		typeReference.bits |= ASTNode.HasTypeAnnotations;
9135
		typeReference.sourceStart = typeReferenceSourceStart;
9136
	}
9137
	pushOnGenericsStack(typeReference);
9138
	// remove the 0 pushed by ZeroTypeAnnotation
9139
	this.typeAnnotationLengthPtr--;
9140
	this.intPtr--;
9141
	if (this.modifiers != ClassFileConstants.AccDefault) {
9142
		problemReporter().invalidLocationForModifiers(typeReference);
9143
	}
9144
	resetModifiers();
9145
}
8290
protected void consumeTypeArgumentReferenceType2() {
9146
protected void consumeTypeArgumentReferenceType2() {
8291
	concatGenericsLists();
9147
	concatGenericsLists();
8292
	pushOnGenericsStack(getTypeReference(0));
9148
	pushOnGenericsStack(getTypeReference(0));
8293
	this.intPtr--;
9149
	this.intPtr--;
9150
}
9151
protected void consumeTypeArgumentReferenceType2WithTypeAnnotations() {
9152
	concatGenericsLists();
9153
	TypeReference typeReference = getUnannotatedTypeReference(0);
9154
	// copy from expression stack to type annotation stack
9155
	int length;
9156
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
9157
		System.arraycopy(
9158
				this.expressionStack,
9159
				(this.expressionPtr -= length) + 1,
9160
				typeReference.annotations = new Annotation[length],
9161
				0,
9162
				length);
9163
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
9164
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
9165
			typeReferenceSourceStart = this.modifiersSourceStart;
9166
		}
9167
		typeReference.bits |= ASTNode.HasTypeAnnotations;
9168
		typeReference.sourceStart = typeReferenceSourceStart;
9169
	}
9170
	pushOnGenericsStack(typeReference);
9171
	this.intPtr--;
9172
	if (this.modifiers != ClassFileConstants.AccDefault) {
9173
		problemReporter().invalidLocationForModifiers(typeReference);
9174
	}
9175
	resetModifiers();
8294
}
9176
}
8295
protected void consumeTypeArguments() {
9177
protected void consumeTypeArguments() {
8296
	concatGenericsLists();
9178
	concatGenericsLists();
Lines 8380-8385 Link Here
8380
	typeParameter.declarationSourceEnd = superType.sourceEnd;
9262
	typeParameter.declarationSourceEnd = superType.sourceEnd;
8381
	typeParameter.type = superType;
9263
	typeParameter.type = superType;
8382
	superType.bits |= ASTNode.IsSuperType;
9264
	superType.bits |= ASTNode.IsSuperType;
9265
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
8383
	this.genericsStack[this.genericsPtr] = typeParameter;
9266
	this.genericsStack[this.genericsPtr] = typeParameter;
8384
}
9267
}
8385
protected void consumeTypeParameter1WithExtendsAndBounds() {
9268
protected void consumeTypeParameter1WithExtendsAndBounds() {
Lines 8392-8406 Link Here
8392
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
9275
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
8393
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
9276
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
8394
	typeParameter.type = superType;
9277
	typeParameter.type = superType;
9278
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
8395
	superType.bits |= ASTNode.IsSuperType;
9279
	superType.bits |= ASTNode.IsSuperType;
8396
	typeParameter.bounds = bounds;
9280
	typeParameter.bounds = bounds;
8397
	for (int i = 0, max = bounds.length; i < max; i++) {
9281
	for (int i = 0, max = bounds.length; i < max; i++) {
8398
		bounds[i].bits |= ASTNode.IsSuperType;
9282
		TypeReference bound = bounds[i];
9283
		bound.bits |= ASTNode.IsSuperType;
9284
		typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
8399
	}
9285
	}
8400
}
9286
}
8401
protected void consumeTypeParameterHeader() {
9287
protected void consumeTypeParameterHeader() {
8402
	//TypeParameterHeader ::= Identifier
9288
	//TypeParameterHeader ::= Identifier
8403
	TypeParameter typeParameter = new TypeParameter();
9289
	TypeParameter typeParameter = new TypeParameter();
9290
	int length;
9291
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
9292
		System.arraycopy(
9293
				this.typeAnnotationStack,
9294
				(this.typeAnnotationPtr -= length) + 1,
9295
				typeParameter.annotations = new Annotation[length],
9296
				0,
9297
				length);
9298
		typeParameter.bits |= ASTNode.HasTypeAnnotations;
9299
	}
8404
	long pos = this.identifierPositionStack[this.identifierPtr];
9300
	long pos = this.identifierPositionStack[this.identifierPtr];
8405
	final int end = (int) pos;
9301
	final int end = (int) pos;
8406
	typeParameter.declarationSourceEnd = end;
9302
	typeParameter.declarationSourceEnd = end;
Lines 8452-8457 Link Here
8452
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
9348
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
8453
	typeParameter.declarationSourceEnd = superType.sourceEnd;
9349
	typeParameter.declarationSourceEnd = superType.sourceEnd;
8454
	typeParameter.type = superType;
9350
	typeParameter.type = superType;
9351
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
8455
	superType.bits |= ASTNode.IsSuperType;
9352
	superType.bits |= ASTNode.IsSuperType;
8456
}
9353
}
8457
protected void consumeTypeParameterWithExtendsAndBounds() {
9354
protected void consumeTypeParameterWithExtendsAndBounds() {
Lines 8463-8473 Link Here
8463
	TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
9360
	TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
8464
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
9361
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
8465
	typeParameter.type = superType;
9362
	typeParameter.type = superType;
9363
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
8466
	superType.bits |= ASTNode.IsSuperType;
9364
	superType.bits |= ASTNode.IsSuperType;
8467
	typeParameter.bounds = bounds;
9365
	typeParameter.bounds = bounds;
8468
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
9366
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
8469
	for (int i = 0, max = bounds.length; i < max; i++) {
9367
	for (int i = 0, max = bounds.length; i < max; i++) {
8470
		bounds[i].bits |= ASTNode.IsSuperType;
9368
		TypeReference bound = bounds[i];
9369
		bound.bits |= ASTNode.IsSuperType;
9370
		typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
8471
	}
9371
	}
8472
}
9372
}
8473
protected void consumeUnaryExpression(int op) {
9373
protected void consumeUnaryExpression(int op) {
Lines 8666-8671 Link Here
8666
	// Nothing to do
9566
	// Nothing to do
8667
	// The wildcard is created by the consumeWildcardBoundsExtends or by consumeWildcardBoundsSuper
9567
	// The wildcard is created by the consumeWildcardBoundsExtends or by consumeWildcardBoundsSuper
8668
}
9568
}
9569
8669
/**
9570
/**
8670
 * Given the current comment stack, answer whether some comment is available in a certain exclusive range
9571
 * Given the current comment stack, answer whether some comment is available in a certain exclusive range
8671
 *
9572
 *
Lines 8705-8716 Link Here
8705
	m.explicitDeclarations = c.explicitDeclarations;
9606
	m.explicitDeclarations = c.explicitDeclarations;
8706
	m.returnType = null;
9607
	m.returnType = null;
8707
	m.javadoc = c.javadoc;
9608
	m.javadoc = c.javadoc;
9609
	m.bits = c.bits;
8708
	return m;
9610
	return m;
8709
}
9611
}
8710
9612
8711
protected TypeReference copyDims(TypeReference typeRef, int dim) {
9613
protected TypeReference copyDims(TypeReference typeRef, int dim) {
8712
	return typeRef.copyDims(dim);
9614
	return typeRef.copyDims(dim);
8713
}
9615
}
9616
9617
protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation[][]annotationsOnDimensions) {
9618
	return typeRef.copyDims(dim, annotationsOnDimensions);
9619
}
9620
8714
protected FieldDeclaration createFieldDeclaration(char[] fieldDeclarationName, int sourceStart, int sourceEnd) {
9621
protected FieldDeclaration createFieldDeclaration(char[] fieldDeclarationName, int sourceStart, int sourceEnd) {
8715
	return new FieldDeclaration(fieldDeclarationName, sourceStart, sourceEnd);
9622
	return new FieldDeclaration(fieldDeclarationName, sourceStart, sourceEnd);
8716
}
9623
}
Lines 9192-9204 Link Here
9192
	return exp;
10099
	return exp;
9193
}
10100
}
9194
protected TypeReference getTypeReference(int dim) {
10101
protected TypeReference getTypeReference(int dim) {
10102
	TypeReference ref = getUnannotatedTypeReference(dim);
10103
	int length;
10104
	if (this.typeAnnotationLengthPtr >= 0
10105
			&& (length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
10106
		//	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
10107
10108
		System.arraycopy(
10109
				this.typeAnnotationStack,
10110
				(this.typeAnnotationPtr -= length) + 1,
10111
				ref.annotations = new Annotation[length],
10112
				0,
10113
				length);
10114
		ref.sourceStart = ref.annotations[0].sourceStart;
10115
		ref.bits |= ASTNode.HasTypeAnnotations;
10116
	}
10117
	return ref;
10118
	}
10119
protected TypeReference getUnannotatedTypeReference(int dim) {
9195
	/* build a Reference on a variable that may be qualified or not
10120
	/* build a Reference on a variable that may be qualified or not
9196
	 This variable is a type reference and dim will be its dimensions*/
10121
	 This variable is a type reference and dim will be its dimensions*/
9197
10122
9198
	TypeReference ref;
10123
	TypeReference ref;
10124
	Annotation [][] annotationsOnDimensions = null;
9199
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
10125
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
9200
	if (length < 0) { //flag for precompiled type reference on base types
10126
	if (length < 0) { //flag for precompiled type reference on base types
9201
		ref = TypeReference.baseTypeReference(-length, dim);
10127
		if (dim > 0) {
10128
			annotationsOnDimensions = getAnnotationsOnDimensions(dim);
10129
		}
10130
		ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
9202
		ref.sourceStart = this.intStack[this.intPtr--];
10131
		ref.sourceStart = this.intStack[this.intPtr--];
9203
		if (dim == 0) {
10132
		if (dim == 0) {
9204
			ref.sourceEnd = this.intStack[this.intPtr--];
10133
			ref.sourceEnd = this.intStack[this.intPtr--];
Lines 9220-9231 Link Here
9220
						this.identifierStack[this.identifierPtr],
10149
						this.identifierStack[this.identifierPtr],
9221
						this.identifierPositionStack[this.identifierPtr--]);
10150
						this.identifierPositionStack[this.identifierPtr--]);
9222
			} else {
10151
			} else {
10152
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
9223
				ref =
10153
				ref =
9224
					new ArrayTypeReference(
10154
					new ArrayTypeReference(
9225
						this.identifierStack[this.identifierPtr],
10155
						this.identifierStack[this.identifierPtr],
9226
						dim,
10156
						dim,
10157
						annotationsOnDimensions,
9227
						this.identifierPositionStack[this.identifierPtr--]);
10158
						this.identifierPositionStack[this.identifierPtr--]);
9228
				ref.sourceEnd = this.endPosition;
10159
				ref.sourceEnd = this.endPosition;
10160
				if (annotationsOnDimensions != null) {
10161
					ref.bits |= ASTNode.HasTypeAnnotations;
10162
				}
9229
			}
10163
			}
9230
		} else {
10164
		} else {
9231
			this.genericsLengthPtr--;
10165
			this.genericsLengthPtr--;
Lines 9243-9256 Link Here
9243
			if (dim == 0) {
10177
			if (dim == 0) {
9244
				ref = new QualifiedTypeReference(tokens, positions);
10178
				ref = new QualifiedTypeReference(tokens, positions);
9245
			} else {
10179
			} else {
9246
				ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
10180
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
10181
				ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions);
9247
				ref.sourceEnd = this.endPosition;
10182
				ref.sourceEnd = this.endPosition;
10183
				ref.bits |= ASTNode.HasTypeAnnotations;
9248
			}
10184
			}
9249
		}
10185
		}
9250
	}
10186
	}
9251
	return ref;
10187
	return ref;
9252
}
10188
}
9253
protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
10189
protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
10190
	Annotation[][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
9254
	if (identifierLength == 1 && numberOfIdentifiers == 1) {
10191
	if (identifierLength == 1 && numberOfIdentifiers == 1) {
9255
		int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
10192
		int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
9256
		TypeReference[] typeArguments = null;
10193
		TypeReference[] typeArguments = null;
Lines 9261-9267 Link Here
9261
			this.genericsPtr -= currentTypeArgumentsLength;
10198
			this.genericsPtr -= currentTypeArgumentsLength;
9262
			System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments, 0, currentTypeArgumentsLength);
10199
			System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments, 0, currentTypeArgumentsLength);
9263
		}
10200
		}
9264
		ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, this.identifierPositionStack[this.identifierPtr--]);
10201
		ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, annotationsOnDimensions, this.identifierPositionStack[this.identifierPtr--]);
9265
		if (dim != 0) {
10202
		if (dim != 0) {
9266
			parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition;
10203
			parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition;
9267
		}
10204
		}
Lines 9303-9309 Link Here
9303
				currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--];
10240
				currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--];
9304
			}
10241
			}
9305
		}
10242
		}
9306
		ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions);
10243
		ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, annotationsOnDimensions, positions);
9307
		if (dim != 0) {
10244
		if (dim != 0) {
9308
			parameterizedQualifiedTypeReference.sourceEnd = this.endStatementPosition;
10245
			parameterizedQualifiedTypeReference.sourceEnd = this.endStatementPosition;
9309
		}
10246
		}
Lines 9535-9540 Link Here
9535
	this.astLengthPtr = -1;
10472
	this.astLengthPtr = -1;
9536
	this.expressionPtr = -1;
10473
	this.expressionPtr = -1;
9537
	this.expressionLengthPtr = -1;
10474
	this.expressionLengthPtr = -1;
10475
	this.unattachedAnnotationPtr = -1;
10476
	this.typeAnnotationLengthPtr = -1;
10477
	this.typeAnnotationPtr = -1;
9538
	this.identifierPtr = -1;
10478
	this.identifierPtr = -1;
9539
	this.identifierLengthPtr	= -1;
10479
	this.identifierLengthPtr	= -1;
9540
	this.intPtr = -1;
10480
	this.intPtr = -1;
Lines 10755-10760 Link Here
10755
	}
11695
	}
10756
	this.astLengthStack[this.astLengthPtr] = 1;
11696
	this.astLengthStack[this.astLengthPtr] = 1;
10757
}
11697
}
11698
protected void pushOnTypeAnnotationStack(Annotation annotation) {
11699
11700
	int stackLength = this.typeAnnotationStack.length;
11701
	if (++this.typeAnnotationPtr >= stackLength) {
11702
		System.arraycopy(
11703
			this.typeAnnotationStack, 0,
11704
			this.typeAnnotationStack = new Annotation[stackLength + TypeAnnotationStackIncrement], 0,
11705
			stackLength);
11706
	}
11707
	this.typeAnnotationStack[this.typeAnnotationPtr] = annotation;
11708
11709
	stackLength = this.typeAnnotationLengthStack.length;
11710
	if (++this.typeAnnotationLengthPtr >= stackLength) {
11711
		System.arraycopy(
11712
			this.typeAnnotationLengthStack, 0,
11713
			this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0,
11714
			stackLength);
11715
	}
11716
	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = 1;
11717
}
11718
protected void pushOnTypeAnnotationLengthStack(int pos) {
11719
11720
	int stackLength = this.typeAnnotationLengthStack.length;
11721
	if (++this.typeAnnotationLengthPtr >= stackLength) {
11722
		System.arraycopy(
11723
			this.typeAnnotationLengthStack, 0,
11724
			this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0,
11725
			stackLength);
11726
	}
11727
	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = pos;
11728
}
10758
protected void pushOnExpressionStack(Expression expr) {
11729
protected void pushOnExpressionStack(Expression expr) {
10759
11730
10760
	int stackLength = this.expressionStack.length;
11731
	int stackLength = this.expressionStack.length;
Lines 11178-11183 Link Here
11178
	this.astLengthPtr = -1;
12149
	this.astLengthPtr = -1;
11179
	this.expressionPtr = -1;
12150
	this.expressionPtr = -1;
11180
	this.expressionLengthPtr = -1;
12151
	this.expressionLengthPtr = -1;
12152
	this.unattachedAnnotationPtr = -1;
12153
	this.typeAnnotationLengthPtr = -1;
12154
	this.typeAnnotationPtr = -1;
11181
	this.identifierPtr = -1;
12155
	this.identifierPtr = -1;
11182
	this.identifierLengthPtr	= -1;
12156
	this.identifierLengthPtr	= -1;
11183
	this.intPtr = -1;
12157
	this.intPtr = -1;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java (-11 / +15 lines)
Lines 9-14 Link Here
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
11
 * 
12
 * This is an implementation of an early-draft specification developed under the Java
13
 * Community Process (JCP) and is made available for testing and evaluation purposes
14
 * only. The code is not compatible with any specification of the JCP.
15
 * 
12
 * Contributors:
16
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
17
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
18
 *******************************************************************************/
Lines 19-39 Link Here
19
public interface ParserBasicInformation {
23
public interface ParserBasicInformation {
20
24
21
	int ERROR_SYMBOL = 115,
25
	int ERROR_SYMBOL = 115,
22
		MAX_NAME_LENGTH = 41,
26
		MAX_NAME_LENGTH = 50,
23
		NUM_STATES = 1033,
27
		NUM_STATES = 1115,
24
28
25
		NT_OFFSET = 115,
29
		NT_OFFSET = 115,
26
		SCOPE_UBOUND = 144,
30
		SCOPE_UBOUND = 246,
27
		SCOPE_SIZE = 145,
31
		SCOPE_SIZE = 247,
28
		LA_STATE_OFFSET = 13788,
32
		LA_STATE_OFFSET = 16257,
29
		MAX_LA = 1,
33
		MAX_LA = 1,
30
		NUM_RULES = 747,
34
		NUM_RULES = 799,
31
		NUM_TERMINALS = 115,
35
		NUM_TERMINALS = 115,
32
		NUM_NON_TERMINALS = 335,
36
		NUM_NON_TERMINALS = 356,
33
		NUM_SYMBOLS = 450,
37
		NUM_SYMBOLS = 471,
34
		START_STATE = 939,
38
		START_STATE = 1110,
35
		EOFT_SYMBOL = 67,
39
		EOFT_SYMBOL = 67,
36
		EOLT_SYMBOL = 67,
40
		EOLT_SYMBOL = 67,
37
		ACCEPT_ACTION = 13787,
41
		ACCEPT_ACTION = 16256,
38
		ERROR_ACTION = 13788;
42
		ERROR_ACTION = 16257;
39
}
43
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java (-92 / +96 lines)
Lines 10-15 Link Here
10
 * only. The code is not compatible with any specification of the JCP.
10
 * only. The code is not compatible with any specification of the JCP.
11
 *
11
 *
12
 *
12
 *
13
 * This is an implementation of an early-draft specification developed under the Java
14
 * Community Process (JCP) and is made available for testing and evaluation purposes
15
 * only. The code is not compatible with any specification of the JCP.
16
 * 
13
 * Contributors:
17
 * Contributors:
14
 *     IBM Corporation - initial API and implementation
18
 *     IBM Corporation - initial API and implementation
15
 *******************************************************************************/
19
 *******************************************************************************/
Lines 39-156 Link Here
39
		TokenNameCOMMENT_BLOCK = 1002,
43
		TokenNameCOMMENT_BLOCK = 1002,
40
		TokenNameCOMMENT_JAVADOC = 1003;
44
		TokenNameCOMMENT_JAVADOC = 1003;
41
45
42
	int TokenNameIdentifier = 22,
46
	int TokenNameIdentifier = 20,
43
		TokenNameabstract = 58,
47
		TokenNameabstract = 33,
44
		TokenNameassert = 89,
48
		TokenNameassert = 79,
45
		TokenNameboolean = 33,
49
		TokenNameboolean = 43,
46
		TokenNamebreak = 90,
50
		TokenNamebreak = 80,
47
		TokenNamebyte = 34,
51
		TokenNamebyte = 44,
48
		TokenNamecase = 106,
52
		TokenNamecase = 107,
49
		TokenNamecatch = 104,
53
		TokenNamecatch = 104,
50
		TokenNamechar = 35,
54
		TokenNamechar = 45,
51
		TokenNameclass = 76,
55
		TokenNameclass = 74,
52
		TokenNamecontinue = 91,
56
		TokenNamecontinue = 81,
53
		TokenNameconst = 113,
57
		TokenNameconst = 113,
54
		TokenNamedefault = 100,
58
		TokenNamedefault = 89,
55
		TokenNamedo = 92,
59
		TokenNamedo = 82,
56
		TokenNamedouble = 36,
60
		TokenNamedouble = 46,
57
		TokenNameelse = 108,
61
		TokenNameelse = 109,
58
		TokenNameenum = 102,
62
		TokenNameenum = 105,
59
		TokenNameextends = 103,
63
		TokenNameextends = 103,
60
		TokenNamefalse = 46,
64
		TokenNamefalse = 57,
61
		TokenNamefinal = 59,
65
		TokenNamefinal = 34,
62
		TokenNamefinally = 107,
66
		TokenNamefinally = 108,
63
		TokenNamefloat = 37,
67
		TokenNamefloat = 47,
64
		TokenNamefor = 93,
68
		TokenNamefor = 83,
65
		TokenNamegoto = 114,
69
		TokenNamegoto = 114,
66
		TokenNameif = 94,
70
		TokenNameif = 84,
67
		TokenNameimplements = 111,
71
		TokenNameimplements = 112,
68
		TokenNameimport = 105,
72
		TokenNameimport = 106,
69
		TokenNameinstanceof = 17,
73
		TokenNameinstanceof = 18,
70
		TokenNameint = 38,
74
		TokenNameint = 48,
71
		TokenNameinterface = 99,
75
		TokenNameinterface = 90,
72
		TokenNamelong = 39,
76
		TokenNamelong = 49,
73
		TokenNamenative = 60,
77
		TokenNamenative = 35,
74
		TokenNamenew = 44,
78
		TokenNamenew = 56,
75
		TokenNamenull = 47,
79
		TokenNamenull = 58,
76
		TokenNamepackage = 101,
80
		TokenNamepackage = 91,
77
		TokenNameprivate = 61,
81
		TokenNameprivate = 36,
78
		TokenNameprotected = 62,
82
		TokenNameprotected = 37,
79
		TokenNamepublic = 63,
83
		TokenNamepublic = 38,
80
		TokenNamereturn = 95,
84
		TokenNamereturn = 85,
81
		TokenNameshort = 40,
85
		TokenNameshort = 50,
82
		TokenNamestatic = 56,
86
		TokenNamestatic = 32,
83
		TokenNamestrictfp = 64,
87
		TokenNamestrictfp = 39,
84
		TokenNamesuper = 42,
88
		TokenNamesuper = 54,
85
		TokenNameswitch = 96,
89
		TokenNameswitch = 86,
86
		TokenNamesynchronized = 57,
90
		TokenNamesynchronized = 40,
87
		TokenNamethis = 43,
91
		TokenNamethis = 55,
88
		TokenNamethrow = 97,
92
		TokenNamethrow = 87,
89
		TokenNamethrows = 110,
93
		TokenNamethrows = 111,
90
		TokenNametransient = 65,
94
		TokenNametransient = 41,
91
		TokenNametrue = 48,
95
		TokenNametrue = 59,
92
		TokenNametry = 98,
96
		TokenNametry = 88,
93
		TokenNamevoid = 41,
97
		TokenNamevoid = 51,
94
		TokenNamevolatile = 66,
98
		TokenNamevolatile = 42,
95
		TokenNamewhile = 77,
99
		TokenNamewhile = 78,
96
		TokenNameIntegerLiteral = 49,
100
		TokenNameIntegerLiteral = 60,
97
		TokenNameLongLiteral = 50,
101
		TokenNameLongLiteral = 61,
98
		TokenNameFloatingPointLiteral = 51,
102
		TokenNameFloatingPointLiteral = 62,
99
		TokenNameDoubleLiteral = 52,
103
		TokenNameDoubleLiteral = 63,
100
		TokenNameCharacterLiteral = 53,
104
		TokenNameCharacterLiteral = 64,
101
		TokenNameStringLiteral = 54,
105
		TokenNameStringLiteral = 65,
102
		TokenNamePLUS_PLUS = 2,
106
		TokenNamePLUS_PLUS = 2,
103
		TokenNameMINUS_MINUS = 3,
107
		TokenNameMINUS_MINUS = 3,
104
		TokenNameEQUAL_EQUAL = 19,
108
		TokenNameEQUAL_EQUAL = 21,
105
		TokenNameLESS_EQUAL = 13,
109
		TokenNameLESS_EQUAL = 13,
106
		TokenNameGREATER_EQUAL = 14,
110
		TokenNameGREATER_EQUAL = 14,
107
		TokenNameNOT_EQUAL = 20,
111
		TokenNameNOT_EQUAL = 22,
108
		TokenNameLEFT_SHIFT = 18,
112
		TokenNameLEFT_SHIFT = 19,
109
		TokenNameRIGHT_SHIFT = 15,
113
		TokenNameRIGHT_SHIFT = 15,
110
		TokenNameUNSIGNED_RIGHT_SHIFT = 16,
114
		TokenNameUNSIGNED_RIGHT_SHIFT = 17,
111
		TokenNamePLUS_EQUAL = 78,
115
		TokenNamePLUS_EQUAL = 92,
112
		TokenNameMINUS_EQUAL = 79,
116
		TokenNameMINUS_EQUAL = 93,
113
		TokenNameMULTIPLY_EQUAL = 80,
117
		TokenNameMULTIPLY_EQUAL = 94,
114
		TokenNameDIVIDE_EQUAL = 81,
118
		TokenNameDIVIDE_EQUAL = 95,
115
		TokenNameAND_EQUAL = 82,
119
		TokenNameAND_EQUAL = 96,
116
		TokenNameOR_EQUAL = 83,
120
		TokenNameOR_EQUAL = 97,
117
		TokenNameXOR_EQUAL = 84,
121
		TokenNameXOR_EQUAL = 98,
118
		TokenNameREMAINDER_EQUAL = 85,
122
		TokenNameREMAINDER_EQUAL = 99,
119
		TokenNameLEFT_SHIFT_EQUAL = 86,
123
		TokenNameLEFT_SHIFT_EQUAL = 100,
120
		TokenNameRIGHT_SHIFT_EQUAL = 87,
124
		TokenNameRIGHT_SHIFT_EQUAL = 101,
121
		TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 88,
125
		TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 102,
122
		TokenNameOR_OR = 30,
126
		TokenNameOR_OR = 31,
123
		TokenNameAND_AND = 29,
127
		TokenNameAND_AND = 30,
124
		TokenNamePLUS = 4,
128
		TokenNamePLUS = 4,
125
		TokenNameMINUS = 5,
129
		TokenNameMINUS = 5,
126
		TokenNameNOT = 70,
130
		TokenNameNOT = 69,
127
		TokenNameREMAINDER = 8,
131
		TokenNameREMAINDER = 8,
128
		TokenNameXOR = 23,
132
		TokenNameXOR = 24,
129
		TokenNameAND = 21,
133
		TokenNameAND = 23,
130
		TokenNameMULTIPLY = 7,
134
		TokenNameMULTIPLY = 7,
131
		TokenNameOR = 25,
135
		TokenNameOR = 26,
132
		TokenNameTWIDDLE = 71,
136
		TokenNameTWIDDLE = 70,
133
		TokenNameDIVIDE = 9,
137
		TokenNameDIVIDE = 9,
134
		TokenNameGREATER = 12,
138
		TokenNameGREATER = 12,
135
		TokenNameLESS = 11,
139
		TokenNameLESS = 10,
136
		TokenNameLPAREN = 24,
140
		TokenNameLPAREN = 27,
137
		TokenNameRPAREN = 26,
141
		TokenNameRPAREN = 25,
138
		TokenNameLBRACE = 68,
142
		TokenNameLBRACE = 68,
139
		TokenNameRBRACE = 32,
143
		TokenNameRBRACE = 53,
140
		TokenNameLBRACKET = 6,
144
		TokenNameLBRACKET = 6,
141
		TokenNameRBRACKET = 72,
145
		TokenNameRBRACKET = 72,
142
		TokenNameSEMICOLON = 28,
146
		TokenNameSEMICOLON = 28,
143
		TokenNameQUESTION = 27,
147
		TokenNameQUESTION = 29,
144
		TokenNameCOLON = 69,
148
		TokenNameCOLON = 71,
145
		TokenNameCOMMA = 31,
149
		TokenNameCOMMA = 52,
146
		TokenNameDOT = 1,
150
		TokenNameDOT = 1,
147
		TokenNameEQUAL = 74,
151
		TokenNameEQUAL = 76,
148
		TokenNameAT = 45,
152
		TokenNameAT = 16,
149
		TokenNameELLIPSIS = 112,
153
		TokenNameELLIPSIS = 75,
150
		TokenNameARROW = 109,
154
		TokenNameARROW = 110,
151
		TokenNameCOLON_COLON = 10,
155
		TokenNameCOLON_COLON = 11,
152
		TokenNameBeginLambda = 55,
156
		TokenNameBeginLambda = 66,
153
		TokenNameBeginTypeArguments = 75,
157
		TokenNameBeginTypeArguments = 77,
154
		TokenNameElidedSemicolonAndRightBrace = 73,
158
		TokenNameElidedSemicolonAndRightBrace = 73,
155
		TokenNameEOF = 67,
159
		TokenNameEOF = 67,
156
		TokenNameERROR = 115;
160
		TokenNameERROR = 115;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java (-2 / +25 lines)
Lines 9-14 Link Here
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
10
 * only. The code is not compatible with any specification of the JCP.
11
 *
11
 *
12
 * This is an implementation of an early-draft specification developed under the Java
13
 * Community Process (JCP) and is made available for testing and evaluation purposes
14
 * only. The code is not compatible with any specification of the JCP.
15
 * 
12
 * Contributors:
16
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
17
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
18
 *******************************************************************************/
Lines 20-25 Link Here
20
import org.eclipse.jdt.internal.compiler.parser.Parser;
24
import org.eclipse.jdt.internal.compiler.parser.Parser;
21
import org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation;
25
import org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation;
22
import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner;
26
import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner;
27
import org.eclipse.jdt.internal.compiler.parser.Scanner;
23
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
28
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
24
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
29
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
25
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
30
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
Lines 789-796 Link Here
789
	    }
794
	    }
790
795
791
		//
796
		//
792
		// Next, try deletion of the error token.
797
		// Next, try deletion of the error token, preferring deletion as a criteria in
793
		//
798
		// case of identical, superfluous keyword tokens. See below.
794
		j = parseCheck(
799
		j = parseCheck(
795
				stck,
800
				stck,
796
				stack_top,
801
				stack_top,
Lines 806-811 Link Here
806
			repair.misspellIndex = k;
811
			repair.misspellIndex = k;
807
			repair.code = DELETION_CODE;
812
			repair.code = DELETION_CODE;
808
			repair.distance = j;
813
			repair.distance = j;
814
		} else if (j == repair.distance) {
815
			// Handle some cases where deletion as a repair strategy is obviously superior to
816
			// others. e.g: Object o = new new Object() {}; For some reason, with the new grammar
817
			// rules to support type annotations in place, the scopeTrial's choice above wins out
818
			// with the repair strategy being to insert a semicolon after the first new. That looks
819
			// very suspicious. It is not clear if that is due to the bug in the implementation of
820
			// scopeTrial or in the jikespg parser generator or in the grammar.
821
			
822
			// The current fix is a temporary point-fix to address this problem. It does make sense
823
			// as a rule, but is a bit ad-hoc in nature and the reason why scopeTrial succeeds needs
824
			// to be understood. (TODO(Ayush): Investigate scopeTrial's choice)
825
			LexStream.Token previousToken = this.lexStream.token(repair.bufferPosition + 1);
826
			LexStream.Token curToken = this.lexStream.token(repair.bufferPosition + 2);
827
			if (previousToken != null && curToken != null && previousToken.kind == curToken.kind && Scanner.isKeyword(curToken.kind)) {
828
				repair.misspellIndex = k;
829
				repair.code = DELETION_CODE;
830
				repair.distance = j;
831
			}
809
		}
832
		}
810
833
811
		//
834
		//
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc (-1 / +8 lines)
Line 1 Link Here
1
ll   k  HHHDDk    EEE"  HIhE    jEMDYYD"DDfJJmc""L"Ef"d"""--"
1
mmL55D5l4KL55HHHHHDl5555GGG4KKK,776655IhG5555
2
3
,k,4,G,,NDOOD,DD,g44
4
4
5
4iLLnZ,J,gGi,,Y,
6
,,
7
,,
8
67,
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props (-14 / +19 lines)
Lines 1-17 Link Here
1
###############################################################################
2
# Copyright (c) 2012 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# This is an implementation of an early-draft specification developed under the Java
9
# Community Process (JCP) and is made available for testing and evaluation purposes
10
# only. The code is not compatible with any specification of the JCP.
11
#
12
# Contributors:
13
#     IBM Corporation - initial API and implementation
14
###############################################################################
15
,opt=,
1
,opt=,
16
;opt=;
2
;opt=;
17
AbstractMethodDeclaration=MethodDeclaration
3
AbstractMethodDeclaration=MethodDeclaration
Lines 36-41 Link Here
36
AnnotationTypeMemberDeclaration=AnnotationTypeMemberDeclaration
22
AnnotationTypeMemberDeclaration=AnnotationTypeMemberDeclaration
37
AnnotationTypeMemberDeclarations=AnnotationTypeMemberDeclarations
23
AnnotationTypeMemberDeclarations=AnnotationTypeMemberDeclarations
38
AnnotationTypeMemberDeclarationsopt=AnnotationTypeMemberDeclarations
24
AnnotationTypeMemberDeclarationsopt=AnnotationTypeMemberDeclarations
25
Annotationsopt=Annotationsopt
39
ArgumentList=ArgumentList
26
ArgumentList=ArgumentList
40
ArgumentListopt=ArgumentList
27
ArgumentListopt=ArgumentList
41
Arguments=Arguments
28
Arguments=Arguments
Lines 80-86 Link Here
80
ClassInstanceCreationExpression=ClassInstanceCreationExpression
67
ClassInstanceCreationExpression=ClassInstanceCreationExpression
81
ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName
68
ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName
82
ClassMemberDeclaration=ClassMemberDeclaration
69
ClassMemberDeclaration=ClassMemberDeclaration
70
ClassOrInterface0=Type
83
ClassOrInterface=Type
71
ClassOrInterface=Type
72
ClassOrInterfaceType0=Type
84
ClassOrInterfaceType=Type
73
ClassOrInterfaceType=Type
85
ClassType=ClassType
74
ClassType=ClassType
86
ClassTypeElt=ClassType
75
ClassTypeElt=ClassType
Lines 104-111 Link Here
104
DimWithOrWithOutExpr=Dimension
93
DimWithOrWithOutExpr=Dimension
105
DimWithOrWithOutExprs=Dimensions
94
DimWithOrWithOutExprs=Dimensions
106
Dims=Dimensions
95
Dims=Dimensions
96
DimsAnnotLoop=DimsAnnotLoop
107
DimsLoop=Dimensions
97
DimsLoop=Dimensions
108
Dimsopt=Dimensions
98
Dimsopt=Dimensions
99
DimsoptAnnotsopt=AnnotationsDimensionsSequence
109
DoStatement=DoStatement
100
DoStatement=DoStatement
110
ElidedLeftBraceAndReturn=ElidedLeftBraceAndReturn
101
ElidedLeftBraceAndReturn=ElidedLeftBraceAndReturn
111
EmptyStatement=EmptyStatement
102
EmptyStatement=EmptyStatement
Lines 157-162 Link Here
157
FormalParameterListopt=FormalParameterList
148
FormalParameterListopt=FormalParameterList
158
GenericMethodDeclaration=GenericMethodDeclaration
149
GenericMethodDeclaration=GenericMethodDeclaration
159
GenericType=GenericType
150
GenericType=GenericType
151
GenericTypeDotName=GenericTypeDotName
160
Goal=Goal
152
Goal=Goal
161
Header1=Header1
153
Header1=Header1
162
Header2=Header2
154
Header2=Header2
Lines 172-177 Link Here
172
Initializer=Initializer
164
Initializer=Initializer
173
InsideCastExpression=InsideCastExpression
165
InsideCastExpression=InsideCastExpression
174
InsideCastExpressionLL1=InsideCastExpression
166
InsideCastExpressionLL1=InsideCastExpression
167
InsideCastExpressionWithAnnotatedQualifiedGenerics=InsideCastExpression
175
InsideCastExpressionWithQualifiedGenerics=InsideCastExpression
168
InsideCastExpressionWithQualifiedGenerics=InsideCastExpression
176
InstanceofExpression=Expression
169
InstanceofExpression=Expression
177
InstanceofExpression_NotName=Expression
170
InstanceofExpression_NotName=Expression
Lines 229-234 Link Here
229
NormalAnnotation=NormalAnnotation
222
NormalAnnotation=NormalAnnotation
230
NumericType=NumericType
223
NumericType=NumericType
231
OneDimLoop=Dimension
224
OneDimLoop=Dimension
225
OneDimOrAnnot=OneDimensionOrAnnotation
232
OnlySynchronized=OnlySynchronized
226
OnlySynchronized=OnlySynchronized
233
OnlyTypeArguments=TypeArguments
227
OnlyTypeArguments=TypeArguments
234
OnlyTypeArgumentsForCastExpression=TypeArguments
228
OnlyTypeArgumentsForCastExpression=TypeArguments
Lines 237-246 Link Here
237
PackageComment=PackageComment
231
PackageComment=PackageComment
238
PackageDeclaration=PackageDeclaration
232
PackageDeclaration=PackageDeclaration
239
PackageDeclarationName=PackageDeclarationName
233
PackageDeclarationName=PackageDeclarationName
234
PopZeroTypeAnnotations=PopZeroTypeAnnotations
240
PostDecrementExpression=PostDecrementExpression
235
PostDecrementExpression=PostDecrementExpression
241
PostIncrementExpression=PostIncrementExpression
236
PostIncrementExpression=PostIncrementExpression
242
PostfixExpression=Expression
237
PostfixExpression=Expression
243
PostfixExpression_NotName=Expression
238
PostfixExpression_NotName=Expression
239
PotentialNameArray=PotentialNameArray
244
PreDecrementExpression=PreDecrementExpression
240
PreDecrementExpression=PreDecrementExpression
245
PreIncrementExpression=PreIncrementExpression
241
PreIncrementExpression=PreIncrementExpression
246
Primary=Expression
242
Primary=Expression
Lines 253-259 Link Here
253
PushModifiersForHeader=PushModifiersForHeader
249
PushModifiersForHeader=PushModifiersForHeader
254
PushPosition=PushPosition
250
PushPosition=PushPosition
255
PushRPAREN=)
251
PushRPAREN=)
252
PushRPARENForAnnotatedTypeCast=)
253
PushRPARENForNameAndAnnotatedTypeCast=)
254
PushRPARENForNameUnannotatedTypeCast=)
255
PushRPARENForUnannotatedTypeCast=)
256
PushRealModifiers=PushRealModifiers
256
PushRealModifiers=PushRealModifiers
257
PushZeroTypeAnnotations=ZeroTypeAnnotations
257
QualifiedClassBodyopt=ClassBody
258
QualifiedClassBodyopt=ClassBody
258
QualifiedEnterAnonymousClassBody=EnterAnonymousClassBody
259
QualifiedEnterAnonymousClassBody=EnterAnonymousClassBody
259
QualifiedName=QualifiedName
260
QualifiedName=QualifiedName
Lines 261-266 Link Here
261
RecoveryMethodHeaderName=MethodHeaderName
262
RecoveryMethodHeaderName=MethodHeaderName
262
ReduceImports=ReduceImports
263
ReduceImports=ReduceImports
263
ReferenceExpression=ReferenceExpression
264
ReferenceExpression=ReferenceExpression
265
ReferenceType0=ReferenceType
264
ReferenceType1=ReferenceType1
266
ReferenceType1=ReferenceType1
265
ReferenceType2=ReferenceType2
267
ReferenceType2=ReferenceType2
266
ReferenceType3=ReferenceType3
268
ReferenceType3=ReferenceType3
Lines 302-308 Link Here
302
TryBlock=Block
304
TryBlock=Block
303
TryStatement=TryStatement
305
TryStatement=TryStatement
304
TryStatementWithResources=TryStatementWithResources
306
TryStatementWithResources=TryStatementWithResources
307
Type0=Type
305
Type=Type
308
Type=Type
309
TypeAnnotations=TypeAnnotations
306
TypeArgument1=TypeArgument1
310
TypeArgument1=TypeArgument1
307
TypeArgument2=TypeArgument2
311
TypeArgument2=TypeArgument2
308
TypeArgument3=TypeArgument3
312
TypeArgument3=TypeArgument3
Lines 318-323 Link Here
318
TypeElidedFormalParameterList=TypeElidedFormalParameterList
322
TypeElidedFormalParameterList=TypeElidedFormalParameterList
319
TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration
323
TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration
320
TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName
324
TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName
325
TypeInternal=Type
321
TypeParameter1=TypeParameter1
326
TypeParameter1=TypeParameter1
322
TypeParameter=TypeParameter
327
TypeParameter=TypeParameter
323
TypeParameterHeader=TypeParameter
328
TypeParameterHeader=TypeParameter
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (+47 lines)
Lines 9-14 Link Here
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
10
 * only. The code is not compatible with any specification of the JCP.
11
 *
11
 *
12
 * This is an implementation of an early-draft specification developed under the Java
13
 * Community Process (JCP) and is made available for testing and evaluation purposes
14
 * only. The code is not compatible with any specification of the JCP.
15
 * 
12
 * Contributors:
16
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
17
 *     IBM Corporation - initial API and implementation
14
 *     Benjamin Muskalla - Contribution for bug 239066
18
 *     Benjamin Muskalla - Contribution for bug 239066
Lines 2573-2578 Link Here
2573
		methodDecl.sourceStart,
2577
		methodDecl.sourceStart,
2574
		methodDecl.sourceEnd);
2578
		methodDecl.sourceEnd);
2575
}
2579
}
2580
public void invalidLocationForModifiers(ASTNode location) {
2581
	this.handle(
2582
			IProblem.InvalidLocationForModifiers,
2583
			NoArgument,
2584
			NoArgument,
2585
			location.sourceStart,
2586
			location.sourceEnd);
2587
}
2576
public void illegalModifierForVariable(LocalDeclaration localDecl, boolean complainAsArgument) {
2588
public void illegalModifierForVariable(LocalDeclaration localDecl, boolean complainAsArgument) {
2577
	String[] arguments = new String[] {new String(localDecl.name)};
2589
	String[] arguments = new String[] {new String(localDecl.name)};
2578
	this.handle(
2590
	this.handle(
Lines 4148-4153 Link Here
4148
		argument.type.sourceStart,
4160
		argument.type.sourceStart,
4149
		argument.sourceEnd);
4161
		argument.sourceEnd);
4150
}
4162
}
4163
4164
public void invalidUsageOfTypeAnnotations(Annotation annotation) {
4165
	this.handle(
4166
			IProblem.InvalidUsageOfTypeAnnotations,
4167
			NoArgument,
4168
			NoArgument,
4169
			annotation.sourceStart,
4170
			annotation.sourceEnd);
4171
}
4172
4173
public void illegalReceiverAnnotations(Annotation first, Annotation last) {
4174
	this.handle(
4175
			IProblem.InvalidUsageOfReceiverAnnotations,
4176
			NoArgument,
4177
			NoArgument,
4178
			first.sourceStart,
4179
			last.sourceEnd);	
4180
}
4181
4182
public void misplacedTypeAnnotations(Annotation first, Annotation last) {
4183
	this.handle(
4184
			IProblem.MisplacedTypeAnnotations,
4185
			NoArgument,
4186
			NoArgument,
4187
			first.sourceStart,
4188
			last.sourceEnd);	
4189
}
4190
public void illegalUsageOfTypeAnnotations(Annotation annotation) {
4191
	this.handle(
4192
			IProblem.IllegalUsageOfTypeAnnotations,
4193
			NoArgument,
4194
			NoArgument,
4195
			annotation.sourceStart,
4196
			annotation.sourceEnd);	
4197
}
4151
public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location) {
4198
public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location) {
4152
	this.referenceContext = compUnitDecl;
4199
	this.referenceContext = compUnitDecl;
4153
	String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)};
4200
	String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)};
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-4 / +7 lines)
Lines 8-15 Link Here
8
# This is an implementation of an early-draft specification developed under the Java
8
# This is an implementation of an early-draft specification developed under the Java
9
# Community Process (JCP) and is made available for testing and evaluation purposes
9
# Community Process (JCP) and is made available for testing and evaluation purposes
10
# only. The code is not compatible with any specification of the JCP.
10
# only. The code is not compatible with any specification of the JCP.
11
#
11
# 
12
#
13
# Contributors:
12
# Contributors:
14
#     IBM Corporation - initial API and implementation
13
#     IBM Corporation - initial API and implementation
15
#		Benjamin Muskalla - Contribution for bug 239066
14
#		Benjamin Muskalla - Contribution for bug 239066
Lines 225-231 Link Here
225
242 = Syntax error, insert "{0}" to complete phrase
224
242 = Syntax error, insert "{0}" to complete phrase
226
225
227
250 = Unexpected end of file
226
250 = Unexpected end of file
228
251 = Invalid hex literal number
227
251 = Invalid hexadecimal floating point literal number
229
252 = Invalid octal literal number
228
252 = Invalid octal literal number
230
253 = Invalid character constant
229
253 = Invalid character constant
231
254 = Invalid escape sequence (valid ones are  \\b  \\t  \\n  \\f  \\r  \\"  \\'  \\\\ )
230
254 = Invalid escape sequence (valid ones are  \\b  \\t  \\n  \\f  \\r  \\"  \\'  \\\\ )
Lines 586-592 Link Here
586
634 = The method {0}({1}) of type {2} must override or implement a supertype method
585
634 = The method {0}({1}) of type {2} must override or implement a supertype method
587
635 = Unnecessary @SuppressWarnings("{0}")
586
635 = Unnecessary @SuppressWarnings("{0}")
588
636 = The method {0}({1}) of type {2} should be tagged with @Override since it actually overrides a superinterface method
587
636 = The method {0}({1}) of type {2} should be tagged with @Override since it actually overrides a superinterface method
589
588
637 = Syntax error, type annotations are available only when source level is at least 1.8
589
638 = Receiver annotations are illegal in a static method context
590
639 = Syntax error, type annotations are illegal here
591
640 = Syntax error, modifiers are illegal here
592
641 = Type annotation is illegal for a method that returns void
590
### MORE GENERICS
593
### MORE GENERICS
591
660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}>
594
660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}>
592
595
(-)a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java (-1 / +51 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
2
 * Copyright (c) 2006, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 126-131 Link Here
126
	}
130
	}
127
131
128
	public void endVisit(Block node) {
132
	public void endVisit(Block node) {
133
		int level = node.getAST().apiLevel;
134
		
135
		List statements = node.statements();
136
		next : for (int i = 0, max = statements.size(); i < max; i++) {
137
			ASTNode statement = (ASTNode) statements.get(i);
138
			if (statement.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT) {
139
				VariableDeclarationStatement variableDeclarationStatement =  (VariableDeclarationStatement) statement;
140
				
141
				if (level == AST.JLS2_INTERNAL) {
142
					if (variableDeclarationStatement.getModifiers() != Modifier.NONE) {
143
						continue next;
144
					}
145
				} else if (level >= AST.JLS3_INTERNAL) {
146
					if (variableDeclarationStatement.modifiers().size() != 0) {
147
						continue next;
148
					}
149
				}
150
				
151
				Type type = variableDeclarationStatement.getType();
152
				if (type.getNodeType() != ASTNode.SIMPLE_TYPE) {
153
					continue next;
154
				}
155
				
156
				List fragments = variableDeclarationStatement.fragments();
157
				if (fragments.size() == 1) {
158
					VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
159
					
160
					SimpleName simpleName = fragment.getName();
161
					if (CharOperation.equals(RecoveryScanner.FAKE_IDENTIFIER, simpleName.getIdentifier().toCharArray())) {
162
						SimpleType simpleType = (SimpleType) type;
163
						Name name = simpleType.getName();
164
						name.setParent(null, null);
165
						name.setFlags(name.getFlags() | ASTNode.RECOVERED);
166
						
167
						final ExpressionStatement stmt = new ExpressionStatement(name.getAST());
168
						stmt.setExpression(name);
169
						stmt.setSourceRange(variableDeclarationStatement.getStartPosition(), variableDeclarationStatement.getLength());
170
						stmt.setFlags(stmt.getFlags() | ASTNode.RECOVERED);
171
						
172
						statements.add(i, stmt);
173
						statements.remove(variableDeclarationStatement);
174
					}
175
				}
176
			}
177
		}
178
		
129
		this.blockDepth--;
179
		this.blockDepth--;
130
		if(this.blockDepth <= 0) {
180
		if(this.blockDepth <= 0) {
131
			flagNodeWithInsertedTokens();
181
			flagNodeWithInsertedTokens();
(-)a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java (-3 / +7 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 48-54 Link Here
48
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
52
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
49
53
50
	if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) {
54
	if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) {
51
		codeStream.new_(allocatedType);
55
		codeStream.new_(this.type, allocatedType);
52
		if (valueRequired) {
56
		if (valueRequired) {
53
			codeStream.dup();
57
			codeStream.dup();
54
		}
58
		}
Lines 85-91 Link Here
85
		if (this.arguments != null) {
89
		if (this.arguments != null) {
86
			int argsLength = this.arguments.length;
90
			int argsLength = this.arguments.length;
87
			codeStream.generateInlinedValue(argsLength);
91
			codeStream.generateInlinedValue(argsLength);
88
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
92
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
89
			codeStream.dup();
93
			codeStream.dup();
90
			for (int i = 0; i < argsLength; i++) {
94
			for (int i = 0; i < argsLength; i++) {
91
				codeStream.generateInlinedValue(i);
95
				codeStream.generateInlinedValue(i);
Lines 101-107 Link Here
101
			}
105
			}
102
		} else {
106
		} else {
103
			codeStream.generateInlinedValue(0);
107
			codeStream.generateInlinedValue(0);
104
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
108
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
105
		}
109
		}
106
		codeStream.invokeJavaLangReflectConstructorNewInstance();
110
		codeStream.invokeJavaLangReflectConstructorNewInstance();
107
		codeStream.checkcast(allocatedType);
111
		codeStream.checkcast(allocatedType);
(-)a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java (-2 / +8 lines)
Lines 8-14 Link Here
8
 * This is an implementation of an early-draft specification developed under the Java
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
10
 * only. The code is not compatible with any specification of the JCP.
11
 *
11
 * 
12
 * Contributors:
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
14
 *******************************************************************************/
Lines 23-28 Link Here
23
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
23
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
24
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
24
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
25
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
25
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
26
import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream;
26
import org.eclipse.jdt.internal.compiler.lookup.Binding;
27
import org.eclipse.jdt.internal.compiler.lookup.Binding;
27
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
Lines 125-132 Link Here
125
	this.produceAttributes = this.referenceBinding.scope.compilerOptions().produceDebugAttributes;
126
	this.produceAttributes = this.referenceBinding.scope.compilerOptions().produceDebugAttributes;
126
	this.creatingProblemType = creatingProblemType;
127
	this.creatingProblemType = creatingProblemType;
127
	if (this.targetJDK >= ClassFileConstants.JDK1_6) {
128
	if (this.targetJDK >= ClassFileConstants.JDK1_6) {
128
		this.codeStream = new StackMapFrameCodeStream(this);
129
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
129
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
130
		if (this.targetJDK >= ClassFileConstants.JDK1_7) {
131
			this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
132
			this.codeStream = new TypeAnnotationCodeStream(this);
133
		} else {
134
			this.codeStream = new StackMapFrameCodeStream(this);
135
		}
130
	} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
136
	} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
131
		this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
137
		this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
132
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
138
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
(-)a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java (-2 / +6 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 111-117 Link Here
111
		if (this.arguments != null) {
115
		if (this.arguments != null) {
112
			int argsLength = this.arguments.length;
116
			int argsLength = this.arguments.length;
113
			codeStream.generateInlinedValue(argsLength);
117
			codeStream.generateInlinedValue(argsLength);
114
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
118
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
115
			codeStream.dup();
119
			codeStream.dup();
116
			for (int i = 0; i < argsLength; i++) {
120
			for (int i = 0; i < argsLength; i++) {
117
				codeStream.generateInlinedValue(i);
121
				codeStream.generateInlinedValue(i);
Lines 127-133 Link Here
127
			}
131
			}
128
		} else {
132
		} else {
129
			codeStream.generateInlinedValue(0);
133
			codeStream.generateInlinedValue(0);
130
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
134
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
131
		}
135
		}
132
		codeStream.invokeJavaLangReflectMethodInvoke();
136
		codeStream.invokeJavaLangReflectMethodInvoke();
133
137
(-)a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java (+7 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 792-797 Link Here
792
796
793
	// reset stacks in consistent state
797
	// reset stacks in consistent state
794
	this.expressionPtr = -1;
798
	this.expressionPtr = -1;
799
	this.unattachedAnnotationPtr = -1;
800
	this.typeAnnotationLengthPtr = -1;
801
	this.typeAnnotationPtr = -1;
795
	this.identifierPtr = -1;
802
	this.identifierPtr = -1;
796
	this.identifierLengthPtr = -1;
803
	this.identifierLengthPtr = -1;
797
804
(-)a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java (-3 / +7 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 63-69 Link Here
63
		codeStream.aconst_null();
67
		codeStream.aconst_null();
64
68
65
		// void.class
69
		// void.class
66
		codeStream.generateClassLiteralAccessForType(TypeBinding.VOID, null);
70
		codeStream.generateClassLiteralAccessForType(null, TypeBinding.VOID, null);
67
	} else {
71
	} else {
68
		// swap with expression
72
		// swap with expression
69
		int valueTypeID = this.expression.resolvedType.id;
73
		int valueTypeID = this.expression.resolvedType.id;
Lines 80-86 Link Here
80
		}
84
		}
81
85
82
		// generate the expression type
86
		// generate the expression type
83
		codeStream.generateClassLiteralAccessForType(this.expression.resolvedType, null);
87
		codeStream.generateClassLiteralAccessForType(null, this.expression.resolvedType, null);
84
	}
88
	}
85
89
86
	// generate the invoke virtual to "setResult(Object,Class)"
90
	// generate the invoke virtual to "setResult(Object,Class)"
(-)a/org.eclipse.jdt.core/grammar/java.g
Lines 182-190 Link Here
182
Goal ::= '>>' StaticInitializer
182
Goal ::= '>>' StaticInitializer
183
Goal ::= '>>' Initializer
183
Goal ::= '>>' Initializer
184
-- error recovery
184
-- error recovery
(-)Modifiersopt is used to properly consume a header and exit the rule reduction at the end of the parse() method (-5 / +47 lines)
Lines 205-210 Link Here
205
Goal ::= '?' AnnotationTypeMemberDeclaration
204
Goal ::= '?' AnnotationTypeMemberDeclaration
206
/:$readableName Goal:/
205
/:$readableName Goal:/
207
206
207
RecoveryExitHeader ::= $empty
208
RecoveryExitHeader ::= '...'
209
208
Literal -> IntegerLiteral
210
Literal -> IntegerLiteral
209
Literal -> LongLiteral
211
Literal -> LongLiteral
210
Literal -> FloatingPointLiteral
212
Literal -> FloatingPointLiteral
Lines 218-226 Link Here
218
BooleanLiteral -> false
220
BooleanLiteral -> false
219
/:$readableName BooleanLiteral:/
221
/:$readableName BooleanLiteral:/
220
222
221
Type ::= PrimitiveType
223
-- Type is a wrapper that automatically allows for jsr308 style
224
-- annotations to prefix a (Java5/6) Type. If type annotations
225
-- are illegal in a certain place, use TypeInternal instead.
226
-- If type annotations are legal, but so are java5/6 style
227
-- declaration annotations, use Type0 instead.
228
229
Type ::= TypeInternal
230
-- consumeUnannotatedType inserts 0 at the suitable place in the type
231
-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
232
-- length of the type annotations 0 or otherwise.
233
/.$putCase consumeUnannotatedType();  $break ./
234
Type ::= TypeAnnotations TypeInternal
235
/:$compliance 1.7:/
236
/:$readableName Type:/
237
238
-- Type0 is to be used in places where type annotations are legal
239
-- but are not consumed as TypeAnnotations, but as modifiers. This
240
-- is because from the parser's point of view there are places where
241
-- java5/6 style declarations annotations can occur in the same place
242
-- and it is too early to tell which is which.
243
Type0 ::= TypeInternal
244
-- consumeUnannotatedType inserts 0 at the suitable place in the type
245
-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
246
-- length of the type annotations 0 or otherwise.
247
/.$putCase consumeUnannotatedType();  $break ./
248
/:$readableName Type:/
249
250
-- TypeInternal is the Java5/6 Type
251
TypeInternal ::= PrimitiveType
222
/.$putCase consumePrimitiveType(); $break ./
252
/.$putCase consumePrimitiveType(); $break ./
223
Type -> ReferenceType
253
TypeInternal -> ReferenceType0
224
/:$readableName Type:/
254
/:$readableName Type:/
225
255
226
PrimitiveType -> NumericType
256
PrimitiveType -> NumericType
Lines 241-267 Link Here
241
FloatingPointType -> 'double'
271
FloatingPointType -> 'double'
242
/:$readableName FloatingPointType:/
272
/:$readableName FloatingPointType:/
243
273
244
ReferenceType ::= ClassOrInterfaceType
274
---------------------------- JSR308-------------------------------------------
245
/.$putCase consumeReferenceType(); $break ./
275
-- ReferenceType has been wrapped now, so that it can be used by itself without
246
ReferenceType -> ArrayType
276
-- having to spell out the rule once with Modifiers & once without.
277
-- If type annotations are not legal prefixes to ReferenceType at some point, use 
278
-- ReferenceType0 instead. Otherwise reject the annotations in the parser.
279
280
ReferenceType ::= ReferenceType0
281
-- consumeUnannotatedType inserts 0 at the suitable place in the type
282
-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
283
-- length of the type annotations 0 or otherwise.
284
/.$putCase consumeUnannotatedType();  $break ./
285
ReferenceType ::= Modifiers ReferenceType0
286
/.$putCase consumeAnnotatedType();  $break ./
287
/:$compliance 1.7:/
247
/:$readableName ReferenceType:/
288
/:$readableName ReferenceType:/
248
289
(-)------------------------------------------------------------- (-39 / +172 lines)
Lines 277-284 Link Here
277
-- ArrayType ::= ArrayType '[' ']'
352
-- ArrayType ::= ArrayType '[' ']'
278
--
353
--
279
354
280
ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name
355
ArrayTypeWithTypeArgumentsName ::= GenericTypeDotName
281
/.$putCase consumeArrayTypeWithTypeArgumentsName(); $break ./
282
/:$readableName ArrayTypeWithTypeArgumentsName:/
356
/:$readableName ArrayTypeWithTypeArgumentsName:/
283
357
284
ArrayType ::= PrimitiveType Dims
358
ArrayType ::= PrimitiveType Dims
Lines 357-364 Link Here
357
/:$readableName Header1:/
431
/:$readableName Header1:/
358
432
359
Header2 -> Header
433
Header2 -> Header
360
Header2 -> EnumConstantHeader
434
Header2 -> EnumConstantHeader RecoveryEnumConstantSeparatoropt
361
/:$readableName Header2:/
435
/:$readableName Header2:/
436
437
RecoveryEnumConstantSeparatoropt ::= $empty
438
RecoveryEnumConstantSeparatoropt ::= ','
439
RecoveryEnumConstantSeparatoropt ::= ';'
362
440
363
CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{'
441
CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{'
364
/.$putCase consumeCatchHeader(); $break ./
442
/.$putCase consumeCatchHeader(); $break ./
Lines 384-390 Link Here
384
/:$compliance 1.5:/
462
/:$compliance 1.5:/
385
463
386
PackageDeclarationName ::= PackageComment 'package' Name
464
PackageDeclarationName ::= PackageComment 'package' Name
387
/.$putCase consumePackageDeclarationName(); $break ./
465
/.$putCase  consumePackageDeclarationName(); $break ./
388
/:$readableName PackageDeclarationName:/
466
/:$readableName PackageDeclarationName:/
389
467
390
PackageComment ::= $empty
468
PackageComment ::= $empty
Lines 558-564 Link Here
558
--    | 'transient'
636
--    | 'transient'
559
--    | 'volatile'
637
--    | 'volatile'
560
638
561
FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
639
FieldDeclaration ::= Modifiersopt Type0 VariableDeclarators ';'
562
/.$putCase consumeFieldDeclaration(); $break ./
640
/.$putCase consumeFieldDeclaration(); $break ./
563
/:$readableName FieldDeclaration:/
641
/:$readableName FieldDeclaration:/
564
642
Lines 566-571 Link Here
566
VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
644
VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
567
/.$putCase consumeVariableDeclarators(); $break ./
645
/.$putCase consumeVariableDeclarators(); $break ./
568
/:$readableName VariableDeclarators:/
646
/:$readableName VariableDeclarators:/
647
/:$recovery_template Identifier:/
569
648
570
VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
649
VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
571
VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
650
VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
Lines 629-635 Link Here
629
708
630
MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
709
MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
631
/.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./
710
/.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./
632
MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
711
MethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
633
/.$putCase consumeMethodHeaderName(false); $break ./
712
/.$putCase consumeMethodHeaderName(false); $break ./
634
/:$readableName MethodHeaderName:/
713
/:$readableName MethodHeaderName:/
635
714
Lines 638-644 Link Here
638
/:$readableName ):/
717
/:$readableName ):/
639
/:$recovery_template ):/
718
/:$recovery_template ):/
640
719
641
MethodHeaderExtendedDims ::= Dimsopt
720
MethodHeaderExtendedDims ::= DimsoptAnnotsopt
642
/.$putCase consumeMethodHeaderExtendedDims(); $break ./
721
/.$putCase consumeMethodHeaderExtendedDims(); $break ./
643
/:$readableName MethodHeaderExtendedDims:/
722
/:$readableName MethodHeaderExtendedDims:/
644
723
Lines 646-652 Link Here
646
/.$putCase consumeMethodHeaderThrowsClause(); $break ./
725
/.$putCase consumeMethodHeaderThrowsClause(); $break ./
647
/:$readableName MethodHeaderThrowsClause:/
726
/:$readableName MethodHeaderThrowsClause:/
648
727
649
ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt
728
ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen Annotationsopt MethodHeaderThrowsClauseopt
650
/.$putCase consumeConstructorHeader(); $break ./
729
/.$putCase consumeConstructorHeader(); $break ./
651
/:$readableName ConstructorDeclaration:/
730
/:$readableName ConstructorDeclaration:/
652
731
Lines 661-670 Link Here
661
/.$putCase consumeFormalParameterList(); $break ./
740
/.$putCase consumeFormalParameterList(); $break ./
662
/:$readableName FormalParameterList:/
741
/:$readableName FormalParameterList:/
663
742
743
PotentialNameArray -> $empty
744
/.$putCase consumePotentialNameArrayType(); $break ./
745
/:$readableName PotentialNameArray:/
746
664
--1.1 feature
747
--1.1 feature
665
FormalParameter ::= Modifiersopt Type VariableDeclaratorId
748
--FormalParameter ::= Modifiersopt Type VariableDeclaratorId
749
--FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
750
--The above rules have been rewritten by inlinng the type subgrammar
751
--to avoid the conflicts resulting from jsr308 changes.
752
FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt VariableDeclaratorId
666
/.$putCase consumeFormalParameter(false); $break ./
753
/.$putCase consumeFormalParameter(false); $break ./
667
FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
754
FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt '...' VariableDeclaratorId
755
/.$putCase consumeFormalParameter(true); $break ./
756
/:$compliance 1.5:/
757
FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId
758
/.$putCase consumeFormalParameter(false); $break ./
759
FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId
760
/.$putCase consumeFormalParameter(true); $break ./
761
/:$compliance 1.5:/
762
FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt VariableDeclaratorId
763
/.$putCase consumeFormalParameter(false); $break ./
764
FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt '...' VariableDeclaratorId
765
/.$putCase consumeFormalParameter(true); $break ./
766
/:$compliance 1.5:/
767
FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt VariableDeclaratorId
768
/.$putCase consumeFormalParameter(false); $break ./
769
FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt '...' VariableDeclaratorId
668
/.$putCase consumeFormalParameter(true); $break ./
770
/.$putCase consumeFormalParameter(true); $break ./
669
/:$readableName FormalParameter:/
771
/:$readableName FormalParameter:/
670
/:$compliance 1.5:/
772
/:$compliance 1.5:/
Lines 679-685 Link Here
679
/.$putCase consumeCatchType(); $break ./
781
/.$putCase consumeCatchType(); $break ./
680
/:$readableName CatchType:/
782
/:$readableName CatchType:/
681
783
682
UnionType ::= Type
784
UnionType ::= TypeInternal
683
/.$putCase consumeUnionTypeAsClassType(); $break ./
785
/.$putCase consumeUnionTypeAsClassType(); $break ./
684
UnionType ::= UnionType '|' Type
786
UnionType ::= UnionType '|' Type
685
/.$putCase consumeUnionType(); $break ./
787
/.$putCase consumeUnionType(); $break ./
Lines 706-712 Link Here
706
808
707
--18.8.4 Productions from 8.5: Static Initializers
809
--18.8.4 Productions from 8.5: Static Initializers
708
810
709
StaticInitializer ::= StaticOnly Block
811
StaticInitializer ::=  StaticOnly Block
710
/.$putCase consumeStaticInitializer(); $break./
812
/.$putCase consumeStaticInitializer(); $break./
711
/:$readableName StaticInitializer:/
813
/:$readableName StaticInitializer:/
712
814
Lines 842-848 Link Here
842
InvalidInitializer -> Initializer
944
InvalidInitializer -> Initializer
843
/:$readableName InvalidInitializer:/
945
/:$readableName InvalidInitializer:/
844
946
845
846
InterfaceMemberDeclaration -> AbstractMethodDeclaration
947
InterfaceMemberDeclaration -> AbstractMethodDeclaration
847
InterfaceMemberDeclaration -> InvalidConstructorDeclaration
948
InterfaceMemberDeclaration -> InvalidConstructorDeclaration
848
InterfaceMemberDeclaration -> InvalidInitializer
949
InterfaceMemberDeclaration -> InvalidInitializer
Lines 906-918 Link Here
906
/.$putCase consumeLocalVariableDeclarationStatement(); $break ./
1007
/.$putCase consumeLocalVariableDeclarationStatement(); $break ./
907
/:$readableName LocalVariableDeclarationStatement:/
1008
/:$readableName LocalVariableDeclarationStatement:/
908
1009
909
LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators
1010
LocalVariableDeclaration ::= Type0 PushModifiers VariableDeclarators
910
/.$putCase consumeLocalVariableDeclaration(); $break ./
1011
/.$putCase consumeLocalVariableDeclaration(); $break ./
911
-- 1.1 feature
1012
-- 1.1 feature
912
-- The modifiers part of this rule makes the grammar more permissive. 
1013
-- The modifiers part of this rule makes the grammar more permissive. 
913
-- The only modifier here is final. We put Modifiers to allow multiple modifiers
1014
-- The only modifier here is final. We put Modifiers to allow multiple modifiers
914
-- This will require to check the validity of the modifier
1015
-- This will require to check the validity of the modifier
915
LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators
1016
LocalVariableDeclaration ::= Modifiers Type0 PushRealModifiers VariableDeclarators
916
/.$putCase consumeLocalVariableDeclaration(); $break ./
1017
/.$putCase consumeLocalVariableDeclaration(); $break ./
917
/:$readableName LocalVariableDeclaration:/
1018
/:$readableName LocalVariableDeclaration:/
918
1019
Lines 980-986 Link Here
980
/:$readableName LabeledStatement:/
1081
/:$readableName LabeledStatement:/
981
1082
982
Label ::= 'Identifier'
1083
Label ::= 'Identifier'
983
/.$putCase consumeLabel() ; $break ./
1084
/.$putCase consumeLabel(); $break ./
984
/:$readableName Label:/
1085
/:$readableName Label:/
985
1086
986
ExpressionStatement ::= StatementExpression ';'
1087
ExpressionStatement ::= StatementExpression ';'
Lines 1154-1165 Link Here
1154
/:$readableName ;:/
1255
/:$readableName ;:/
1155
/:$compliance 1.7:/
1256
/:$compliance 1.7:/
1156
1257
1157
Resource ::= Type PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
1258
Resource ::= TypeInternal PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
1158
/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
1259
/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
1159
/:$readableName Resource:/
1260
/:$readableName Resource:/
1160
/:$compliance 1.7:/
1261
/:$compliance 1.7:/
1161
1262
1162
Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
1263
Resource ::= Modifiers TypeInternal PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
1163
/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
1264
/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
1164
/:$readableName Resource:/
1265
/:$readableName Resource:/
1165
/:$compliance 1.7:/
1266
/:$compliance 1.7:/
Lines 1180-1186 Link Here
1180
/.$putCase consumeStatementCatch() ; $break ./
1281
/.$putCase consumeStatementCatch() ; $break ./
1181
/:$readableName CatchClause:/
1282
/:$readableName CatchClause:/
1182
1283
1183
Finally ::= 'finally' Block
1284
Finally ::= 'finally'    Block
1184
/:$readableName Finally:/
1285
/:$readableName Finally:/
1185
/:$recovery_template finally { }:/
1286
/:$recovery_template finally { }:/
1186
1287
Lines 1191-1198 Link Here
1191
/.$putCase consumeLeftParen(); $break ./
1292
/.$putCase consumeLeftParen(); $break ./
1192
/:$readableName (:/
1293
/:$readableName (:/
1193
/:$recovery_template (:/
1294
/:$recovery_template (:/
1295
PushRPARENForUnannotatedTypeCast ::= ')'
1296
/.$putCase consumeRightParenForUnannotatedTypeCast(); $break ./
1297
/:$readableName ):/
1298
/:$recovery_template ):/
1299
PushRPARENForNameUnannotatedTypeCast ::=  ')'
1300
/.$putCase consumeRightParenForNameUnannotatedTypeCast(); $break ./
1301
/:$readableName ):/
1302
/:$recovery_template ):/
1194
PushRPAREN ::= ')'
1303
PushRPAREN ::= ')'
1195
/.$putCase consumeRightParen(); $break ./
1304
/.$putCase consumeRightParen(); $break ./
1305
/:$readableName ):/
1306
/:$recovery_template ):/
1307
PushRPARENForAnnotatedTypeCast ::= ')'
1308
/.$putCase consumeRightParenForAnnotatedTypeCast(); $break ./
1309
/:$readableName ):/
1310
/:$recovery_template ):/
1311
1312
PushRPARENForNameAndAnnotatedTypeCast ::= ')'
1313
/.$putCase consumeRightParenForNameAndAnnotatedTypeCast(); $break ./
1196
/:$readableName ):/
1314
/:$readableName ):/
1197
/:$recovery_template ):/
1315
/:$recovery_template ):/
1198
1316
Lines 1214-1219 Link Here
1214
PrimaryNoNewArray -> ClassInstanceCreationExpression
1332
PrimaryNoNewArray -> ClassInstanceCreationExpression
1215
PrimaryNoNewArray -> FieldAccess
1333
PrimaryNoNewArray -> FieldAccess
1216
--1.1 feature
1334
--1.1 feature
1335
-- javac doesn't permit type annotations here.
1217
PrimaryNoNewArray ::= Name '.' 'this'
1336
PrimaryNoNewArray ::= Name '.' 'this'
1218
/.$putCase consumePrimaryNoNewArrayNameThis(); $break ./
1337
/.$putCase consumePrimaryNoNewArrayNameThis(); $break ./
1219
PrimaryNoNewArray ::= Name '.' 'super'
1338
PrimaryNoNewArray ::= Name '.' 'super'
Lines 1223-1228 Link Here
1223
--PrimaryNoNewArray ::= Type '.' 'class'
1342
--PrimaryNoNewArray ::= Type '.' 'class'
1224
--inline Type in the previous rule in order to make the grammar LL1 instead 
1343
--inline Type in the previous rule in order to make the grammar LL1 instead 
1225
-- of LL2. The result is the 3 next rules.
1344
-- of LL2. The result is the 3 next rules.
1345
1346
PrimaryNoNewArray ::= Modifiers Name '.' 'class'
1347
/.$putCase consumePrimaryNoNewArrayNameWithTypeAnnotations(); $break ./
1348
/:$compliance 1.7:/
1349
1350
PrimaryNoNewArray ::= Modifiers Name Dims '.' 'class'
1351
/.$putCase consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations(); $break ./
1352
/:$compliance 1.7:/
1353
1354
PrimaryNoNewArray ::= Modifiers PrimitiveType Dims '.' 'class'
1355
/.$putCase consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations(); $break ./
1356
/:$compliance 1.7:/
1357
1358
PrimaryNoNewArray ::= Modifiers PrimitiveType '.' 'class'
1359
/.$putCase consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations(); $break ./
1360
/:$compliance 1.7:/
1226
1361
1227
PrimaryNoNewArray ::= Name '.' 'class'
1362
PrimaryNoNewArray ::= Name '.' 'class'
1228
/.$putCase consumePrimaryNoNewArrayName(); $break ./
1363
/.$putCase consumePrimaryNoNewArrayName(); $break ./
Lines 1390-1407 Link Here
1390
/.$putCase consumeArgumentList(); $break ./
1525
/.$putCase consumeArgumentList(); $break ./
1391
/:$readableName ArgumentList:/
1526
/:$readableName ArgumentList:/
1392
1527
1393
ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs
1528
-- ArrayCreationHeader is used only in recovery and the consume* method is a NOP.
1529
ArrayCreationHeader ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs
1394
/.$putCase consumeArrayCreationHeader(); $break ./
1530
/.$putCase consumeArrayCreationHeader(); $break ./
1395
1396
ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
1531
ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
1397
/.$putCase consumeArrayCreationHeader(); $break ./
1532
/.$putCase consumeArrayCreationHeader(); $break ./
1398
/:$readableName ArrayCreationHeader:/
1533
/:$readableName ArrayCreationHeader:/
1399
1534
1400
ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
1535
ArrayCreationWithoutArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs
1401
/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
1536
/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
1402
/:$readableName ArrayCreationWithoutArrayInitializer:/
1537
/:$readableName ArrayCreationWithoutArrayInitializer:/
1403
1538
1404
ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
1539
ArrayCreationWithArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs ArrayInitializer
1405
/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
1540
/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
1406
/:$readableName ArrayCreationWithArrayInitializer:/
1541
/:$readableName ArrayCreationWithArrayInitializer:/
1407
1542
Lines 1416-1426 Link Here
1416
/.$putCase consumeDimWithOrWithOutExprs(); $break ./
1551
/.$putCase consumeDimWithOrWithOutExprs(); $break ./
1417
/:$readableName Dimensions:/
1552
/:$readableName Dimensions:/
1418
1553
1419
DimWithOrWithOutExpr ::= '[' Expression ']'
1554
DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations Expression ']'
1420
DimWithOrWithOutExpr ::= '[' ']'
1555
DimWithOrWithOutExpr ::= TypeAnnotations '[' Expression ']'
1556
/:$compliance 1.7:/
1557
DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations ']'
1421
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1558
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1559
DimWithOrWithOutExpr ::= TypeAnnotations '[' ']'
1560
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1561
/:$compliance 1.7:/
1422
/:$readableName Dimension:/
1562
/:$readableName Dimension:/
1423
-- -----------------------------------------------
1563
-- -----------------------------------------------
1564
1565
-- jsr 308
1566
1567
DimsoptAnnotsopt -> $empty
1568
/. $putCase consumeEmptyDimsoptAnnotsopt(); $break ./
1569
/:$readableName AnnotationsDimensionsSequence:/
1570
DimsoptAnnotsopt -> DimsAnnotLoop
1571
/. $putCase consumeDimsWithTrailingAnnotsopt(); $break ./
1572
/:$readableName Dimensionsoptannotsopt:/
1573
DimsAnnotLoop ::= OneDimOrAnnot
1574
DimsAnnotLoop ::= DimsAnnotLoop OneDimOrAnnot
1575
/:$readableName DimsAnnotLoop:/
1576
1577
OneDimOrAnnot ::= Annotation
1578
/. $putCase consumeTypeAnnotation(true); $break ./
1579
-- Complain if source level < 1.7
1580
/:$compliance 1.7:/
1581
OneDimOrAnnot -> '[' ']'
1582
/. $putCase consumeOneDimLoop(true); $break ./
1583
-- Bump up dimensions && mark zero annotations.
1584
/:$readableName OneDimensionOrAnnotation:/
1585
1586
TypeAnnotations ::= Annotation
1587
/. $putCase consumeTypeAnnotation(false); $break ./
1588
/:$compliance 1.7:/
1589
TypeAnnotations ::= TypeAnnotations Annotation
1590
/. $putCase consumeOneMoreTypeAnnotation(); $break ./
1591
/:$compliance 1.7:/
1592
/:$readableName TypeAnnotations:/
1424
1593
1425
Dims ::= DimsLoop
1594
Dims ::= DimsLoop
1426
/. $putCase consumeDims(); $break ./
1595
/. $putCase consumeDims(); $break ./
Lines 1429-1436 Link Here
1429
DimsLoop ::= DimsLoop OneDimLoop
1598
DimsLoop ::= DimsLoop OneDimLoop
1430
/:$readableName Dimensions:/
1599
/:$readableName Dimensions:/
1431
OneDimLoop ::= '[' ']'
1600
OneDimLoop ::= '[' ']'
1432
/. $putCase consumeOneDimLoop(); $break ./
1601
/. $putCase consumeOneDimLoop(false); $break ./
1602
-- Bump up dimensions && mark zero annotations.
1433
/:$readableName Dimension:/
1603
/:$readableName Dimension:/
1604
OneDimLoop ::= TypeAnnotations '[' ']'
1605
/:$compliance 1.7:/
1606
/. $putCase consumeOneDimLoopWithAnnotations(); $break ./
1607
-- Bump up dimensions
1608
/:$readableName DimensionWithAnnotations:/
1434
1609
1435
FieldAccess ::= Primary '.' 'Identifier'
1610
FieldAccess ::= Primary '.' 'Identifier'
1436
/.$putCase consumeFieldAccess(false); $break ./
1611
/.$putCase consumeFieldAccess(false); $break ./
Lines 1511-1526 Link Here
1511
UnaryExpressionNotPlusMinus -> CastExpression
1686
UnaryExpressionNotPlusMinus -> CastExpression
1512
/:$readableName Expression:/
1687
/:$readableName Expression:/
1513
1688
1514
CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
1689
CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpression
1515
/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
1690
/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
1516
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
1691
CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression
1692
/:$compliance 1.7:/
1693
/.$putCase consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); $break ./
1694
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1517
/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
1695
/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
1518
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
1696
CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1697
/:$compliance 1.7:/
1698
/.$putCase consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); $break ./
1699
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
1519
/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
1700
/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
1520
CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
1701
CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpressionWithAnnotatedQualifiedGenerics UnaryExpressionNotPlusMinus
1702
/:$compliance 1.7:/
1703
/.$putCase consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); $break ./
1704
CastExpression ::= PushLPAREN Name PushRPARENForNameUnannotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
1521
/.$putCase consumeCastExpressionLL1(); $break ./
1705
/.$putCase consumeCastExpressionLL1(); $break ./
1522
CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
1706
CastExpression ::= PushLPAREN Modifiers Name PushRPARENForNameAndAnnotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
1707
/:$compliance 1.7:/
1708
/.$putCase consumeCastExpressionLL1WithTypeAnnotations(); $break ./
1709
CastExpression ::= PushLPAREN Name Dims PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1523
/.$putCase consumeCastExpressionWithNameArray(); $break ./
1710
/.$putCase consumeCastExpressionWithNameArray(); $break ./
1711
CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1712
/:$compliance 1.7:/
1713
/.$putCase consumeCastExpressionWithNameArrayWithTypeAnnotations(); $break ./
1524
/:$readableName CastExpression:/
1714
/:$readableName CastExpression:/
1525
1715
1526
OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
1716
OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
Lines 1535-1540 Link Here
1535
/:$readableName InsideCastExpression:/
1725
/:$readableName InsideCastExpression:/
1536
InsideCastExpressionWithQualifiedGenerics ::= $empty
1726
InsideCastExpressionWithQualifiedGenerics ::= $empty
1537
/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
1727
/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
1728
/:$readableName InsideCastExpression:/
1729
1730
InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty
1731
/.$putCase consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); $break ./
1538
/:$readableName InsideCastExpression:/
1732
/:$readableName InsideCastExpression:/
1539
1733
1540
MultiplicativeExpression -> UnaryExpression
1734
MultiplicativeExpression -> UnaryExpression
Lines 1842-1852 Link Here
1842
/.$putCase consumeEnhancedForStatement(); $break ./
2036
/.$putCase consumeEnhancedForStatement(); $break ./
1843
/:$readableName EnhancedForStatementNoShortIf:/
2037
/:$readableName EnhancedForStatementNoShortIf:/
1844
2038
1845
EnhancedForStatementHeaderInit ::= 'for' '(' Type PushModifiers Identifier Dimsopt
2039
EnhancedForStatementHeaderInit ::= 'for' '(' Type0 PushModifiers Identifier Dimsopt
1846
/.$putCase consumeEnhancedForStatementHeaderInit(false); $break ./
2040
/.$putCase consumeEnhancedForStatementHeaderInit(false); $break ./
1847
/:$readableName EnhancedForStatementHeaderInit:/
2041
/:$readableName EnhancedForStatementHeaderInit:/
1848
2042
1849
EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type PushRealModifiers Identifier Dimsopt
2043
EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type0 PushRealModifiers Identifier Dimsopt
1850
/.$putCase consumeEnhancedForStatementHeaderInit(true); $break ./
2044
/.$putCase consumeEnhancedForStatementHeaderInit(true); $break ./
1851
/:$readableName EnhancedForStatementHeaderInit:/
2045
/:$readableName EnhancedForStatementHeaderInit:/
1852
2046
Lines 1921-1928 Link Here
1921
/:$compliance 1.5:/
2115
/:$compliance 1.5:/
1922
ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
2116
ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
1923
/.$putCase consumeTypeArgumentReferenceType1(); $break ./
2117
/.$putCase consumeTypeArgumentReferenceType1(); $break ./
1924
/:$readableName ReferenceType1:/
1925
/:$compliance 1.5:/
2118
/:$compliance 1.5:/
2119
ReferenceType1 ::= Modifiers ClassOrInterface '<' TypeArgumentList2
2120
/:$compliance 1.7:/
2121
/.$putCase consumeTypeArgumentReferenceType1WithTypeAnnotations(); $break ./
2122
/:$readableName ReferenceType1:/
1926
2123
1927
TypeArgumentList2 -> TypeArgument2
2124
TypeArgumentList2 -> TypeArgument2
1928
/:$compliance 1.5:/
2125
/:$compliance 1.5:/
Lines 1942-1949 Link Here
1942
/:$compliance 1.5:/
2139
/:$compliance 1.5:/
1943
ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
2140
ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
1944
/.$putCase consumeTypeArgumentReferenceType2(); $break ./
2141
/.$putCase consumeTypeArgumentReferenceType2(); $break ./
1945
/:$readableName ReferenceType2:/
1946
/:$compliance 1.5:/
2142
/:$compliance 1.5:/
2143
ReferenceType2 ::= Modifiers ClassOrInterface '<' TypeArgumentList3
2144
/:$compliance 1.7:/
2145
/.$putCase consumeTypeArgumentReferenceType2WithTypeAnnotations(); $break ./
2146
/:$readableName ReferenceType2:/
1947
2147
1948
TypeArgumentList3 -> TypeArgument3
2148
TypeArgumentList3 -> TypeArgument3
1949
TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
2149
TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
Lines 2025-2034 Link Here
2025
/:$readableName WildcardBound3:/
2225
/:$readableName WildcardBound3:/
2026
/:$compliance 1.5:/
2226
/:$compliance 1.5:/
2027
2227
2028
TypeParameterHeader ::= Identifier
2228
PushZeroTypeAnnotations ::= $empty
2229
/.$putCase consumeZeroTypeAnnotations(true); $break ./
2230
/:$readableName ZeroTypeAnnotations:/
2231
2232
TypeParameterHeader ::= PushZeroTypeAnnotations Identifier
2233
/.$putCase consumeTypeParameterHeader(); $break ./
2234
/:$compliance 1.5:/
2235
TypeParameterHeader ::= TypeAnnotations Identifier
2236
/:$compliance 1.7:/
2029
/.$putCase consumeTypeParameterHeader(); $break ./
2237
/.$putCase consumeTypeParameterHeader(); $break ./
2030
/:$readableName TypeParameter:/
2238
/:$readableName TypeParameter:/
2031
/:$compliance 1.5:/
2032
2239
2033
TypeParameters ::= '<' TypeParameterList1
2240
TypeParameters ::= '<' TypeParameterList1
2034
/.$putCase consumeTypeParameters(); $break ./
2241
/.$putCase consumeTypeParameters(); $break ./
Lines 2295-2301 Link Here
2295
2502
2296
AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2503
AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2297
/.$putCase consumeMethodHeaderNameWithTypeParameters(true); $break ./
2504
/.$putCase consumeMethodHeaderNameWithTypeParameters(true); $break ./
2298
AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
2505
AnnotationMethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
2299
/.$putCase consumeMethodHeaderName(true); $break ./
2506
/.$putCase consumeMethodHeaderName(true); $break ./
2300
/:$readableName MethodHeaderName:/
2507
/:$readableName MethodHeaderName:/
2301
/:$compliance 1.5:/
2508
/:$compliance 1.5:/
Lines 2341-2346 Link Here
2341
/.$putCase consumeAnnotationName() ; $break ./
2548
/.$putCase consumeAnnotationName() ; $break ./
2342
/:$readableName AnnotationName:/
2549
/:$readableName AnnotationName:/
2343
/:$compliance 1.5:/
2550
/:$compliance 1.5:/
2551
/:$recovery_template @ Identifier:/
2344
2552
2345
NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')'
2553
NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')'
2346
/.$putCase consumeNormalAnnotation() ; $break ./
2554
/.$putCase consumeNormalAnnotation() ; $break ./
Lines 2438-2444 Link Here
2438
RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2646
RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2439
/.$putCase consumeRecoveryMethodHeaderNameWithTypeParameters(); $break ./
2647
/.$putCase consumeRecoveryMethodHeaderNameWithTypeParameters(); $break ./
2440
/:$compliance 1.5:/
2648
/:$compliance 1.5:/
2441
RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
2649
RecoveryMethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
2442
/.$putCase consumeRecoveryMethodHeaderName(); $break ./
2650
/.$putCase consumeRecoveryMethodHeaderName(); $break ./
2443
/:$readableName MethodHeaderName:/
2651
/:$readableName MethodHeaderName:/
2444
2652
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java (+16 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 142-147 Link Here
142
	char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
146
	char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
143
	
147
	
144
	/**
148
	/**
149
	 * "RuntimeVisibleTypeAnnotations" attribute (added in jsr 308).
150
	 * @since 3.9
151
	 */
152
	char[] RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
153
154
	/**
155
	 * "RuntimeInvisibleTypeAnnotations" attribute (added in jsr 308).
156
	 * @since 3.9
157
	 */
158
	char[] RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
159
160
	/**
145
	 * "BootstrapMethods" attribute (added in cldc1.0).
161
	 * "BootstrapMethods" attribute (added in cldc1.0).
146
	 * @since 3.8
162
	 * @since 3.8
147
	 */
163
	 */
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java (+164 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.util;
16
17
/**
18
 * Description of an extended annotation structure as described in the JVM specifications
19
 * (added in JavaSE-1.7).
20
 *
21
 * This interface may be implemented by clients.
22
 *
23
 * @since 3.9
24
 */
25
public interface IExtendedAnnotation extends IAnnotation {
26
	/**
27
	 * Answer back the target type as described in the JVM specifications.
28
	 *
29
	 * @return the target type
30
	 */
31
	int getTargetType();
32
	
33
	/**
34
	 * Answer back the offset.
35
	 * 
36
	 * For a target_type value equals to:
37
	 * <table border="1">
38
	 * <tr>
39
	 * <th>target_type</th>
40
	 * <th>offset description</th>
41
	 * </tr>
42
	 * <tr>
43
	 * <td>0x00, 0x02, 0x04, 0x1E</td>
44
	 * <td>The offset within the bytecodes of the containing method of the <code>checkcast</code> 
45
	 * bytecode emitted for a typecast, the <code>instanceof</code> bytecode for the type tests, 
46
	 * the <code>new</code> bytecode emitted for the object creation expression, the <code>ldc(_w)</code>
47
	 * bytecode emitted for class literal, or the <code>getstatic</code> bytecode emitted for primitive
48
	 * class literals.</td>
49
	 * </tr>
50
	 * <tr>
51
	 * <td>0x18, 0x1A</td>
52
	 * <td>The offset within the bytecodes of the containing method of the <code>new</code> 
53
	 * bytecode emitted for a constructor call, or the <code>invoke{interface|special|static|virtual}</code>
54
	 * bytecode emitted for a method invocation.</td>
55
	 * </tr>
56
	 * </table>
57
	 * 
58
	 * 
59
	 * @return the offset
60
	 */
61
	int getOffset();
62
	
63
	/**
64
	 * Answer back the local variable reference info table length of this entry as specified in
65
	 * the JVM specifications.
66
	 * 
67
	 * <p>This is defined only for annotations related a local variable.</p>
68
	 *
69
	 * @return the local variable reference info table length of this entry as specified in
70
	 * the JVM specifications
71
	 */
72
	int getLocalVariableRefenceInfoLength();
73
	
74
	/**
75
	 * Answer back the local variable reference info table of this entry as specified in
76
	 * the JVM specifications. Answer an empty array if none.
77
	 * 
78
	 * <p>This is defined only for annotations related a local variable.</p>
79
	 *
80
	 * @return the local variable reference info table of this entry as specified in
81
	 * the JVM specifications. Answer an empty array if none
82
	 */
83
	ILocalVariableReferenceInfo[] getLocalVariableTable();
84
	
85
	/**
86
	 * Answer back the method parameter index.
87
	 * 
88
	 * <p>The index is 0-based.</p>
89
	 * 
90
	 * @return the method parameter index
91
	 */
92
	int getParameterIndex();
93
94
	/**
95
	 * Answer back the method type parameter index.
96
	 * 
97
	 * <p>The index is 0-based.</p>
98
	 * 
99
	 * @return the method type parameter index
100
	 */
101
	int getTypeParameterIndex();
102
103
	/**
104
	 * Answer back the method type parameter bound index.
105
	 * 
106
	 * <p>The index is 0-based.</p>
107
	 * 
108
	 * @return the method type parameter bound index
109
	 */
110
	int getTypeParameterBoundIndex();
111
112
	/**
113
	 * Answer back the index in the given different situations.
114
	 * 
115
	 * <p>The index is 0-based.</p>
116
	 * 
117
	 * <table border="1">
118
	 * <tr>
119
	 * <th>target_type</th>
120
	 * <th>offset description</th>
121
	 * </tr>
122
	 * <tr>
123
	 * <td>0x18, 0x1A</td>
124
	 * <td>the type argument index in the expression</td>
125
	 * </tr>
126
	 * <tr>
127
	 * <td>0x14</td>
128
	 * <td>the index of the type in the clause: <code>-1 (255)</code> is used if the annotation is on 
129
	 * the superclass type, and the value <code>i</code> is used if the annotation is on the <code>i</code>th
130
	 * superinterface type (counting from zero).</td>
131
	 * </tr>
132
	 * <tr>
133
	 * <td>0x16</td>
134
	 * <td>the index of the exception type in the clause: the value <code>i</code> denotes an annotation of the 
135
	 * <code>i</code>th exception type (counting from zero).</td>
136
	 * </tr>
137
	 * </table>
138
	 * @return the index in the given different situations
139
	 */
140
	int getAnnotationTypeIndex();
141
	
142
	/**
143
	 * Answer back the target type of the location of the wildcard as described in the JVM specifications.
144
	 *
145
	 * @return the target type of the location of the wildcard
146
	 */
147
	int getWildcardLocationType();
148
	
149
	/**
150
	 * Answer back the locations of the wildcard type as described in the JVM specifications.
151
	 *
152
	 * @return the locations of the wildcard type
153
	 */
154
	int[] getWildcardLocations();
155
	
156
	/**
157
	 * Answer back the locations of the annotated type as described in the JVM specifications.
158
	 * 
159
	 * <p>This is used for parameterized and array types.</p>
160
	 *
161
	 * @return the locations of the annotated type
162
	 */
163
	int[] getLocations();
164
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java (+64 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.util;
16
17
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
18
19
/**
20
 * Description of an extended annotation target types constants as described in the JVM specifications
21
 * (added in JavaSE-1.7).
22
 *
23
 * @since 3.9
24
 * @noimplement This interface is not intended to be implemented by clients.
25
 * @noextend This interface is not intended to be extended by clients.
26
 */
27
public interface IExtendedAnnotationConstants {
28
	int METHOD_RECEIVER = AnnotationTargetTypeConstants.METHOD_RECEIVER;
29
	int METHOD_RECEIVER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY;
30
	int METHOD_RETURN_TYPE = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE;
31
	int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY;
32
	int METHOD_PARAMETER = AnnotationTargetTypeConstants.METHOD_PARAMETER;
33
	int METHOD_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY;
34
	int FIELD = AnnotationTargetTypeConstants.FIELD;
35
	int FIELD_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY;
36
	int CLASS_TYPE_PARAMETER_BOUND = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND;
37
	int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
38
	int METHOD_TYPE_PARAMETER_BOUND = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND;
39
	int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
40
	int CLASS_EXTENDS_IMPLEMENTS = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS;
41
	int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY;
42
	int THROWS = AnnotationTargetTypeConstants.THROWS;
43
	int THROWS_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY;
44
	int WILDCARD_BOUND = AnnotationTargetTypeConstants.WILDCARD_BOUND;
45
	int WILDCARD_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY;
46
	int METHOD_TYPE_PARAMETER = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER;
47
	int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY;
48
	int CLASS_TYPE_PARAMETER = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER;
49
	int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY;
50
	int TYPE_CAST = AnnotationTargetTypeConstants.TYPE_CAST;
51
	int TYPE_CAST_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY;
52
	int TYPE_INSTANCEOF = AnnotationTargetTypeConstants.TYPE_INSTANCEOF;
53
	int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY;
54
	int OBJECT_CREATION = AnnotationTargetTypeConstants.OBJECT_CREATION;
55
	int OBJECT_CREATION_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY;
56
	int LOCAL_VARIABLE = AnnotationTargetTypeConstants.LOCAL_VARIABLE;
57
	int LOCAL_VARIABLE_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY;
58
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL;
59
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY;
60
	int TYPE_ARGUMENT_METHOD_CALL = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL;
61
	int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY;
62
	int CLASS_LITERAL = AnnotationTargetTypeConstants.CLASS_LITERAL;
63
	int CLASS_LITERAL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY;
64
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java (+52 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.util;
16
17
/**
18
 * Description of a local variable reference info table entry as specified in the JVM specifications.
19
 *
20
 * This interface may be implemented by clients.
21
 *
22
 * @since 3.9
23
 */
24
public interface ILocalVariableReferenceInfo {
25
26
	/**
27
	 * Answer back the start pc of this entry as specified in
28
	 * the JVM specifications.
29
	 *
30
	 * @return the start pc of this entry as specified in
31
	 * the JVM specifications
32
	 */
33
	int getStartPC();
34
35
	/**
36
	 * Answer back the length of this entry as specified in
37
	 * the JVM specifications.
38
	 *
39
	 * @return the length of this entry as specified in
40
	 * the JVM specifications
41
	 */
42
	int getLength();
43
44
	/**
45
	 * Answer back the resolved position of the local variable as specified in
46
	 * the JVM specifications.
47
	 *
48
	 * @return the resolved position of the local variable as specified in
49
	 * the JVM specifications
50
	 */
51
	int getIndex();
52
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.util;
16
17
/**
18
 * Description of a runtime invisible type annotations attribute as described in the JVM specifications
19
 * (added in JavaSE-1.7).
20
 *
21
 * This interface may be implemented by clients.
22
 *
23
 * @since 3.9
24
 */
25
public interface IRuntimeInvisibleTypeAnnotationsAttribute extends IClassFileAttribute {
26
27
	/**
28
	 * Answer back the number of extended annotations as described in the JVM specifications.
29
	 *
30
	 * @return the number of extended annotations
31
	 */
32
	int getExtendedAnnotationsNumber();
33
34
	/**
35
	 * Answer back the extended annotations. Answers an empty collection if none.
36
	 *
37
	 * @return the extended annotations
38
	 */
39
	IExtendedAnnotation[] getExtendedAnnotations();
40
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.util;
16
17
/**
18
 * Description of a runtime visible type annotations attribute as described in the JVM specifications
19
 * (added in J2SE 1.5).
20
 *
21
 * This interface may be implemented by clients.
22
 *
23
 * @since 3.9
24
 */
25
public interface IRuntimeVisibleTypeAnnotationsAttribute extends IClassFileAttribute {
26
27
	/**
28
	 * Answer back the number of annotations as described in the JVM specifications.
29
	 *
30
	 * @return the number of annotations
31
	 */
32
	int getExtendedAnnotationsNumber();
33
34
	/**
35
	 * Answer back the extended annotations. Answers an empty collection if none.
36
	 *
37
	 * @return the extended annotations. Answers an empty collection if none.
38
	 */
39
	IExtendedAnnotation[] getExtendedAnnotations();
40
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java (-9 / +181 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 18-23 Link Here
18
import org.eclipse.jdt.internal.compiler.ast.*;
22
import org.eclipse.jdt.internal.compiler.ast.*;
19
import org.eclipse.jdt.internal.compiler.parser.*;
23
import org.eclipse.jdt.internal.compiler.parser.*;
20
import org.eclipse.jdt.internal.compiler.problem.*;
24
import org.eclipse.jdt.internal.compiler.problem.*;
25
import org.eclipse.jdt.internal.compiler.util.Util;
21
26
22
public class DocumentElementParser extends Parser {
27
public class DocumentElementParser extends Parser {
23
	IDocumentElementRequestor requestor;
28
	IDocumentElementRequestor requestor;
Lines 450-455 Link Here
450
	char[] varName = this.identifierStack[this.identifierPtr];
455
	char[] varName = this.identifierStack[this.identifierPtr];
451
	long namePosition = this.identifierPositionStack[this.identifierPtr--];
456
	long namePosition = this.identifierPositionStack[this.identifierPtr--];
452
	int extendedTypeDimension = this.intStack[this.intPtr--];
457
	int extendedTypeDimension = this.intStack[this.intPtr--];
458
	// pop any annotations on extended dimensions now, so they don't pollute the base dimensions.
459
	Annotation [][] annotationsOnExtendedDimensions = extendedTypeDimension == 0 ? null : getAnnotationsOnDimensions(extendedTypeDimension);
460
453
461
454
	AbstractVariableDeclaration declaration;
462
	AbstractVariableDeclaration declaration;
455
	if (this.nestedMethod[this.nestedType] != 0) {
463
	if (this.nestedMethod[this.nestedType] != 0) {
Lines 513-519 Link Here
513
		declaration.type = type;
521
		declaration.type = type;
514
	} else {
522
	} else {
515
		int dimension = typeDim + extendedTypeDimension;
523
		int dimension = typeDim + extendedTypeDimension;
516
		declaration.type = copyDims(type, dimension);
524
		Annotation [][] annotationsOnAllDimensions = null;
525
		Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions();
526
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
527
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedTypeDimension, annotationsOnExtendedDimensions); 
528
		}
529
		declaration.type = copyDims(type, dimension, annotationsOnAllDimensions);
517
	}
530
	}
518
	this.variablesCounter[this.nestedType]++;
531
	this.variablesCounter[this.nestedType]++;
519
	this.nestedMethod[this.nestedType]++;
532
	this.nestedMethod[this.nestedType]++;
Lines 536-541 Link Here
536
				(int) namePosition,
549
				(int) namePosition,
537
				extendedTypeDimension,
550
				extendedTypeDimension,
538
				extendedTypeDimension == 0 ? -1 : this.endPosition);
551
				extendedTypeDimension == 0 ? -1 : this.endPosition);
552
	}
553
}
554
protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) {
555
	TypeReference type;
556
557
	char[] identifierName = this.identifierStack[this.identifierPtr];
558
	long namePosition = this.identifierPositionStack[this.identifierPtr];
559
560
	LocalDeclaration localDeclaration = createLocalDeclaration(identifierName, (int) (namePosition >>> 32), (int) namePosition);
561
	localDeclaration.declarationSourceEnd = localDeclaration.declarationEnd;
562
563
	int extraDims = this.intStack[this.intPtr--];
564
	this.identifierPtr--;
565
	this.identifierLengthPtr--;
566
	// remove fake modifiers/modifiers start
567
	int declarationSourceStart1 = 0;
568
	int modifiersSourceStart1 = 0;
569
	int modifiersValue  = 0;
570
	if (hasModifiers) {
571
		declarationSourceStart1 = this.intStack[this.intPtr--];
572
		modifiersSourceStart1 = this.intStack[this.intPtr--];
573
		modifiersValue = this.intStack[this.intPtr--];
574
	} else {
575
		this.intPtr-=3;
576
	}
577
578
	type = getTypeReference(this.intStack[this.intPtr--] + extraDims); // type dimension
579
580
	// consume annotations
581
	int length;
582
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--])!= 0) {
583
		System.arraycopy(
584
			this.expressionStack,
585
			(this.expressionPtr -= length) + 1,
586
			localDeclaration.annotations = new Annotation[length],
587
			0,
588
			length);
589
	}
590
	if (hasModifiers) {
591
		localDeclaration.declarationSourceStart = declarationSourceStart1;
592
		localDeclaration.modifiersSourceStart = modifiersSourceStart1;
593
		localDeclaration.modifiers = modifiersValue;
594
	} else {
595
		localDeclaration.declarationSourceStart = type.sourceStart;
596
	}
597
	localDeclaration.type = type;
598
599
	ForeachStatement iteratorForStatement =
600
		new ForeachStatement(
601
			localDeclaration,
602
			this.intStack[this.intPtr--]);
603
	pushOnAstStack(iteratorForStatement);
604
605
	iteratorForStatement.sourceEnd = localDeclaration.declarationSourceEnd;
606
}
607
protected void consumeMethodHeaderNameWithTypeParameters(boolean isAnnotationMethod) {
608
	// MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
609
	// AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
610
	// RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
611
	MethodDeclaration md = null;
612
	if(isAnnotationMethod) {
613
		md = new AnnotationMethodDeclaration(this.compilationUnit.compilationResult);
614
		this.recordStringLiterals = false;
615
	} else {
616
		md = new MethodDeclaration(this.compilationUnit.compilationResult);
617
	}
618
619
	//name
620
	md.selector = this.identifierStack[this.identifierPtr];
621
	long selectorSource = this.identifierPositionStack[this.identifierPtr--];
622
	this.identifierLengthPtr--;
623
	//type
624
	md.returnType = getTypeReference(this.intStack[this.intPtr--]);
625
626
	// consume type parameters
627
	int length = this.genericsLengthStack[this.genericsLengthPtr--];
628
	this.genericsPtr -= length;
629
	System.arraycopy(this.genericsStack, this.genericsPtr + 1, md.typeParameters = new TypeParameter[length], 0, length);
630
631
	//modifiers
632
	md.declarationSourceStart = this.intStack[this.intPtr--];
633
	md.modifiersSourceStart = this.intStack[this.intPtr--];
634
	md.modifiers = this.intStack[this.intPtr--];
635
	// consume annotations
636
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
637
		System.arraycopy(
638
			this.expressionStack,
639
			(this.expressionPtr -= length) + 1,
640
			md.annotations = new Annotation[length],
641
			0,
642
			length);
643
	}
644
	// javadoc
645
	md.javadoc = this.javadoc;
646
	this.javadoc = null;
647
648
	//highlight starts at selector start
649
	md.sourceStart = (int) (selectorSource >>> 32);
650
	pushOnAstStack(md);
651
	md.sourceEnd = this.lParenPos;
652
	md.bodyStart = this.lParenPos+1;
653
	this.listLength = 0; // initialize this.listLength before reading parameters/throws
654
655
	// recovery
656
	if (this.currentElement != null){
657
		boolean isType;
658
		if ((isType = this.currentElement instanceof RecoveredType)
659
			//|| md.modifiers != 0
660
			|| (Util.getLineNumber(md.returnType.sourceStart, this.scanner.lineEnds, 0, this.scanner.linePtr)
661
					== Util.getLineNumber(md.sourceStart, this.scanner.lineEnds, 0, this.scanner.linePtr))){
662
			if(isType) {
663
				((RecoveredType) this.currentElement).pendingTypeParameters = null;
664
			}
665
			this.lastCheckPoint = md.bodyStart;
666
			this.currentElement = this.currentElement.add(md, 0);
667
			this.lastIgnoredToken = -1;
668
		} else {
669
			this.lastCheckPoint = md.sourceStart;
670
			this.restartRecovery = true;
671
		}
539
	}
672
	}
540
}
673
}
541
/*
674
/*
Lines 598-607 Link Here
598
		endOfEllipsis = this.intStack[this.intPtr--];
731
		endOfEllipsis = this.intStack[this.intPtr--];
599
	}
732
	}
600
	int firstDimensions = this.intStack[this.intPtr--];
733
	int firstDimensions = this.intStack[this.intPtr--];
601
	final int typeDimensions = firstDimensions + extendedDimensions;
734
	TypeReference type = getUnannotatedTypeReference(extendedDimensions);
602
	TypeReference type = getTypeReference(typeDimensions);
735
	Annotation [] varArgsAnnotations = null;
736
	int length;
737
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
738
		System.arraycopy(
739
			this.typeAnnotationStack,
740
			(this.typeAnnotationPtr -= length) + 1,
741
			varArgsAnnotations = new Annotation[length],
742
			0,
743
			length);
744
	} 
745
	final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
746
	if (typeDimensions != extendedDimensions) {
747
		// jsr308 type annotations management
748
		Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
749
		Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
750
		Annotation [][] annotationsOnAllDimensions = null;
751
		if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
752
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
753
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
754
		}
755
		type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
756
		type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
757
	}
603
	if (isVarArgs) {
758
	if (isVarArgs) {
604
		type = copyDims(type, typeDimensions + 1);
605
		if (extendedDimensions == 0) {
759
		if (extendedDimensions == 0) {
606
			type.sourceEnd = endOfEllipsis;
760
			type.sourceEnd = endOfEllipsis;
607
		}
761
		}
Lines 615-621 Link Here
615
			type,
769
			type,
616
			this.intStack[this.intPtr + 1]);// modifiers
770
			this.intStack[this.intPtr + 1]);// modifiers
617
	// consume annotations
771
	// consume annotations
618
	int length;
619
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
772
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
620
		System.arraycopy(
773
		System.arraycopy(
621
			this.expressionStack,
774
			this.expressionStack,
Lines 872-884 Link Here
872
	// MethodHeaderExtendedDims ::= Dimsopt
1025
	// MethodHeaderExtendedDims ::= Dimsopt
873
	// now we update the returnType of the method
1026
	// now we update the returnType of the method
874
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
1027
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
1028
	// jsr308 -- consume receiver annotations
1029
	md.receiverAnnotations = null;
1030
	int length;
1031
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
1032
		System.arraycopy(
1033
			this.typeAnnotationStack,
1034
			(this.typeAnnotationPtr -= length) + 1,
1035
			md.receiverAnnotations = new Annotation[length],
1036
			0,
1037
			length);
1038
	}
875
	int extendedDims = this.intStack[this.intPtr--];
1039
	int extendedDims = this.intStack[this.intPtr--];
876
	this.extendsDim = extendedDims;
1040
	this.extendsDim = extendedDims;
877
	if (extendedDims != 0) {
1041
	if (extendedDims != 0) {
878
		TypeReference returnType = md.returnType;
1042
		TypeReference returnType = md.returnType;
879
		md.sourceEnd = this.endPosition;
1043
		md.sourceEnd = this.endPosition;
880
		int dims = returnType.dimensions() + extendedDims;
1044
		int dims = returnType.dimensions() + extendedDims;
881
		md.returnType = copyDims(returnType, dims);
1045
		Annotation [][] annotationsOnDimensions = returnType.getAnnotationsOnDimensions();
1046
		Annotation [][] annotationsOnExtendedDimensions = getAnnotationsOnDimensions(extendedDims);
1047
		Annotation [][] annotationsOnAllDimensions = null;
1048
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
1049
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(returnType.dimensions(), annotationsOnDimensions, extendedDims, annotationsOnExtendedDimensions);
1050
		}	
1051
		md.returnType = copyDims(returnType, dims, annotationsOnAllDimensions);
1052
882
		if (this.currentToken == TokenNameLBRACE) {
1053
		if (this.currentToken == TokenNameLBRACE) {
883
			md.bodyStart = this.endPosition + 1;
1054
			md.bodyStart = this.endPosition + 1;
884
		}
1055
		}
Lines 1399-1405 Link Here
1399
	 * This variable is a type reference and dim will be its dimensions.
1570
	 * This variable is a type reference and dim will be its dimensions.
1400
	 * We don't have any side effect on the stacks' pointers.
1571
	 * We don't have any side effect on the stacks' pointers.
1401
	 */
1572
	 */
1402
1573
	Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
1403
	int length;
1574
	int length;
1404
	TypeReference ref;
1575
	TypeReference ref;
1405
	if ((length = this.identifierLengthStack[localIdentifierLengthPtr]) == 1) {
1576
	if ((length = this.identifierLengthStack[localIdentifierLengthPtr]) == 1) {
Lines 1414-1425 Link Here
1414
				new ArrayTypeReference(
1585
				new ArrayTypeReference(
1415
					this.identifierStack[localIdentifierPtr],
1586
					this.identifierStack[localIdentifierPtr],
1416
					dim,
1587
					dim,
1588
					annotationsOnDimensions,
1417
					this.identifierPositionStack[localIdentifierPtr--]);
1589
					this.identifierPositionStack[localIdentifierPtr--]);
1418
			ref.sourceEnd = this.endPosition;
1590
			ref.sourceEnd = this.endPosition;
1419
		}
1591
		}
1420
	} else {
1592
	} else {
1421
		if (length < 0) { //flag for precompiled type reference on base types
1593
		if (length < 0) { //flag for precompiled type reference on base types
1422
			ref = TypeReference.baseTypeReference(-length, dim);
1594
			ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
1423
			ref.sourceStart = this.intStack[this.localIntPtr--];
1595
			ref.sourceStart = this.intStack[this.localIntPtr--];
1424
			if (dim == 0) {
1596
			if (dim == 0) {
1425
				ref.sourceEnd = this.intStack[this.localIntPtr--];
1597
				ref.sourceEnd = this.intStack[this.localIntPtr--];
Lines 1441-1447 Link Here
1441
			if (dim == 0)
1613
			if (dim == 0)
1442
				ref = new QualifiedTypeReference(tokens, positions);
1614
				ref = new QualifiedTypeReference(tokens, positions);
1443
			else
1615
			else
1444
				ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
1616
				ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions);
1445
		}
1617
		}
1446
	}
1618
	}
1447
	return ref;
1619
	return ref;
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java (-18 / +23 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 730-742 Link Here
730
		return null;
734
		return null;
731
	}
735
	}
732
}
736
}
733
public TypeReference getTypeReference(int dim) {
737
public TypeReference getUnannotatedTypeReference(int dim) {
734
	/* build a Reference on a variable that may be qualified or not
738
	/* build a Reference on a variable that may be qualified or not
735
	 * This variable is a type reference and dim will be its dimensions
739
	 * This variable is a type reference and dim will be its dimensions
736
	 */
740
	 */
741
	Annotation [][] annotationsOnDimensions = null;
742
	TypeReference ref;
737
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
743
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
738
	if (length < 0) { //flag for precompiled type reference on base types
744
	if (length < 0) { //flag for precompiled type reference on base types
739
		TypeReference ref = TypeReference.baseTypeReference(-length, dim);
745
		annotationsOnDimensions = getAnnotationsOnDimensions(dim);
746
		ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
740
		ref.sourceStart = this.intStack[this.intPtr--];
747
		ref.sourceStart = this.intStack[this.intPtr--];
741
		if (dim == 0) {
748
		if (dim == 0) {
742
			ref.sourceEnd = this.intStack[this.intPtr--];
749
			ref.sourceEnd = this.intStack[this.intPtr--];
Lines 747-758 Link Here
747
		if (this.reportReferenceInfo){
754
		if (this.reportReferenceInfo){
748
				this.requestor.acceptTypeReference(ref.getParameterizedTypeName(), ref.sourceStart, ref.sourceEnd);
755
				this.requestor.acceptTypeReference(ref.getParameterizedTypeName(), ref.sourceStart, ref.sourceEnd);
749
		}
756
		}
750
		return ref;
751
	} else {
757
	} else {
752
		int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
758
		int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
753
		if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
759
		if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
754
			// generic type
760
			// generic type
755
			TypeReference ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
761
			ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
756
			if (this.reportReferenceInfo) {
762
			if (this.reportReferenceInfo) {
757
				if (length == 1 && numberOfIdentifiers == 1) {
763
				if (length == 1 && numberOfIdentifiers == 1) {
758
					ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) ref;
764
					ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) ref;
Lines 762-791 Link Here
762
					this.requestor.acceptTypeReference(parameterizedQualifiedTypeReference.tokens, parameterizedQualifiedTypeReference.sourceStart, parameterizedQualifiedTypeReference.sourceEnd);
768
					this.requestor.acceptTypeReference(parameterizedQualifiedTypeReference.tokens, parameterizedQualifiedTypeReference.sourceStart, parameterizedQualifiedTypeReference.sourceEnd);
763
				}
769
				}
764
			}
770
			}
765
			return ref;
766
		} else if (length == 1) {
771
		} else if (length == 1) {
767
			// single variable reference
772
			// single variable reference
768
			this.genericsLengthPtr--; // pop the 0
773
			this.genericsLengthPtr--; // pop the 0
769
			if (dim == 0) {
774
			if (dim == 0) {
770
				SingleTypeReference ref =
775
				ref =
771
					new SingleTypeReference(
776
					new SingleTypeReference(
772
						this.identifierStack[this.identifierPtr],
777
						this.identifierStack[this.identifierPtr],
773
						this.identifierPositionStack[this.identifierPtr--]);
778
						this.identifierPositionStack[this.identifierPtr--]);
774
				if (this.reportReferenceInfo) {
779
				if (this.reportReferenceInfo) {
775
					this.requestor.acceptTypeReference(ref.token, ref.sourceStart);
780
					this.requestor.acceptTypeReference(((SingleTypeReference)ref).token, ref.sourceStart);
776
				}
781
				}
777
				return ref;
778
			} else {
782
			} else {
779
				ArrayTypeReference ref =
783
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
784
				ref =
780
					new ArrayTypeReference(
785
					new ArrayTypeReference(
781
						this.identifierStack[this.identifierPtr],
786
						this.identifierStack[this.identifierPtr],
782
						dim,
787
						dim,
788
						annotationsOnDimensions,
783
						this.identifierPositionStack[this.identifierPtr--]);
789
						this.identifierPositionStack[this.identifierPtr--]);
784
				ref.sourceEnd = this.endPosition;
790
				ref.sourceEnd = this.endPosition;
785
				if (this.reportReferenceInfo) {
791
				if (this.reportReferenceInfo) {
786
					this.requestor.acceptTypeReference(ref.token, ref.sourceStart);
792
					this.requestor.acceptTypeReference(((ArrayTypeReference)ref).token, ref.sourceStart);
787
				}
793
				}
788
				return ref;
789
			}
794
			}
790
		} else {//Qualified variable reference
795
		} else {//Qualified variable reference
791
			this.genericsLengthPtr--;
796
			this.genericsLengthPtr--;
Lines 800-821 Link Here
800
				0,
805
				0,
801
				length);
806
				length);
802
			if (dim == 0) {
807
			if (dim == 0) {
803
				QualifiedTypeReference ref = new QualifiedTypeReference(tokens, positions);
808
				ref = new QualifiedTypeReference(tokens, positions);
804
				if (this.reportReferenceInfo) {
809
				if (this.reportReferenceInfo) {
805
					this.requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd);
810
					this.requestor.acceptTypeReference(((QualifiedTypeReference)ref).tokens, ref.sourceStart, ref.sourceEnd);
806
				}
811
				}
807
				return ref;
808
			} else {
812
			} else {
809
				ArrayQualifiedTypeReference ref =
813
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
810
					new ArrayQualifiedTypeReference(tokens, dim, positions);
814
				ref =
815
					new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions);
811
				ref.sourceEnd = this.endPosition;
816
				ref.sourceEnd = this.endPosition;
812
				if (this.reportReferenceInfo) {
817
				if (this.reportReferenceInfo) {
813
					this.requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd);
818
					this.requestor.acceptTypeReference(((ArrayQualifiedTypeReference)ref).tokens, ref.sourceStart, ref.sourceEnd);
814
				}
819
				}
815
				return ref;
816
			}
820
			}
817
		}
821
		}
818
	}
822
	}
823
	return ref;
819
}
824
}
820
public NameReference getUnspecifiedReference() {
825
public NameReference getUnspecifiedReference() {
821
	/* build a (unspecified) NameReference which may be qualified*/
826
	/* build a (unspecified) NameReference which may be qualified*/
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java (+4 lines)
Lines 275-280 Link Here
275
							this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
275
							this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
276
						} else if (equals(attributeName, IAttributeNamesConstants.BOOTSTRAP_METHODS)) {
276
						} else if (equals(attributeName, IAttributeNamesConstants.BOOTSTRAP_METHODS)) {
277
							this.attributes[attributesIndex++] = new BootstrapMethodsAttribute(classFileBytes, this.constantPool, readOffset);
277
							this.attributes[attributesIndex++] = new BootstrapMethodsAttribute(classFileBytes, this.constantPool, readOffset);
278
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
279
							this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
280
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
281
							this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
278
						} else {
282
						} else {
279
							this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
283
							this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
280
						}
284
						}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java (+461 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 259-264 Link Here
259
		buffer.append(Messages.disassembler_annotationentryend);
263
		buffer.append(Messages.disassembler_annotationentryend);
260
	}
264
	}
261
265
266
	private void disassemble(IExtendedAnnotation extendedAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
267
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
268
		final int typeIndex = extendedAnnotation.getTypeIndex();
269
		final char[] typeName = CharOperation.replaceOnCopy(extendedAnnotation.getTypeName(), '/', '.');
270
		buffer.append(
271
			Messages.bind(Messages.disassembler_extendedannotationentrystart, new String[] {
272
				Integer.toString(typeIndex),
273
				new String(returnClassName(Signature.toCharArray(typeName), '.', mode))
274
			}));
275
		final IAnnotationComponent[] components = extendedAnnotation.getComponents();
276
		for (int i = 0, max = components.length; i < max; i++) {
277
			disassemble(components[i], buffer, lineSeparator, tabNumber + 1, mode);
278
		}
279
		writeNewLine(buffer, lineSeparator, tabNumber + 2);
280
		int targetType = extendedAnnotation.getTargetType();
281
		buffer.append(
282
				Messages.bind(Messages.disassembler_extendedannotation_targetType, new String[] {
283
					Integer.toHexString(targetType),
284
					getTargetType(targetType),
285
				}));
286
		switch(targetType) {
287
			case IExtendedAnnotationConstants.METHOD_RECEIVER :
288
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE :
289
			case IExtendedAnnotationConstants.FIELD :
290
				break;
291
			default:
292
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
293
		}
294
		
295
		switch(targetType) {
296
			case IExtendedAnnotationConstants.WILDCARD_BOUND :
297
				int wildcardLocationType = extendedAnnotation.getWildcardLocationType();
298
				buffer.append(
299
						Messages.bind(Messages.disassembler_extendedannotation_wildcardlocationtype, new String[] {
300
							Integer.toString(wildcardLocationType),
301
							getTargetType(wildcardLocationType),
302
						}));
303
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
304
				disassembleTargetTypeContents(true, wildcardLocationType, extendedAnnotation, buffer, lineSeparator, tabNumber + 3, mode);
305
				break;
306
			case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
307
				wildcardLocationType = extendedAnnotation.getWildcardLocationType();
308
				buffer.append(
309
						Messages.bind(Messages.disassembler_extendedannotation_wildcardlocationtype, new String[] {
310
							Integer.toString(wildcardLocationType),
311
							getTargetType(wildcardLocationType),
312
						}));
313
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
314
				disassembleTargetTypeContents(true, wildcardLocationType, extendedAnnotation, buffer, lineSeparator, tabNumber + 3, mode);
315
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
316
				buffer.append(
317
						Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
318
							toString(extendedAnnotation.getLocations()),
319
						}));
320
				break;
321
			default:
322
				disassembleTargetTypeContents(false, targetType, extendedAnnotation, buffer, lineSeparator, tabNumber, mode);
323
		}
324
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
325
		buffer.append(Messages.disassembler_extendedannotationentryend);
326
	}
327
328
	private void disassembleTargetTypeContents(boolean insideWildcard, int targetType, IExtendedAnnotation extendedAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
329
		switch(targetType) {
330
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS :
331
				buffer.append(
332
					Messages.bind(Messages.disassembler_extendedannotation_classextendsimplements, new String[] {
333
						Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
334
					}));
335
				break;
336
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
337
				buffer.append(
338
						Messages.bind(Messages.disassembler_extendedannotation_classextendsimplements, new String[] {
339
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
340
						}));
341
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
342
				if (insideWildcard) {
343
					buffer.append(
344
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
345
								toString(extendedAnnotation.getWildcardLocations()),
346
							}));
347
				} else {
348
					buffer.append(
349
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
350
								toString(extendedAnnotation.getLocations()),
351
							}));
352
				}
353
				break;
354
			case IExtendedAnnotationConstants.TYPE_CAST :
355
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF :
356
			case IExtendedAnnotationConstants.OBJECT_CREATION :
357
			case IExtendedAnnotationConstants.CLASS_LITERAL :
358
				buffer.append(
359
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
360
							Integer.toString(extendedAnnotation.getOffset()),
361
						}));
362
				break;
363
			case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY :
364
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
365
			case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
366
			case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
367
				buffer.append(
368
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
369
							Integer.toString(extendedAnnotation.getOffset()),
370
						}));
371
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
372
				if (insideWildcard) {
373
					buffer.append(
374
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
375
								toString(extendedAnnotation.getWildcardLocations()),
376
							}));
377
				} else {
378
					buffer.append(
379
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
380
								toString(extendedAnnotation.getLocations()),
381
							}));
382
				}
383
				break;
384
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER :
385
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER :
386
				buffer.append(
387
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter, new String[] {
388
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
389
						}));
390
				break;
391
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY :
392
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY :
393
				buffer.append(
394
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter, new String[] {
395
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
396
						}));
397
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
398
				if (insideWildcard) {
399
					buffer.append(
400
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
401
								toString(extendedAnnotation.getWildcardLocations()),
402
							}));
403
				} else {
404
					buffer.append(
405
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
406
								toString(extendedAnnotation.getLocations()),
407
							}));
408
				}
409
				break;
410
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND :
411
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND :
412
				buffer.append(
413
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter_with_bound, new String[] {
414
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
415
							Integer.toString(extendedAnnotation.getTypeParameterBoundIndex()),
416
						}));
417
				break;
418
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
419
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
420
				buffer.append(
421
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter_with_bound, new String[] {
422
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
423
							Integer.toString(extendedAnnotation.getTypeParameterBoundIndex()),
424
						}));
425
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
426
				if (insideWildcard) {
427
					buffer.append(
428
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
429
								toString(extendedAnnotation.getWildcardLocations()),
430
							}));
431
				} else {
432
					buffer.append(
433
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
434
								toString(extendedAnnotation.getLocations()),
435
							}));
436
				}
437
				break;
438
			case IExtendedAnnotationConstants.LOCAL_VARIABLE :
439
				buffer.append(Messages.disassembler_localvariabletargetheader);
440
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
441
				int localVariableTableSize = extendedAnnotation.getLocalVariableRefenceInfoLength();
442
				ILocalVariableReferenceInfo[] localVariableTable = extendedAnnotation.getLocalVariableTable();
443
				for (int i = 0; i < localVariableTableSize; i++) {
444
					if (i != 0) {
445
						writeNewLine(buffer, lineSeparator, tabNumber + 3);
446
					}
447
					ILocalVariableReferenceInfo info = localVariableTable[i];
448
					int index= info.getIndex();
449
					int startPC = info.getStartPC();
450
					int length  = info.getLength();
451
					buffer.append(Messages.bind(Messages.classfileformat_localvariablereferenceinfoentry,
452
						new String[] {
453
							Integer.toString(startPC),
454
							Integer.toString(startPC + length),
455
							Integer.toString(index),
456
						}));
457
				}
458
				break;
459
			case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
460
				buffer.append(Messages.disassembler_localvariabletargetheader);
461
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
462
				localVariableTableSize = extendedAnnotation.getLocalVariableRefenceInfoLength();
463
				localVariableTable = extendedAnnotation.getLocalVariableTable();
464
				for (int i = 0; i < localVariableTableSize; i++) {
465
					if (i != 0) {
466
						writeNewLine(buffer, lineSeparator, tabNumber + 3);
467
					}
468
					ILocalVariableReferenceInfo info = localVariableTable[i];
469
					int index= info.getIndex();
470
					int startPC = info.getStartPC();
471
					int length  = info.getLength();
472
					buffer.append(Messages.bind(Messages.classfileformat_localvariablereferenceinfoentry,
473
						new String[] {
474
							Integer.toString(startPC),
475
							Integer.toString(startPC + length),
476
							Integer.toString(index),
477
						}));
478
				}
479
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
480
				if (insideWildcard) {
481
					buffer.append(
482
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
483
								toString(extendedAnnotation.getWildcardLocations()),
484
							}));
485
				} else {
486
					buffer.append(
487
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
488
								toString(extendedAnnotation.getLocations()),
489
							}));
490
				}
491
				break;
492
			case IExtendedAnnotationConstants.METHOD_PARAMETER :
493
				buffer.append(
494
						Messages.bind(Messages.disassembler_extendedannotation_method_parameter, new String[] {
495
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
496
						}));
497
				break;
498
			case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
499
				buffer.append(
500
						Messages.bind(Messages.disassembler_extendedannotation_method_parameter, new String[] {
501
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
502
						}));
503
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
504
				if (insideWildcard) {
505
					buffer.append(
506
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
507
								toString(extendedAnnotation.getWildcardLocations()),
508
							}));
509
				} else {
510
					buffer.append(
511
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
512
								toString(extendedAnnotation.getLocations()),
513
							}));
514
				}
515
				break;
516
			case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
517
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY :
518
			case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY :
519
				if (insideWildcard) {
520
					buffer.append(
521
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
522
								toString(extendedAnnotation.getWildcardLocations()),
523
							}));
524
				} else {
525
					buffer.append(
526
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
527
								toString(extendedAnnotation.getLocations()),
528
							}));
529
				}
530
				break;
531
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
532
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL :
533
				buffer.append(
534
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
535
							Integer.toString(extendedAnnotation.getOffset()),
536
						}));
537
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
538
				buffer.append(
539
						Messages.bind(Messages.disassembler_extendedannotation_type_argument, new String[] {
540
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
541
						}));
542
				break;
543
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
544
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
545
				buffer.append(
546
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
547
							Integer.toString(extendedAnnotation.getOffset()),
548
						}));
549
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
550
				buffer.append(
551
						Messages.bind(Messages.disassembler_extendedannotation_type_argument, new String[] {
552
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
553
						}));
554
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
555
				if (insideWildcard) {
556
					buffer.append(
557
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
558
								toString(extendedAnnotation.getWildcardLocations()),
559
							}));
560
				} else {
561
					buffer.append(
562
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
563
								toString(extendedAnnotation.getLocations()),
564
							}));
565
				}
566
				break;
567
			case IExtendedAnnotationConstants.THROWS :
568
				buffer.append(
569
						Messages.bind(Messages.disassembler_extendedannotation_throws, new String[] {
570
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
571
						}));
572
				break;
573
			case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY :
574
				buffer.append(
575
						Messages.bind(Messages.disassembler_extendedannotation_throws, new String[] {
576
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
577
						}));
578
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
579
				if (insideWildcard) {
580
					buffer.append(
581
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
582
								toString(extendedAnnotation.getWildcardLocations()),
583
							}));
584
				} else {
585
					buffer.append(
586
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
587
								toString(extendedAnnotation.getLocations()),
588
							}));
589
				}
590
				break;
591
		}
592
	}
593
	private String getTargetType(int targetType) {
594
		switch(targetType) {
595
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS :
596
				return "CLASS_EXTENDS_IMPLEMENTS"; //$NON-NLS-1$
597
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
598
				return "CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY"; //$NON-NLS-1$
599
			case IExtendedAnnotationConstants.TYPE_CAST :
600
				return "TYPE_CAST"; //$NON-NLS-1$
601
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF :
602
				return "TYPE_INSTANCEOF"; //$NON-NLS-1$
603
			case IExtendedAnnotationConstants.OBJECT_CREATION :
604
				return "OBJECT_CREATION"; //$NON-NLS-1$
605
			case IExtendedAnnotationConstants.CLASS_LITERAL :
606
				return "CLASS_LITERAL"; //$NON-NLS-1$
607
			case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY :
608
				return "TYPE_CAST_GENERIC_OR_ARRAY"; //$NON-NLS-1$
609
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
610
				return "TYPE_INSTANCEOF_GENERIC_OR_ARRAY"; //$NON-NLS-1$
611
			case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
612
				return "OBJECT_CREATION_GENERIC_OR_ARRAY"; //$NON-NLS-1$
613
			case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
614
				return "CLASS_LITERAL_GENERIC_OR_ARRAY"; //$NON-NLS-1$
615
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER :
616
				return "CLASS_TYPE_PARAMETER"; //$NON-NLS-1$
617
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER :
618
				return "METHOD_TYPE_PARAMETER"; //$NON-NLS-1$
619
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY :
620
				return "CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
621
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY :
622
				return "METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
623
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND :
624
				return "METHOD_TYPE_PARAMETER_BOUND"; //$NON-NLS-1$
625
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND :
626
				return "CLASS_TYPE_PARAMETER_BOUND"; //$NON-NLS-1$
627
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
628
				return "METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$
629
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
630
				return "CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$
631
			case IExtendedAnnotationConstants.LOCAL_VARIABLE :
632
				return "LOCAL_VARIABLE"; //$NON-NLS-1$
633
			case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
634
				return "LOCAL_VARIABLE_GENERIC_OR_ARRAY"; //$NON-NLS-1$
635
			case IExtendedAnnotationConstants.METHOD_PARAMETER :
636
				return "METHOD_PARAMETER"; //$NON-NLS-1$
637
			case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
638
				return "METHOD_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
639
			case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
640
				return "METHOD_RECEIVER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
641
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY :
642
				return "METHOD_RETURN_TYPE_GENERIC_OR_ARRAY"; //$NON-NLS-1$
643
			case IExtendedAnnotationConstants.METHOD_RECEIVER :
644
				return "METHOD_RECEIVER"; //$NON-NLS-1$
645
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE :
646
				return "METHOD_RETURN_TYPE"; //$NON-NLS-1$
647
			case IExtendedAnnotationConstants.FIELD :
648
				return "FIELD"; //$NON-NLS-1$
649
			case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY :
650
				return "FIELD_GENERIC_OR_ARRAY"; //$NON-NLS-1$
651
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
652
				return "TYPE_ARGUMENT_CONSTRUCTOR_CALL"; //$NON-NLS-1$
653
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL :
654
				return "TYPE_ARGUMENT_METHOD_CALL"; //$NON-NLS-1$
655
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
656
				return "TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY"; //$NON-NLS-1$
657
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
658
				return "TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY"; //$NON-NLS-1$
659
			case IExtendedAnnotationConstants.THROWS :
660
				return "THROWS"; //$NON-NLS-1$
661
			case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY :
662
				return "THROWS_GENERIC_OR_ARRAY"; //$NON-NLS-1$
663
			case IExtendedAnnotationConstants.WILDCARD_BOUND :
664
				return "WILDCARD_BOUND"; //$NON-NLS-1$
665
			case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
666
				return "WILDCARD_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$
667
			default:
668
				return "UNKNOWN"; //$NON-NLS-1$
669
		}
670
	}
671
262
	private void disassemble(IAnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
672
	private void disassemble(IAnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
263
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
673
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
264
		buffer.append(
674
		buffer.append(
Lines 465-470 Link Here
465
		final ISignatureAttribute signatureAttribute = (ISignatureAttribute) Util.getAttribute(methodInfo, IAttributeNamesConstants.SIGNATURE);
875
		final ISignatureAttribute signatureAttribute = (ISignatureAttribute) Util.getAttribute(methodInfo, IAttributeNamesConstants.SIGNATURE);
466
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
876
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
467
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
877
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
878
		final IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
879
		final IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
468
		final IClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS);
880
		final IClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS);
469
		final IClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS);
881
		final IClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS);
470
		final IClassFileAttribute annotationDefaultAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.ANNOTATION_DEFAULT);
882
		final IClassFileAttribute annotationDefaultAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.ANNOTATION_DEFAULT);
Lines 685-690 Link Here
685
							&& attribute != annotationDefaultAttribute
1097
							&& attribute != annotationDefaultAttribute
686
							&& attribute != runtimeInvisibleAnnotationsAttribute
1098
							&& attribute != runtimeInvisibleAnnotationsAttribute
687
							&& attribute != runtimeVisibleAnnotationsAttribute
1099
							&& attribute != runtimeVisibleAnnotationsAttribute
1100
							&& attribute != runtimeInvisibleTypeAnnotationsAttribute
1101
							&& attribute != runtimeVisibleTypeAnnotationsAttribute
688
							&& attribute != runtimeInvisibleParameterAnnotationsAttribute
1102
							&& attribute != runtimeInvisibleParameterAnnotationsAttribute
689
							&& attribute != runtimeVisibleParameterAnnotationsAttribute
1103
							&& attribute != runtimeVisibleParameterAnnotationsAttribute
690
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
1104
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
Lines 708-713 Link Here
708
			}
1122
			}
709
			if (runtimeInvisibleParameterAnnotationsAttribute != null) {
1123
			if (runtimeInvisibleParameterAnnotationsAttribute != null) {
710
				disassemble((IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1124
				disassemble((IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1125
			}
1126
			if (runtimeVisibleTypeAnnotationsAttribute != null) {
1127
				disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1128
			}
1129
			if (runtimeInvisibleTypeAnnotationsAttribute != null) {
1130
				disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
711
			}
1131
			}
712
		}
1132
		}
713
	}
1133
	}
Lines 1584-1589 Link Here
1584
		}
2004
		}
1585
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
2005
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
1586
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
2006
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
2007
		final IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
2008
		final IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
1587
		if (checkMode(mode, DETAILED)) {
2009
		if (checkMode(mode, DETAILED)) {
1588
			// disassemble compact version of annotations
2010
			// disassemble compact version of annotations
1589
			if (runtimeInvisibleAnnotationsAttribute != null) {
2011
			if (runtimeInvisibleAnnotationsAttribute != null) {
Lines 1670-1675 Link Here
1670
						&& attribute != signatureAttribute
2092
						&& attribute != signatureAttribute
1671
						&& attribute != runtimeInvisibleAnnotationsAttribute
2093
						&& attribute != runtimeInvisibleAnnotationsAttribute
1672
						&& attribute != runtimeVisibleAnnotationsAttribute
2094
						&& attribute != runtimeVisibleAnnotationsAttribute
2095
						&& attribute != runtimeInvisibleTypeAnnotationsAttribute
2096
						&& attribute != runtimeVisibleTypeAnnotationsAttribute
1673
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
2097
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
1674
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
2098
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
1675
						disassemble(attribute, buffer, lineSeparator, tabNumber, mode);
2099
						disassemble(attribute, buffer, lineSeparator, tabNumber, mode);
Lines 1681-1686 Link Here
1681
			}
2105
			}
1682
			if (runtimeInvisibleAnnotationsAttribute != null) {
2106
			if (runtimeInvisibleAnnotationsAttribute != null) {
1683
				disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
2107
				disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
2108
			}
2109
			if (runtimeVisibleTypeAnnotationsAttribute != null) {
2110
				disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
2111
			}
2112
			if (runtimeInvisibleTypeAnnotationsAttribute != null) {
2113
				disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1684
			}
2114
			}
1685
		}
2115
		}
1686
	}
2116
	}
Lines 1822-1827 Link Here
1822
		IAnnotation[] annotations = runtimeVisibleAnnotationsAttribute.getAnnotations();
2252
		IAnnotation[] annotations = runtimeVisibleAnnotationsAttribute.getAnnotations();
1823
		for (int i = 0, max = annotations.length; i < max; i++) {
2253
		for (int i = 0, max = annotations.length; i < max; i++) {
1824
			disassemble(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
2254
			disassemble(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
2255
		}
2256
	}
2257
2258
	private void disassemble(IRuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
2259
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
2260
		buffer.append(Messages.disassembler_runtimeinvisibletypeannotationsattributeheader);
2261
		IExtendedAnnotation[] extendedAnnotations = runtimeInvisibleTypeAnnotationsAttribute.getExtendedAnnotations();
2262
		for (int i = 0, max = extendedAnnotations.length; i < max; i++) {
2263
			disassemble(extendedAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode);
2264
		}
2265
	}
2266
2267
	private void disassemble(IRuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
2268
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
2269
		buffer.append(Messages.disassembler_runtimevisibletypeannotationsattributeheader);
2270
		IExtendedAnnotation[] extendedAnnotations = runtimeVisibleTypeAnnotationsAttribute.getExtendedAnnotations();
2271
		for (int i = 0, max = extendedAnnotations.length; i < max; i++) {
2272
			disassemble(extendedAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode);
1825
		}
2273
		}
1826
	}
2274
	}
1827
2275
Lines 2267-2270 Link Here
2267
		buffer.append(lineSeparator);
2715
		buffer.append(lineSeparator);
2268
		dumpTab(tabNumber, buffer);
2716
		dumpTab(tabNumber, buffer);
2269
	}
2717
	}
2718
	
2719
	private String toString(int[] tab) {
2720
		StringBuffer buffer = new StringBuffer();
2721
		buffer.append('{');
2722
		for (int i = 0, max = tab.length; i < max; i++) {
2723
			if (i > 0) {
2724
				buffer.append(',');
2725
			}
2726
			buffer.append(tab[i]);
2727
		}
2728
		buffer.append('}');
2729
		return String.valueOf(buffer);
2730
	}
2270
}
2731
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java (+362 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.core.util;
16
17
import org.eclipse.jdt.core.util.ClassFormatException;
18
import org.eclipse.jdt.core.util.IAnnotationComponent;
19
import org.eclipse.jdt.core.util.IConstantPool;
20
import org.eclipse.jdt.core.util.IConstantPoolConstant;
21
import org.eclipse.jdt.core.util.IConstantPoolEntry;
22
import org.eclipse.jdt.core.util.IExtendedAnnotation;
23
import org.eclipse.jdt.core.util.IExtendedAnnotationConstants;
24
import org.eclipse.jdt.core.util.ILocalVariableReferenceInfo;
25
26
/**
27
 * Default implementation of IAnnotation
28
 */
29
public class ExtendedAnnotation extends ClassFileStruct implements IExtendedAnnotation {
30
31
	private static final IAnnotationComponent[] NO_ENTRIES = new IAnnotationComponent[0];
32
33
	private int typeIndex;
34
	private char[] typeName;
35
	private int componentsNumber;
36
	private IAnnotationComponent[] components;
37
	private int readOffset;
38
	private int targetType;
39
	private int annotationTypeIndex;
40
	private int offset;
41
	private int typeParameterIndex;
42
	private int typeParameterBoundIndex;
43
	private int parameterIndex;
44
	private int wildcardLocationType;
45
	private ILocalVariableReferenceInfo[] localVariableTable;
46
	private int[] locations;
47
	private int[] wildcardLocations;
48
	/**
49
	 * Constructor for Annotation.
50
	 *
51
	 * @param classFileBytes
52
	 * @param constantPool
53
	 * @param offset
54
	 * @throws ClassFormatException
55
	 */
56
	public ExtendedAnnotation(
57
			byte[] classFileBytes,
58
			IConstantPool constantPool,
59
			int offset) throws ClassFormatException {
60
61
		int index = u2At(classFileBytes, 0, offset);
62
		this.typeIndex = index;
63
		if (index != 0) {
64
			IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
65
			if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
66
				throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
67
			}
68
			this.typeName = constantPoolEntry.getUtf8Value();
69
		} else {
70
			throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
71
		}
72
		final int length = u2At(classFileBytes, 2, offset);
73
		this.componentsNumber = length;
74
		this.readOffset = 4;
75
		if (length != 0) {
76
			this.components = new IAnnotationComponent[length];
77
			for (int i = 0; i < length; i++) {
78
				AnnotationComponent component = new AnnotationComponent(classFileBytes, constantPool, offset + this.readOffset);
79
				this.components[i] = component;
80
				this.readOffset += component.sizeInBytes();
81
			}
82
		} else {
83
			this.components = NO_ENTRIES;
84
		}
85
		index = u1At(classFileBytes, this.readOffset, offset);
86
		this.readOffset++;
87
		this.targetType = index;
88
		switch(index) {
89
			case IExtendedAnnotationConstants.WILDCARD_BOUND :
90
				this.wildcardLocationType = u1At(classFileBytes, this.readOffset, offset);
91
				this.readOffset++;
92
				internalDecoding(this.wildcardLocationType, classFileBytes, constantPool, offset);
93
				// copy the location back into the wildcard location
94
				int size = this.locations.length;
95
				System.arraycopy(this.locations, 0, (this.wildcardLocations = new int[size]), 0, size);
96
				this.locations = null;
97
				break;
98
			case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
99
				this.wildcardLocationType = u1At(classFileBytes, this.readOffset, offset);
100
				this.readOffset++;
101
				internalDecoding(this.wildcardLocationType, classFileBytes, constantPool, offset);
102
				size = this.locations.length;
103
				System.arraycopy(this.locations, 0, (this.wildcardLocations = new int[size]), 0, size);
104
				int locationLength = u2At(classFileBytes, this.readOffset, offset);
105
				this.readOffset += 2;
106
				this.locations = new int[locationLength];
107
				for (int i = 0; i < locationLength; i++) {
108
					this.locations[i] = u1At(classFileBytes, this.readOffset, offset);
109
					this.readOffset++;
110
				}
111
				break;
112
			default:
113
				internalDecoding(index, classFileBytes, constantPool, offset);
114
		}
115
		if (this.annotationTypeIndex == 0xFFFF) {
116
			this.annotationTypeIndex = -1;
117
		}
118
	}
119
	
120
	private void internalDecoding(
121
			int localTargetType,
122
			byte[] classFileBytes,
123
			IConstantPool constantPool,
124
			int localOffset) throws ClassFormatException {
125
		switch(localTargetType) {
126
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS :
127
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
128
				this.readOffset+=2;
129
				break;
130
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
131
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
132
				this.readOffset+=2;
133
				int locationLength = u2At(classFileBytes, this.readOffset, localOffset);
134
				this.readOffset += 2;
135
				this.locations = new int[locationLength];
136
				for (int i = 0; i < locationLength; i++) {
137
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
138
					this.readOffset++;
139
				}
140
				break;
141
			case IExtendedAnnotationConstants.TYPE_CAST :
142
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF :
143
			case IExtendedAnnotationConstants.OBJECT_CREATION :
144
			case IExtendedAnnotationConstants.CLASS_LITERAL :
145
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
146
				this.readOffset += 2;
147
				break;
148
			case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY :
149
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
150
			case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
151
			case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
152
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
153
				this.readOffset += 2;
154
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
155
				this.readOffset += 2;
156
				this.locations = new int[locationLength];
157
				for (int i = 0; i < locationLength; i++) {
158
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
159
					this.readOffset++;
160
				}
161
				break;
162
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER :
163
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER :
164
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
165
				this.readOffset++;
166
				break;
167
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY :
168
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY :
169
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
170
				this.readOffset++;
171
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
172
				this.readOffset += 2;
173
				this.locations = new int[locationLength];
174
				for (int i = 0; i < locationLength; i++) {
175
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
176
					this.readOffset++;
177
				}
178
				break;
179
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND :
180
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND :
181
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
182
				this.readOffset++;
183
				this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset);
184
				this.readOffset++;
185
				break;
186
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
187
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
188
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
189
				this.readOffset++;
190
				this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset);
191
				this.readOffset++;
192
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
193
				this.readOffset += 2;
194
				this.locations = new int[locationLength];
195
				for (int i = 0; i < locationLength; i++) {
196
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
197
					this.readOffset++;
198
				}
199
				break;
200
			case IExtendedAnnotationConstants.LOCAL_VARIABLE :
201
				int tableLength = u2At(classFileBytes, this.readOffset, localOffset);
202
				this.readOffset += 2;
203
				this.localVariableTable = new LocalVariableReferenceInfo[tableLength];
204
				for (int i = 0; i < tableLength; i++) {
205
					this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset);
206
					this.readOffset += 6;
207
				}
208
				break;
209
			case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
210
				tableLength = u2At(classFileBytes, this.readOffset, localOffset);
211
				this.readOffset += 2;
212
				this.localVariableTable = new LocalVariableReferenceInfo[tableLength];
213
				for (int i = 0; i < tableLength; i++) {
214
					this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset);
215
					this.readOffset += 6;
216
				}
217
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
218
				this.readOffset += 2;
219
				this.locations = new int[locationLength];
220
				for (int i = 0; i < locationLength; i++) {
221
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
222
					this.readOffset++;
223
				}
224
				break;
225
			case IExtendedAnnotationConstants.METHOD_PARAMETER :
226
				this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
227
				this.readOffset++;
228
				break;
229
			case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
230
				this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
231
				this.readOffset++;
232
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
233
				this.readOffset += 2;
234
				this.locations = new int[locationLength];
235
				for (int i = 0; i < locationLength; i++) {
236
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
237
					this.readOffset++;
238
				}
239
				break;
240
			case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
241
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY :
242
			case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY :
243
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
244
				this.readOffset += 2;
245
				this.locations = new int[locationLength];
246
				for (int i = 0; i < locationLength; i++) {
247
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
248
					this.readOffset++;
249
				}
250
				break;
251
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
252
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL :
253
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
254
				this.readOffset += 2;
255
				this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);
256
				this.readOffset++;
257
				break;
258
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
259
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
260
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
261
				this.readOffset += 2;
262
				this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);
263
				this.readOffset++;
264
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
265
				this.readOffset += 2;
266
				this.locations = new int[locationLength];
267
				for (int i = 0; i < locationLength; i++) {
268
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
269
					this.readOffset++;
270
				}
271
				break;
272
			case IExtendedAnnotationConstants.THROWS :
273
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
274
				this.readOffset+=2;
275
				break;
276
			case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY :
277
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
278
				this.readOffset+=2;
279
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
280
				this.readOffset += 2;
281
				this.locations = new int[locationLength];
282
				for (int i = 0; i < locationLength; i++) {
283
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
284
					this.readOffset++;
285
				}
286
				break;
287
		}
288
	}
289
290
	/* (non-Javadoc)
291
	 * @see org.eclipse.jdt.core.util.IAnnotation#getTypeIndex()
292
	 */
293
	public int getTypeIndex() {
294
		return this.typeIndex;
295
	}
296
	/* (non-Javadoc)
297
	 * @see org.eclipse.jdt.core.util.IAnnotation#getComponentsNumber()
298
	 */
299
	public int getComponentsNumber() {
300
		return this.componentsNumber;
301
	}
302
	/* (non-Javadoc)
303
	 * @see org.eclipse.jdt.core.util.IAnnotation#getComponents()
304
	 */
305
	public IAnnotationComponent[] getComponents() {
306
		return this.components;
307
	}
308
309
	int sizeInBytes() {
310
		return this.readOffset;
311
	}
312
	/* (non-Javadoc)
313
	 * @see org.eclipse.jdt.core.util.IAnnotation#getTypeName()
314
	 */
315
	public char[] getTypeName() {
316
		return this.typeName;
317
	}
318
319
	public int getTargetType() {
320
		return this.targetType;
321
	}
322
323
	public int getOffset() {
324
		return this.offset;
325
	}
326
327
	public int getLocalVariableRefenceInfoLength() {
328
		return this.localVariableTable != null ? this.localVariableTable.length : 0;
329
	}
330
331
	public ILocalVariableReferenceInfo[] getLocalVariableTable() {
332
		return this.localVariableTable;
333
	}
334
335
	public int getParameterIndex() {
336
		return this.parameterIndex;
337
	}
338
339
	public int getTypeParameterIndex() {
340
		return this.typeParameterIndex;
341
	}
342
343
	public int getTypeParameterBoundIndex() {
344
		return this.typeParameterBoundIndex;
345
	}
346
347
	public int getWildcardLocationType() {
348
		return this.wildcardLocationType;
349
	}
350
351
	public int[] getWildcardLocations() {
352
		return this.wildcardLocations;
353
	}
354
355
	public int[] getLocations() {
356
		return this.locations;
357
	}
358
359
	public int getAnnotationTypeIndex() {
360
		return this.annotationTypeIndex;
361
	}
362
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java (-1 / +9 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 90-95 Link Here
90
				this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
94
				this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
91
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
95
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
92
				this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
96
				this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
97
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
98
				this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
99
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
100
				this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
93
			} else {
101
			} else {
94
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
102
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
95
			}
103
			}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java (+67 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.core.util;
16
17
import org.eclipse.jdt.core.util.ClassFormatException;
18
import org.eclipse.jdt.core.util.IConstantPool;
19
import org.eclipse.jdt.core.util.ILocalVariableReferenceInfo;
20
21
/**
22
 * Default implementation of ILocalVariableTableEntry
23
 */
24
public class LocalVariableReferenceInfo extends ClassFileStruct implements ILocalVariableReferenceInfo {
25
26
	private int startPC;
27
	private int length;
28
	private int index;
29
30
	/**
31
	 * Constructor for LocalVariableTableEntry.
32
	 *
33
	 * @param classFileBytes
34
	 * @param constantPool
35
	 * @param offset
36
	 * @throws ClassFormatException
37
	 */
38
	public LocalVariableReferenceInfo(
39
			byte[] classFileBytes,
40
			IConstantPool constantPool,
41
			int offset) throws ClassFormatException {
42
		this.startPC = u2At(classFileBytes, 0, offset);
43
		this.length = u2At(classFileBytes, 2, offset);
44
		this.index = u2At(classFileBytes, 4, offset);
45
	}
46
47
	/**
48
	 * @see ILocalVariableReferenceInfo#getStartPC()
49
	 */
50
	public int getStartPC() {
51
		return this.startPC;
52
	}
53
54
	/**
55
	 * @see ILocalVariableReferenceInfo#getLength()
56
	 */
57
	public int getLength() {
58
		return this.length;
59
	}
60
61
	/**
62
	 * @see ILocalVariableReferenceInfo#getIndex()
63
	 */
64
	public int getIndex() {
65
		return this.index;
66
	}
67
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java (+23 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 294-299 Link Here
294
	public static String disassembler_annotationentrystart;
298
	public static String disassembler_annotationentrystart;
295
	public static String disassembler_annotationentryend;
299
	public static String disassembler_annotationentryend;
296
	public static String disassembler_annotationcomponent;
300
	public static String disassembler_annotationcomponent;
301
	// jsr308
302
	public static String disassembler_extendedannotationentrystart;
303
	public static String disassembler_extendedannotationentryend;
304
	public static String disassembler_runtimevisibletypeannotationsattributeheader;
305
	public static String disassembler_runtimeinvisibletypeannotationsattributeheader;
306
	public static String disassembler_extendedannotation_classextendsimplements;
307
	public static String disassembler_extendedannotation_locations;
308
	public static String disassembler_extendedannotation_method_parameter;
309
	public static String disassembler_extendedannotation_offset;
310
	public static String disassembler_extendedannotation_throws;
311
	public static String disassembler_extendedannotation_type_argument;
312
	public static String disassembler_extendedannotation_type_parameter;
313
	public static String disassembler_extendedannotation_type_parameter_with_bound;
314
	public static String disassembler_extendedannotation_wildcardlocationtype;
315
	public static String disassembler_extendedannotation_targetType;
316
	public static String disassembler_extendedannotation_wildcardlocations;
317
	public static String disassembler_localvariabletargetheader;
318
	public static String classfileformat_localvariablereferenceinfoentry;
319
297
	public static String disassembler_runtimevisibleannotationsattributeheader;
320
	public static String disassembler_runtimevisibleannotationsattributeheader;
298
	public static String disassembler_runtimeinvisibleannotationsattributeheader;
321
	public static String disassembler_runtimeinvisibleannotationsattributeheader;
299
	public static String disassembler_runtimevisibleparameterannotationsattributeheader;
322
	public static String disassembler_runtimevisibleparameterannotationsattributeheader;
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java (-1 / +9 lines)
Lines 1-10 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 114-119 Link Here
114
				this.attributes[attributesIndex++] = new RuntimeInvisibleParameterAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
118
				this.attributes[attributesIndex++] = new RuntimeInvisibleParameterAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
115
			} else if (equals(attributeName, IAttributeNamesConstants.ANNOTATION_DEFAULT)) {
119
			} else if (equals(attributeName, IAttributeNamesConstants.ANNOTATION_DEFAULT)) {
116
				this.attributes[attributesIndex++] = new AnnotationDefaultAttribute(classFileBytes, constantPool, offset + readOffset);
120
				this.attributes[attributesIndex++] = new AnnotationDefaultAttribute(classFileBytes, constantPool, offset + readOffset);
121
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
122
				this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
123
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
124
				this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
117
			} else {
125
			} else {
118
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
126
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
119
			}
127
			}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java (+74 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.core.util;
16
17
import org.eclipse.jdt.core.util.ClassFormatException;
18
import org.eclipse.jdt.core.util.IConstantPool;
19
import org.eclipse.jdt.core.util.IExtendedAnnotation;
20
import org.eclipse.jdt.core.util.IRuntimeInvisibleTypeAnnotationsAttribute;
21
22
/**
23
 * Default implementation of IRuntimeInvisibleTypeAnnotations
24
 */
25
public class RuntimeInvisibleTypeAnnotationsAttribute
26
	extends ClassFileAttribute
27
	implements IRuntimeInvisibleTypeAnnotationsAttribute {
28
29
	private static final IExtendedAnnotation[] NO_ENTRIES = new IExtendedAnnotation[0];
30
	private int extendedAnnotationsNumber;
31
	private IExtendedAnnotation[] extendedAnnotations;
32
33
	/**
34
	 * Constructor for RuntimeInvisibleTypeAnnotations.
35
	 * @param classFileBytes
36
	 * @param constantPool
37
	 * @param offset
38
	 * @throws ClassFormatException
39
	 */
40
	public RuntimeInvisibleTypeAnnotationsAttribute(
41
			byte[] classFileBytes,
42
			IConstantPool constantPool,
43
			int offset)
44
			throws ClassFormatException {
45
		super(classFileBytes, constantPool, offset);
46
		// read extended annotations
47
		final int length = u2At(classFileBytes, 6, offset);
48
		this.extendedAnnotationsNumber = length;
49
		if (length != 0) {
50
			int readOffset = 8;
51
			this.extendedAnnotations = new IExtendedAnnotation[length];
52
			for (int i = 0; i < length; i++) {
53
				ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset);
54
				this.extendedAnnotations[i] = extendedAnnotation;
55
				readOffset += extendedAnnotation.sizeInBytes();
56
			}
57
		} else {
58
			this.extendedAnnotations = NO_ENTRIES;
59
		}
60
	}
61
62
	/* (non-Javadoc)
63
	 * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotations()
64
	 */
65
	public IExtendedAnnotation[] getExtendedAnnotations() {
66
		return this.extendedAnnotations;
67
	}
68
	/* (non-Javadoc)
69
	 * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotationsNumber()
70
	 */
71
	public int getExtendedAnnotationsNumber() {
72
		return this.extendedAnnotationsNumber;
73
	}
74
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java (+71 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.internal.core.util;
16
17
import org.eclipse.jdt.core.util.ClassFormatException;
18
import org.eclipse.jdt.core.util.IConstantPool;
19
import org.eclipse.jdt.core.util.IExtendedAnnotation;
20
import org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotationsAttribute;
21
22
/**
23
 * Default implementation of IRuntimeVisibleTypeAnnotations
24
 */
25
public class RuntimeVisibleTypeAnnotationsAttribute
26
	extends ClassFileAttribute
27
	implements IRuntimeVisibleTypeAnnotationsAttribute {
28
29
	private static final IExtendedAnnotation[] NO_ENTRIES = new IExtendedAnnotation[0];
30
	private int extendedAnnotationsNumber;
31
	private IExtendedAnnotation[] extendedAnnotations;
32
33
	/**
34
	 * Constructor for RuntimeVisibleTypeAnnotations.
35
	 * @param classFileBytes
36
	 * @param constantPool
37
	 * @param offset
38
	 * @throws ClassFormatException
39
	 */
40
	public RuntimeVisibleTypeAnnotationsAttribute(
41
			byte[] classFileBytes,
42
			IConstantPool constantPool,
43
			int offset) throws ClassFormatException {
44
		super(classFileBytes, constantPool, offset);
45
		final int length = u2At(classFileBytes, 6, offset);
46
		this.extendedAnnotationsNumber = length;
47
		if (length != 0) {
48
			int readOffset = 8;
49
			this.extendedAnnotations = new IExtendedAnnotation[length];
50
			for (int i = 0; i < length; i++) {
51
				ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset);
52
				this.extendedAnnotations[i] = extendedAnnotation;
53
				readOffset += extendedAnnotation.sizeInBytes();
54
			}
55
		} else {
56
			this.extendedAnnotations = NO_ENTRIES;
57
		}
58
	}
59
	/* (non-Javadoc)
60
	 * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotations#getAnnotations()
61
	 */
62
	public IExtendedAnnotation[] getExtendedAnnotations() {
63
		return this.extendedAnnotations;
64
	}
65
	/* (non-Javadoc)
66
	 * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotations#getAnnotationsNumber()
67
	 */
68
	public int getExtendedAnnotationsNumber() {
69
		return this.extendedAnnotationsNumber;
70
	}
71
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties (+26 lines)
Lines 5-10 Link Here
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
7
#
8
# This is an implementation of an early-draft specification developed under the Java
9
# Community Process (JCP) and is made available for testing and evaluation purposes
10
# only. The code is not compatible with any specification of the JCP.
11
# 
8
# Contributors:
12
# Contributors:
9
#     IBM Corporation - initial API and implementation
13
#     IBM Corporation - initial API and implementation
10
###############################################################################
14
###############################################################################
Lines 319-327 Link Here
319
disassembler_annotationarrayvalueend = ]
323
disassembler_annotationarrayvalueend = ]
320
disassembler_annotationentrystart = #{0} @{1}(
324
disassembler_annotationentrystart = #{0} @{1}(
321
disassembler_annotationentryend = )
325
disassembler_annotationentryend = )
326
# jsr308
327
disassembler_extendedannotationentrystart=#{0} @{1}(
328
disassembler_extendedannotationentryend= )
322
disassembler_annotationcomponent = #{0} {1}=
329
disassembler_annotationcomponent = #{0} {1}=
323
disassembler_runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\ 
330
disassembler_runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\ 
324
disassembler_runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\ 
331
disassembler_runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\ 
332
disassembler_runtimevisibletypeannotationsattributeheader= RuntimeVisibleTypeAnnotations:\ 
333
disassembler_runtimeinvisibletypeannotationsattributeheader= RuntimeInvisibleTypeAnnotations:\ 
325
disassembler_runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\ 
334
disassembler_runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\ 
326
disassembler_runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\ 
335
disassembler_runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\ 
327
disassembler_parameterannotationentrystart=Number of annotations for parameter {0}: {1}
336
disassembler_parameterannotationentrystart=Number of annotations for parameter {0}: {1}
Lines 347-352 Link Here
347
disassembler_frame_full_frame=[pc: {0}, full, stack: {4}, locals: {2}]
356
disassembler_frame_full_frame=[pc: {0}, full, stack: {4}, locals: {2}]
348
disassembler_frame_same_frame=[pc: {0}, same]
357
disassembler_frame_same_frame=[pc: {0}, same]
349
disassembler_frame_same_locals_1_stack_item=[pc: {0}, same_locals_1_stack_item, stack: {1}]
358
disassembler_frame_same_locals_1_stack_item=[pc: {0}, same_locals_1_stack_item, stack: {1}]
359
360
# jsr 308
361
disassembler_extendedannotation_targetType=target type = 0x{0} {1}
362
disassembler_extendedannotation_classextendsimplements=type index = {0}
363
disassembler_extendedannotation_locations=locations = {0}
364
disassembler_extendedannotation_method_parameter=method parameter index = {0}
365
disassembler_extendedannotation_offset=offset = {0}
366
disassembler_extendedannotation_throws=throws index = {0}
367
disassembler_extendedannotation_type_argument=type argument index = {0}
368
disassembler_extendedannotation_type_parameter=type parameter index = {0}
369
disassembler_extendedannotation_type_parameter_with_bound=type parameter index = {0} type parameter bound index = {1}
370
disassembler_extendedannotation_wildcardlocationtype=wildcard location type = 0x{0} {1}
371
disassembler_extendedannotation_wildcardlocations=wildcard locations = {0}
372
disassembler_localvariabletargetheader=local variable entries:
373
350
### classfileformat decoding
374
### classfileformat decoding
351
classfileformat_versiondetails =\ (version {0} : {1}.{2}, {3})
375
classfileformat_versiondetails =\ (version {0} : {1}.{2}, {3})
352
classfileformat_methoddescriptor = // Method descriptor #{0} {1}
376
classfileformat_methoddescriptor = // Method descriptor #{0} {1}
Lines 394-399 Link Here
394
classfileformat_exceptiontableentry = [pc: {0}, pc: {1}] -> {2} when : {3}
418
classfileformat_exceptiontableentry = [pc: {0}, pc: {1}] -> {2} when : {3}
395
classfileformat_linenumbertableentry = [pc: {0}, line: {1}]
419
classfileformat_linenumbertableentry = [pc: {0}, line: {1}]
396
classfileformat_localvariabletableentry = [pc: {0}, pc: {1}] local: {2} index: {3} type: {4}
420
classfileformat_localvariabletableentry = [pc: {0}, pc: {1}] local: {2} index: {3} type: {4}
421
# jsr 308
422
classfileformat_localvariablereferenceinfoentry=[pc: {0}, pc: {1}] index: {2}
397
423
398
### Eclipse Java Core completion messages.
424
### Eclipse Java Core completion messages.
399
engine_completing = Computing proposals...
425
engine_completing = Computing proposals...
(-)a/org.eclipse.jdt.core/notes/TODO.txt (+24 lines)
Added Link Here
1
To be done:
2
- check that all wrong usages of modifiers are properly reported
3
- implement recovery, code assist and selection parsers
4
- code generation
5
- disassembler
6
- formatter
7
- search (indexer)
8
- DOM/AST
9
- type parameter generic or array ?
10
11
Javac issues to double-check:
12
- some locals are missing ranges see test25
13
- wrong offset for annotations on method calls
14
15
- wrong locations for I in:
16
	@A Map<@B String, @C List<@H String @E[] [] @G[]>> @I[] [] @J[] field;
17
	@A Map<@B String, @C List<@H String @E[] [] @G[]>> [] @I[] @J[] field;
18
I has the same location in both cases
19
20
- Initialize allTypeAnnotationContexts for TypeAnnotationCodStream only if needed
21
- check synthetic methods
22
23
- need to decide if "0x11aa.aap-3333f" should be seen as one token regardless of the scanner compliance
24
I think we should always report one token and then report an error if the token is illegal for the given source version
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java (-2 / +14 lines)
Lines 5-10 Link Here
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
Lines 740-747 Link Here
740
		this.nodeSet.addTrustedMatch(result, true);
744
		this.nodeSet.addTrustedMatch(result, true);
741
	return result;
745
	return result;
742
}
746
}
743
protected TypeReference getTypeReference(int dim) {
747
protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation [][] annotationsOnDimensions) {
744
	TypeReference typeRef = super.getTypeReference(dim);
748
	TypeReference result = super.copyDims(typeRef, dim, annotationsOnDimensions);
749
	 if (this.nodeSet.removePossibleMatch(typeRef) != null)
750
		this.nodeSet.addPossibleMatch(result);
751
	 else if (this.nodeSet.removeTrustedMatch(typeRef) != null)
752
		this.nodeSet.addTrustedMatch(result, true);
753
	return result;
754
}
755
protected TypeReference getUnannotatedTypeReference(int dim) {
756
	TypeReference typeRef = super.getUnannotatedTypeReference(dim);
745
	if (this.patternFineGrain == 0) {
757
	if (this.patternFineGrain == 0) {
746
		this.patternLocator.match(typeRef, this.nodeSet); // NB: Don't check container since type reference can happen anywhere
758
		this.patternLocator.match(typeRef, this.nodeSet); // NB: Don't check container since type reference can happen anywhere
747
	}
759
	}

Return to bug 287648