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

(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java (-1 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 55-60 Link Here
55
public TypeReference copyDims(int dim){
55
public TypeReference copyDims(int dim){
56
	return this;
56
	return this;
57
}
57
}
58
public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){
59
	return this;
60
}
58
protected TypeBinding getTypeBinding(Scope scope) {
61
protected TypeBinding getTypeBinding(Scope scope) {
59
	// it can be a package, type or member type
62
	// it can be a package, type or member type
60
	Binding binding = scope.parent.getTypeOrPackage(this.tokens); // step up from the ClassScope
63
	Binding binding = scope.parent.getTypeOrPackage(this.tokens); // step up from the ClassScope
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 55-60 Link Here
55
public TypeReference copyDims(int dim){
55
public TypeReference copyDims(int dim){
56
	return this;
56
	return this;
57
}
57
}
58
/*
59
 * No expansion of the completion reference into an array one
60
 */
61
public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){
62
	return this;
63
}
58
protected TypeBinding getTypeBinding(Scope scope) {
64
protected TypeBinding getTypeBinding(Scope scope) {
59
    if (this.fieldTypeCompletionNode != null) {
65
    if (this.fieldTypeCompletionNode != null) {
60
		throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope);
66
		throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope);
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (-19 / +195 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 799-805 Link Here
799
				Expression castType;
799
				Expression castType;
800
				if(this.expressionPtr > 0
800
				if(this.expressionPtr > 0
801
					&& ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) {
801
					&& ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) {
802
					CastExpression cast = new CastExpression(expression, castType);
802
					CastExpression cast = new CastExpression(expression, (TypeReference) castType);
803
					cast.sourceStart = castType.sourceStart;
803
					cast.sourceStart = castType.sourceStart;
804
					cast.sourceEnd= expression.sourceEnd;
804
					cast.sourceEnd= expression.sourceEnd;
805
					this.assistNodeParent = cast;
805
					this.assistNodeParent = cast;
Lines 1158-1166 Link Here
1158
				if(info == LESS && node instanceof TypeReference) {
1158
				if(info == LESS && node instanceof TypeReference) {
1159
					if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
1159
					if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
1160
						if (consumeTypeArguments) consumeTypeArguments();
1160
						if (consumeTypeArguments) consumeTypeArguments();
1161
						TypeReference ref = this.getTypeReference(0);
1161
						TypeReference ref;
1162
						if(prevKind == K_PARAMETERIZED_CAST) {
1162
						if(prevKind == K_PARAMETERIZED_CAST) {
1163
							ref = this.getUnannotatedTypeReference(0);  // by design type is not annotated.
1163
							ref = computeQualifiedGenericsFromRightSide(ref, 0);
1164
							ref = computeQualifiedGenericsFromRightSide(ref, 0);
1165
						} else {
1166
							ref = this.getTypeReference(0);
1164
						}
1167
						}
1165
						if(this.currentElement instanceof RecoveredType) {
1168
						if(this.currentElement instanceof RecoveredType) {
1166
							this.currentElement = this.currentElement.add(new CompletionOnFieldType(ref, false), 0);
1169
							this.currentElement = this.currentElement.add(new CompletionOnFieldType(ref, false), 0);
Lines 1337-1343 Link Here
1337
		if ((length = this.identifierLengthStack[this.identifierLengthPtr-1]) < 0) {
1340
		if ((length = this.identifierLengthStack[this.identifierLengthPtr-1]) < 0) {
1338
			// build the primitive type node
1341
			// build the primitive type node
1339
			int dim = isAfterArrayType() ? this.intStack[this.intPtr--] : 0;
1342
			int dim = isAfterArrayType() ? this.intStack[this.intPtr--] : 0;
1340
			SingleTypeReference typeRef = (SingleTypeReference)TypeReference.baseTypeReference(-length, dim);
1343
			Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
1344
			SingleTypeReference typeRef = (SingleTypeReference)TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
1341
			typeRef.sourceStart = this.intStack[this.intPtr--];
1345
			typeRef.sourceStart = this.intStack[this.intPtr--];
1342
			if (dim == 0) {
1346
			if (dim == 0) {
1343
				typeRef.sourceEnd = this.intStack[this.intPtr--];
1347
				typeRef.sourceEnd = this.intStack[this.intPtr--];
Lines 2058-2107 Link Here
2058
protected void consumeCastExpressionWithPrimitiveType() {
2062
protected void consumeCastExpressionWithPrimitiveType() {
2059
	popElement(K_CAST_STATEMENT);
2063
	popElement(K_CAST_STATEMENT);
2060
2064
2061
	Expression exp, cast, castType;
2065
	Expression exp;
2066
	Expression cast;
2067
	TypeReference castType;
2062
	this.expressionPtr--;
2068
	this.expressionPtr--;
2063
	this.expressionLengthPtr--;
2069
	this.expressionLengthPtr--;
2064
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = this.expressionStack[this.expressionPtr]);
2070
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = (TypeReference) this.expressionStack[this.expressionPtr]);
2065
	cast.sourceStart = castType.sourceStart - 1;
2071
	cast.sourceStart = castType.sourceStart - 1;
2066
	cast.sourceEnd = exp.sourceEnd;
2072
	cast.sourceEnd = exp.sourceEnd;
2067
}
2073
}
2074
protected void consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations() {
2075
	popElement(K_CAST_STATEMENT);
2076
2077
	Expression expression = this.expressionStack[this.expressionPtr--];
2078
	this.expressionLengthPtr--;
2079
	TypeReference typeReference = (TypeReference) this.expressionStack[this.expressionPtr--];
2080
	this.expressionLengthPtr--;
2081
	int length;
2082
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2083
		System.arraycopy(
2084
				this.expressionStack,
2085
				(this.expressionPtr -= length) + 1,
2086
				typeReference.annotations = new Annotation[length],
2087
				0,
2088
				length);
2089
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2090
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2091
			typeReferenceSourceStart = this.modifiersSourceStart;
2092
		}
2093
		typeReference.sourceStart = typeReferenceSourceStart;
2094
	}
2095
2096
	Expression cast;
2097
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2098
	cast.sourceStart = typeReference.sourceStart - 1;
2099
	cast.sourceEnd = expression.sourceEnd;
2100
}
2068
protected void consumeCastExpressionWithGenericsArray() {
2101
protected void consumeCastExpressionWithGenericsArray() {
2069
	popElement(K_CAST_STATEMENT);
2102
	popElement(K_CAST_STATEMENT);
2070
2103
2071
	Expression exp, cast, castType;
2104
	Expression exp;
2105
	Expression cast;
2106
	TypeReference castType;
2072
	this.expressionPtr--;
2107
	this.expressionPtr--;
2073
	this.expressionLengthPtr--;
2108
	this.expressionLengthPtr--;
2074
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = this.expressionStack[this.expressionPtr]);
2109
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = (TypeReference) this.expressionStack[this.expressionPtr]);
2075
	cast.sourceStart = castType.sourceStart - 1;
2110
	cast.sourceStart = castType.sourceStart - 1;
2076
	cast.sourceEnd = exp.sourceEnd;
2111
	cast.sourceEnd = exp.sourceEnd;
2077
}
2112
}
2113
protected void consumeCastExpressionWithGenericsArrayWithTypeAnnotations() {
2114
	popElement(K_CAST_STATEMENT);
2078
2115
2116
	Expression exp = this.expressionStack[this.expressionPtr--];
2117
	this.expressionLengthPtr--;
2118
	// pop the type reference
2119
	TypeReference typeReference = (TypeReference) this.expressionStack[this.expressionPtr--];
2120
	this.expressionLengthPtr--;
2121
2122
	int length;
2123
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2124
		System.arraycopy(
2125
				this.expressionStack,
2126
				(this.expressionPtr -= length) + 1,
2127
				typeReference.annotations = new Annotation[length],
2128
				0,
2129
				length);
2130
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2131
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2132
			typeReferenceSourceStart = this.modifiersSourceStart;
2133
		}
2134
		typeReference.sourceStart = typeReferenceSourceStart;
2135
	}
2136
2137
	Expression cast;
2138
	pushOnExpressionStack(cast = new CastExpression(exp, typeReference));
2139
	cast.sourceStart = typeReference.sourceStart - 1;
2140
	cast.sourceEnd = exp.sourceEnd;
2141
}
2079
protected void consumeCastExpressionWithQualifiedGenericsArray() {
2142
protected void consumeCastExpressionWithQualifiedGenericsArray() {
2080
	popElement(K_CAST_STATEMENT);
2143
	popElement(K_CAST_STATEMENT);
2081
2144
2082
	Expression exp, cast, castType;
2145
	Expression exp;
2146
	Expression cast;
2147
	TypeReference castType;
2083
	this.expressionPtr--;
2148
	this.expressionPtr--;
2084
	this.expressionLengthPtr--;
2149
	this.expressionLengthPtr--;
2085
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = this.expressionStack[this.expressionPtr]);
2150
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = (TypeReference) this.expressionStack[this.expressionPtr]);
2086
	cast.sourceStart = castType.sourceStart - 1;
2151
	cast.sourceStart = castType.sourceStart - 1;
2087
	cast.sourceEnd = exp.sourceEnd;
2152
	cast.sourceEnd = exp.sourceEnd;
2088
}
2153
}
2154
protected void consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations() {
2155
	popElement(K_CAST_STATEMENT);
2156
2157
	Expression expression = this.expressionStack[this.expressionPtr--];
2158
	this.expressionLengthPtr--;
2159
	TypeReference typeReference = (TypeReference) this.expressionStack[this.expressionPtr--];
2160
	this.expressionLengthPtr--;
2161
	int length;
2162
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2163
		System.arraycopy(
2164
				this.expressionStack,
2165
				(this.expressionPtr -= length) + 1,
2166
				typeReference.annotations = new Annotation[length],
2167
				0,
2168
				length);
2169
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2170
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2171
			typeReferenceSourceStart = this.modifiersSourceStart;
2172
		}
2173
		typeReference.sourceStart = typeReferenceSourceStart;
2174
	}
2175
	Expression cast;
2176
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2177
	cast.sourceStart = typeReference.sourceStart - 1;
2178
	cast.sourceEnd = expression.sourceEnd;
2179
}
2089
protected void consumeCastExpressionWithNameArray() {
2180
protected void consumeCastExpressionWithNameArray() {
2090
	// CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2181
	// CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2091
	popElement(K_CAST_STATEMENT);
2182
	popElement(K_CAST_STATEMENT);
2092
2183
2093
	Expression exp, cast, castType;
2184
	Expression exp;
2185
	Expression cast;
2186
	TypeReference castType;
2094
2187
2095
	this.expressionPtr--;
2188
	this.expressionPtr--;
2096
	this.expressionLengthPtr--;
2189
	this.expressionLengthPtr--;
2097
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = this.expressionStack[this.expressionPtr]);
2190
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr+1], castType = (TypeReference) this.expressionStack[this.expressionPtr]);
2098
	cast.sourceStart = castType.sourceStart - 1;
2191
	cast.sourceStart = castType.sourceStart - 1;
2099
	cast.sourceEnd = exp.sourceEnd;
2192
	cast.sourceEnd = exp.sourceEnd;
2100
}
2193
}
2194
protected void consumeCastExpressionWithNameArrayWithTypeAnnotations() {
2195
	popElement(K_CAST_STATEMENT);
2196
2197
	Expression expression = this.expressionStack[this.expressionPtr--];
2198
	this.expressionLengthPtr--;
2199
	TypeReference typeReference = (TypeReference) this.expressionStack[this.expressionPtr--];
2200
	this.expressionLengthPtr--;
2201
	
2202
	int length;
2203
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2204
		System.arraycopy(
2205
				this.expressionStack,
2206
				(this.expressionPtr -= length) + 1,
2207
				typeReference.annotations = new Annotation[length],
2208
				0,
2209
				length);
2210
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2211
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2212
			typeReferenceSourceStart = this.modifiersSourceStart;
2213
		}
2214
		typeReference.sourceStart = typeReferenceSourceStart;
2215
	}
2216
	Expression cast;
2217
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2218
	cast.sourceStart = typeReference.sourceStart - 1;
2219
	cast.sourceEnd = expression.sourceEnd;
2220
}
2101
protected void consumeCastExpressionLL1() {
2221
protected void consumeCastExpressionLL1() {
2102
	popElement(K_CAST_STATEMENT);
2222
	popElement(K_CAST_STATEMENT);
2103
	super.consumeCastExpressionLL1();
2223
	super.consumeCastExpressionLL1();
2104
}
2224
}
2225
protected void consumeCastExpressionLL1WithTypeAnnotations() {
2226
	popElement(K_CAST_STATEMENT);
2227
	super.consumeCastExpressionLL1WithTypeAnnotations();
2228
}
2105
protected void consumeClassBodyDeclaration() {
2229
protected void consumeClassBodyDeclaration() {
2106
	popElement(K_BLOCK_DELIMITER);
2230
	popElement(K_BLOCK_DELIMITER);
2107
	super.consumeClassBodyDeclaration();
2231
	super.consumeClassBodyDeclaration();
Lines 2513-2518 Link Here
2513
	}
2637
	}
2514
}
2638
}
2515
protected void consumeFormalParameter(boolean isVarArgs) {
2639
protected void consumeFormalParameter(boolean isVarArgs) {
2640
	
2641
	this.invocationType = NO_RECEIVER;
2642
	this.qualifier = -1;
2643
	
2516
	if (this.indexOfAssistIdentifier() < 0) {
2644
	if (this.indexOfAssistIdentifier() < 0) {
2517
		super.consumeFormalParameter(isVarArgs);
2645
		super.consumeFormalParameter(isVarArgs);
2518
		if (this.pendingAnnotation != null) {
2646
		if (this.pendingAnnotation != null) {
Lines 2530-2539 Link Here
2530
			endOfEllipsis = this.intStack[this.intPtr--];
2658
			endOfEllipsis = this.intStack[this.intPtr--];
2531
		}
2659
		}
2532
		int firstDimensions = this.intStack[this.intPtr--];
2660
		int firstDimensions = this.intStack[this.intPtr--];
2533
		final int typeDimensions = firstDimensions + extendedDimensions;
2661
		TypeReference type = getUnannotatedTypeReference(extendedDimensions);
2534
		TypeReference type = getTypeReference(typeDimensions);
2662
		Annotation [] varArgsAnnotations = null;
2663
		int length;
2664
		if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
2665
			System.arraycopy(
2666
				this.typeAnnotationStack,
2667
				(this.typeAnnotationPtr -= length) + 1,
2668
				varArgsAnnotations = new Annotation[length],
2669
				0,
2670
				length);
2671
		} 
2672
		final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
2673
		if (typeDimensions != extendedDimensions) {
2674
			// jsr308 type annotations management
2675
			Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
2676
			Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
2677
			Annotation [][] annotationsOnAllDimensions = null;
2678
			if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
2679
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
2680
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
2681
			}
2682
			type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
2683
			type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
2684
		}
2535
		if (isVarArgs) {
2685
		if (isVarArgs) {
2536
			type = copyDims(type, typeDimensions + 1);
2537
			if (extendedDimensions == 0) {
2686
			if (extendedDimensions == 0) {
2538
				type.sourceEnd = endOfEllipsis;
2687
				type.sourceEnd = endOfEllipsis;
2539
			}
2688
			}
Lines 2547-2553 Link Here
2547
				type,
2696
				type,
2548
				this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
2697
				this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
2549
		// consume annotations
2698
		// consume annotations
2550
		int length;
2551
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2699
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2552
			System.arraycopy(
2700
			System.arraycopy(
2553
				this.expressionStack,
2701
				this.expressionStack,
Lines 2638-2643 Link Here
2638
	}
2786
	}
2639
	pushOnElementStack(K_CAST_STATEMENT);
2787
	pushOnElementStack(K_CAST_STATEMENT);
2640
}
2788
}
2789
protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() {
2790
	popElement(K_PARAMETERIZED_CAST);
2791
2792
	Expression castType;
2793
	int end = this.intStack[this.intPtr--];
2794
2795
	int dim = this.intStack[this.intPtr--];
2796
	// TODO is it an annotated type reference?
2797
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2798
2799
	castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
2800
	this.intPtr--;
2801
	castType.sourceEnd = end - 1;
2802
	castType.sourceStart = this.intStack[this.intPtr--] + 1;
2803
	pushOnExpressionStack(castType);
2804
2805
	pushOnElementStack(K_CAST_STATEMENT);
2806
}
2641
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
2807
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
2642
	popElement(K_PARAMETERIZED_CAST);
2808
	popElement(K_PARAMETERIZED_CAST);
2643
2809
Lines 2645-2651 Link Here
2645
	int end = this.intStack[this.intPtr--];
2811
	int end = this.intStack[this.intPtr--];
2646
2812
2647
	int dim = this.intStack[this.intPtr--];
2813
	int dim = this.intStack[this.intPtr--];
2648
	TypeReference rightSide = getTypeReference(0);
2814
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2649
2815
2650
	castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
2816
	castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
2651
	this.intPtr--;
2817
	this.intPtr--;
Lines 4279-4284 Link Here
4279
	}
4445
	}
4280
	return result;
4446
	return result;
4281
}
4447
}
4448
protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation[][] annotationsOnDimensions) {
4449
	if (this.assistNode == typeRef) {
4450
		return typeRef;
4451
	}
4452
	TypeReference result = super.copyDims(typeRef, dim, annotationsOnDimensions);
4453
	if (this.assistNodeParent == typeRef) {
4454
		this.assistNodeParent = result;
4455
	}
4456
	return result;
4457
}
4282
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) {
4458
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult, int cursorLoc) {
4283
4459
4284
	this.cursorLocation = cursorLoc;
4460
	this.cursorLocation = cursorLoc;
Lines 4383-4389 Link Here
4383
	if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_SWITCH_LABEL) {
4559
	if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_SWITCH_LABEL) {
4384
		if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) {
4560
		if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) {
4385
			// if recovery is taking place in an array initializer, we should prevent popping
4561
			// if recovery is taking place in an array initializer, we should prevent popping
4386
			// up to the enclosing block until the array initializer is properly closed
4562
			// upto the enclosing block until the array initializer is properly closed
4387
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704
4563
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704
4388
			popUntilElement(K_ARRAY_INITIALIZER);
4564
			popUntilElement(K_ARRAY_INITIALIZER);
4389
		} else {
4565
		} else {
Lines 4674-4680 Link Here
4674
			super.recoveryTokenCheck();
4850
			super.recoveryTokenCheck();
4675
			if(this.currentElement != oldElement && oldElement instanceof RecoveredBlock) {
4851
			if(this.currentElement != oldElement && oldElement instanceof RecoveredBlock) {
4676
				if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) {
4852
				if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) {
4677
					// When inside an array initializer, we should not prematurely pop the enclosing block
4853
					// When inside an array initializer, we shud not prematurely pop the enclosing block
4678
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704
4854
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704
4679
					popElement(K_ARRAY_INITIALIZER);
4855
					popElement(K_ARRAY_INITIALIZER);
4680
				} else {
4856
				} else {
(-)codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java (-3 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 897-909 Link Here
897
/*
897
/*
898
 * Build specific type reference nodes in case the cursor is located inside the type reference
898
 * Build specific type reference nodes in case the cursor is located inside the type reference
899
 */
899
 */
900
protected TypeReference getTypeReference(int dim) {
900
protected TypeReference getUnannotatedTypeReference(int dim) {
901
901
902
	int index;
902
	int index;
903
903
904
	/* no need to take action if not inside completed identifiers */
904
	/* no need to take action if not inside completed identifiers */
905
	if ((index = indexOfAssistIdentifier(true)) < 0) {
905
	if ((index = indexOfAssistIdentifier(true)) < 0) {
906
		return super.getTypeReference(dim);
906
		return super.getUnannotatedTypeReference(dim);
907
	}
907
	}
908
	int length = this.identifierLengthStack[this.identifierLengthPtr];
908
	int length = this.identifierLengthStack[this.identifierLengthPtr];
909
	TypeReference reference;
909
	TypeReference reference;
Lines 1622-1627 Link Here
1622
	this.astLengthPtr = -1;
1622
	this.astLengthPtr = -1;
1623
	this.expressionPtr = -1;
1623
	this.expressionPtr = -1;
1624
	this.expressionLengthPtr = -1;
1624
	this.expressionLengthPtr = -1;
1625
	this.unattachedAnnotationPtr = -1;
1626
	this.typeAnnotationLengthPtr = -1;
1627
	this.typeAnnotationPtr = -1;
1625
	this.identifierPtr = -1;
1628
	this.identifierPtr = -1;
1626
	this.identifierLengthPtr	= -1;
1629
	this.identifierLengthPtr	= -1;
1627
	this.intPtr = -1;
1630
	this.intPtr = -1;
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java (-7 / +27 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 133-140 Link Here
133
			case K_CAST_STATEMENT :
133
			case K_CAST_STATEMENT :
134
				Expression castType;
134
				Expression castType;
135
				if(this.expressionPtr > 0
135
				if(this.expressionPtr > 0
136
					&& ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) {
136
						&& ((castType = this.expressionStack[this.expressionPtr-1]) instanceof TypeReference)) {
137
					CastExpression cast = new CastExpression(expression, castType);
137
					CastExpression cast = new CastExpression(expression, (TypeReference) castType);
138
					cast.sourceStart = castType.sourceStart;
138
					cast.sourceStart = castType.sourceStart;
139
					cast.sourceEnd= expression.sourceEnd;
139
					cast.sourceEnd= expression.sourceEnd;
140
					parentNode = cast;
140
					parentNode = cast;
Lines 548-557 Link Here
548
			endOfEllipsis = this.intStack[this.intPtr--];
548
			endOfEllipsis = this.intStack[this.intPtr--];
549
		}
549
		}
550
		int firstDimensions = this.intStack[this.intPtr--];
550
		int firstDimensions = this.intStack[this.intPtr--];
551
		final int typeDimensions = firstDimensions + extendedDimensions;
551
		TypeReference type = getUnannotatedTypeReference(extendedDimensions);
552
		TypeReference type = getTypeReference(typeDimensions);
552
		Annotation [] varArgsAnnotations = null;
553
		int length;
554
		if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
555
			System.arraycopy(
556
				this.typeAnnotationStack,
557
				(this.typeAnnotationPtr -= length) + 1,
558
				varArgsAnnotations = new Annotation[length],
559
				0,
560
				length);
561
		} 
562
		final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
563
		if (typeDimensions != extendedDimensions) {
564
			// jsr308 type annotations management
565
			Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
566
			Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
567
			Annotation [][] annotationsOnAllDimensions = null;
568
			if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
569
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
570
				annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
571
			}
572
			type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
573
			type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
574
		}
553
		if (isVarArgs) {
575
		if (isVarArgs) {
554
			type = copyDims(type, typeDimensions + 1);
555
			if (extendedDimensions == 0) {
576
			if (extendedDimensions == 0) {
556
				type.sourceEnd = endOfEllipsis;
577
				type.sourceEnd = endOfEllipsis;
557
			}
578
			}
Lines 568-574 Link Here
568
		arg.declarationSourceStart = modifierPositions;
589
		arg.declarationSourceStart = modifierPositions;
569
590
570
		// consume annotations
591
		// consume annotations
571
		int length;
572
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
592
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
573
			System.arraycopy(
593
			System.arraycopy(
574
				this.expressionStack,
594
				this.expressionStack,
(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (-3 / +31 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 466-472 Link Here
466
	int IncorrectSwitchType = TypeRelated + 169;
466
	int IncorrectSwitchType = TypeRelated + 169;
467
	int DuplicateCase = FieldRelated + 170;
467
	int DuplicateCase = FieldRelated + 170;
468
468
469
	// labelled
469
	// labeled
470
	int DuplicateLabel = Internal + 171;
470
	int DuplicateLabel = Internal + 171;
471
	int InvalidBreak = Internal + 172;
471
	int InvalidBreak = Internal + 172;
472
	int InvalidContinue = Internal + 173;
472
	int InvalidContinue = Internal + 173;
Lines 526-531 Link Here
526
	int ThisInStaticContext = Internal + 200;
526
	int ThisInStaticContext = Internal + 200;
527
	int StaticMethodRequested = Internal + MethodRelated + 201;
527
	int StaticMethodRequested = Internal + MethodRelated + 201;
528
	int IllegalDimension = Internal + 202;
528
	int IllegalDimension = Internal + 202;
529
	/** @deprecated This is no longer used */
529
	int InvalidTypeExpression = Internal + 203;
530
	int InvalidTypeExpression = Internal + 203;
530
	int ParsingError = Syntax + Internal + 204;
531
	int ParsingError = Syntax + Internal + 204;
531
	int ParsingErrorNoSuggestion = Syntax + Internal + 205;
532
	int ParsingErrorNoSuggestion = Syntax + Internal + 205;
Lines 598-603 Link Here
598
	int InvalidHighSurrogate = Syntax + Internal + 264;
599
	int InvalidHighSurrogate = Syntax + Internal + 264;
599
	/** @since 3.2 */
600
	/** @since 3.2 */
600
	int UnnecessaryNLSTag = Internal + 265;
601
	int UnnecessaryNLSTag = Internal + 265;
602
	/** @since 3.7 */
603
	int InvalidBinary = Syntax + Internal + 266;
604
	/** @since 3.7 */
605
	int IllegalBinaryLiteral = Syntax + Internal + 267;
606
	/** @since 3.7 */
607
	int IllegalUnderscorePosition = Syntax + Internal + 268;
608
	/** @since 3.7 */
609
	int IllegalUsageOfUnderscore = Syntax + Internal + 269;
610
	/** @since 3.7 */
611
	int IllegalHexaLiteral = Syntax + Internal + 270;
612
	/** @since 3.7 */
613
	int UnterminatedExoticIdentifier = Syntax + Internal + 271;
614
	/** @since 3.7 */
615
	int InvalidEmptyExoticIdentifier = Syntax + Internal + 272;
616
	/** @since 3.7 */
617
	int IllegalDangerousCharacter = Syntax + Internal + 273;
618
	/** @since 3.7 */
619
	int IllegalExoticIdentifier = Syntax + Internal + 274;
601
620
602
	// type related problems
621
	// type related problems
603
	/** @since 3.1 */
622
	/** @since 3.1 */
Lines 1238-1244 Link Here
1238
	int UnusedWarningToken = Internal + 635;
1257
	int UnusedWarningToken = Internal + 635;
1239
	/** @since 3.6 */
1258
	/** @since 3.6 */
1240
	int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636;
1259
	int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636;
1241
1260
	/** @since 3.7 */
1261
    int InvalidUsageOfTypeAnnotations = Syntax + Internal + 637;
1262
    /** @since 3.7 */
1263
    int InvalidUsageOfReceiverAnnotations = Syntax + Internal + 638;
1264
    /** @since 3.7 */
1265
    int MisplacedTypeAnnotations = Syntax + Internal + 639;
1266
    /** @since 3.7 */
1267
    int InvalidLocationForModifiers = Syntax + Internal + 640;
1268
    /** @since 3.7*/
1269
    int IllegalUsageOfTypeAnnotations = Internal + Syntax + 641;
1242
	/**
1270
	/**
1243
	 * More problems in generics
1271
	 * More problems in generics
1244
	 */
1272
	 */
(-)compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java (-3 / +67 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 44-56 Link Here
44
		// do nothing by default
44
		// do nothing by default
45
	}
45
	}
46
	public void endVisit(
46
	public void endVisit(
47
    		ArrayAllocationExpression arrayAllocationExpression,
47
			ArrayAllocationExpression arrayAllocationExpression,
48
    		BlockScope scope) {
48
			BlockScope scope) {
49
		// do nothing by default
49
		// do nothing by default
50
	}
50
	}
51
	public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
51
	public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
52
		// do nothing by default
52
		// do nothing by default
53
	}
53
	}
54
	public void endVisit(ArrayInitializer arrayInitializer, ClassScope scope) {
55
		// do nothing by default
56
	}
54
	public void endVisit(
57
	public void endVisit(
55
		ArrayQualifiedTypeReference arrayQualifiedTypeReference,
58
		ArrayQualifiedTypeReference arrayQualifiedTypeReference,
56
		BlockScope scope) {
59
		BlockScope scope) {
Lines 271-282 Link Here
271
		// do nothing by default
274
		// do nothing by default
272
	}
275
	}
273
	/**
276
	/**
277
	 * @param annotation
278
	 * @param scope
279
	 * @since 3.1
280
	 */
281
	public void endVisit(MarkerAnnotation annotation, ClassScope scope) {
282
		// do nothing by default
283
	}
284
	/**
274
	 * @param pair
285
	 * @param pair
275
	 * @param scope
286
	 * @param scope
276
	 */
287
	 */
277
	public void endVisit(MemberValuePair pair, BlockScope scope) {
288
	public void endVisit(MemberValuePair pair, BlockScope scope) {
278
		// do nothing by default
289
		// do nothing by default
279
	}
290
	}
291
	/**
292
	 * @param pair
293
	 * @param scope
294
	 */
295
	public void endVisit(MemberValuePair pair, ClassScope scope) {
296
		// do nothing by default
297
	}
280
	public void endVisit(MessageSend messageSend, BlockScope scope) {
298
	public void endVisit(MessageSend messageSend, BlockScope scope) {
281
		// do nothing by default
299
		// do nothing by default
282
	}
300
	}
Lines 294-299 Link Here
294
	public void endVisit(NormalAnnotation annotation, BlockScope scope) {
312
	public void endVisit(NormalAnnotation annotation, BlockScope scope) {
295
		// do nothing by default
313
		// do nothing by default
296
	}
314
	}
315
	public void endVisit(NormalAnnotation annotation, ClassScope scope) {
316
		// do nothing by default
317
	}
297
	public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
318
	public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
298
		// do nothing by default
319
		// do nothing by default
299
	}
320
	}
Lines 374-379 Link Here
374
	public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) {
395
	public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) {
375
		// do nothing by default
396
		// do nothing by default
376
	}
397
	}
398
	/**
399
	 * @param annotation
400
	 * @param scope
401
	 * @since 3.1
402
	 */
403
	public void endVisit(SingleMemberAnnotation annotation, ClassScope scope) {
404
		// do nothing by default
405
	}
377
	public void endVisit(
406
	public void endVisit(
378
    		SingleNameReference singleNameReference,
407
    		SingleNameReference singleNameReference,
379
    		BlockScope scope) {
408
    		BlockScope scope) {
Lines 483-488 Link Here
483
	public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
512
	public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
484
		return true; // do nothing by default, keep traversing
513
		return true; // do nothing by default, keep traversing
485
	}
514
	}
515
	public boolean visit(ArrayInitializer arrayInitializer, ClassScope scope) {
516
		return true; // do nothing by default, keep traversing
517
	}
486
	public boolean visit(
518
	public boolean visit(
487
		ArrayQualifiedTypeReference arrayQualifiedTypeReference,
519
		ArrayQualifiedTypeReference arrayQualifiedTypeReference,
488
		BlockScope scope) {
520
		BlockScope scope) {
Lines 703-708 Link Here
703
		return true;
735
		return true;
704
	}
736
	}
705
	/**
737
	/**
738
	 * @param annotation
739
	 * @param scope
740
	 * @since 3.1
741
	 */
742
	public boolean visit(MarkerAnnotation annotation, ClassScope scope) {
743
		return true;
744
	}
745
	/**
706
	 * @param pair
746
	 * @param pair
707
	 * @param scope
747
	 * @param scope
708
	 * @since 3.1
748
	 * @since 3.1
Lines 710-715 Link Here
710
	public boolean visit(MemberValuePair pair, BlockScope scope) {
750
	public boolean visit(MemberValuePair pair, BlockScope scope) {
711
		return true;
751
		return true;
712
	}
752
	}
753
	/**
754
	 * @param pair
755
	 * @param scope
756
	 * @since 3.1
757
	 */
758
	public boolean visit(MemberValuePair pair, ClassScope scope) {
759
		return true;
760
	}
713
	public boolean visit(MessageSend messageSend, BlockScope scope) {
761
	public boolean visit(MessageSend messageSend, BlockScope scope) {
714
		return true; // do nothing by default, keep traversing
762
		return true; // do nothing by default, keep traversing
715
	}
763
	}
Lines 729-734 Link Here
729
	public boolean visit(NormalAnnotation annotation, BlockScope scope) {
777
	public boolean visit(NormalAnnotation annotation, BlockScope scope) {
730
		return true;
778
		return true;
731
	}
779
	}
780
	/**
781
	 * @param annotation
782
	 * @param scope
783
	 * @since 3.1
784
	 */
785
	public boolean visit(NormalAnnotation annotation, ClassScope scope) {
786
		return true;
787
	}
732
	public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
788
	public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
733
		return true; // do nothing by default, keep traversing
789
		return true; // do nothing by default, keep traversing
734
	}
790
	}
Lines 809-814 Link Here
809
	public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
865
	public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
810
		return true;
866
		return true;
811
	}
867
	}
868
	/**
869
	 * @param annotation
870
	 * @param scope
871
	 * @since 3.1
872
	 */
873
	public boolean visit(SingleMemberAnnotation annotation, ClassScope scope) {
874
		return true;
875
	}
812
	public boolean visit(
876
	public boolean visit(
813
		SingleNameReference singleNameReference,
877
		SingleNameReference singleNameReference,
814
		BlockScope scope) {
878
		BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-2 / +643 lines)
Lines 17-22 Link Here
17
import java.util.HashSet;
17
import java.util.HashSet;
18
import java.util.List;
18
import java.util.List;
19
import java.util.Set;
19
import java.util.Set;
20
import java.util.Stack;
20
21
21
import org.eclipse.jdt.core.compiler.CategorizedProblem;
22
import org.eclipse.jdt.core.compiler.CategorizedProblem;
22
import org.eclipse.jdt.core.compiler.CharOperation;
23
import org.eclipse.jdt.core.compiler.CharOperation;
Lines 30-43 Link Here
30
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
31
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
31
import org.eclipse.jdt.internal.compiler.ast.Expression;
32
import org.eclipse.jdt.internal.compiler.ast.Expression;
32
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
33
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
34
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
33
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
35
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
34
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
36
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
35
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
37
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
38
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
39
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
36
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
40
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
37
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
41
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
38
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
42
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
39
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
43
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
44
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
45
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
46
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
40
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
47
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
48
import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext;
49
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
41
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
50
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
42
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
51
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
43
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
52
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
Lines 45-58 Link Here
45
import org.eclipse.jdt.internal.compiler.codegen.Opcodes;
54
import org.eclipse.jdt.internal.compiler.codegen.Opcodes;
46
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame;
55
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame;
47
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
56
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
57
import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream;
58
import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo;
48
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker;
59
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker;
49
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker;
60
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker;
50
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker;
61
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker;
51
import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo;
52
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
62
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
53
import org.eclipse.jdt.internal.compiler.impl.Constant;
63
import org.eclipse.jdt.internal.compiler.impl.Constant;
54
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
64
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
55
import org.eclipse.jdt.internal.compiler.lookup.Binding;
65
import org.eclipse.jdt.internal.compiler.lookup.Binding;
66
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
56
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
67
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
57
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
68
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
58
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
69
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
Lines 227-232 Link Here
227
		LookupEnvironment env = typeBinding.scope.environment();
238
		LookupEnvironment env = typeBinding.scope.environment();
228
		return env.classFilePool.acquire(typeBinding);
239
		return env.classFilePool.acquire(typeBinding);
229
	}
240
	}
241
242
	/**
243
	 * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none.
244
	 */
245
	private static int[] getWildcardLocations(TypeReference reference, Wildcard wildcard) {
246
		class LocationCollector extends ASTVisitor {
247
			Stack currentIndexes;
248
			boolean search = true;
249
			Wildcard currentWildcard;
250
			
251
			public LocationCollector(Wildcard currentWildcard) {
252
				this.currentIndexes = new Stack();
253
				this.currentWildcard = currentWildcard;
254
			}
255
			public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) {
256
				if (!this.search) return false;
257
				TypeReference[] typeReferences = typeReference.typeArguments;
258
				this.currentIndexes.push(new Integer(0));
259
				for (int i = 0, max = typeReferences.length; i < max; i++) {
260
					typeReferences[i].traverse(this, scope);
261
					if (!this.search) return false;
262
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
263
				}
264
				this.currentIndexes.pop();
265
				return true;
266
			}
267
			public boolean visit(ParameterizedQualifiedTypeReference typeReference, BlockScope scope) {
268
				if (!this.search) return false;
269
				TypeReference[] typeReferences = typeReference.typeArguments[typeReference.typeArguments.length - 1];
270
				this.currentIndexes.push(new Integer(0));
271
				for (int i = 0, max = typeReferences.length; i < max; i++) {
272
					typeReferences[i].traverse(this, scope);
273
					if (!this.search) return false;
274
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
275
				}
276
				this.currentIndexes.pop();
277
				return true;
278
			}
279
			public boolean visit(Wildcard typeReference, BlockScope scope) {
280
				if (!this.search) return false;
281
				if (typeReference.equals(this.currentWildcard)) {
282
					this.search = false;
283
				}
284
				return true;
285
			}
286
			public String toString() {
287
				StringBuffer buffer = new StringBuffer();
288
				buffer
289
					.append("search location for ") //$NON-NLS-1$
290
					.append(this.currentWildcard)
291
					.append("\ncurrent indexes : ") //$NON-NLS-1$
292
					.append(this.currentIndexes);
293
				return String.valueOf(buffer);
294
			}
295
		}
296
		if (reference == null) return null;
297
		LocationCollector collector = new LocationCollector(wildcard);
298
		reference.traverse(collector, (BlockScope) null);
299
		if (collector.currentIndexes.isEmpty()) {
300
			return null;
301
		}
302
		int size = collector.currentIndexes.size();
303
		int[] result = new int[size];
304
		for (int i = 0; i < size; i++) {
305
			result[size - i - 1] = ((Integer) collector.currentIndexes.pop()).intValue();
306
		}
307
		return result;
308
	}
309
230
	/**
310
	/**
231
	 * INTERNAL USE-ONLY
311
	 * INTERNAL USE-ONLY
232
	 * This methods creates a new instance of the receiver.
312
	 * This methods creates a new instance of the receiver.
Lines 245-251 Link Here
245
		this.isNestedType = typeBinding.isNestedType();
325
		this.isNestedType = typeBinding.isNestedType();
246
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
326
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
247
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
327
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
248
			this.codeStream = new StackMapFrameCodeStream(this);
328
			if (this.targetJDK >= ClassFileConstants.JDK1_7) {
329
				this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
330
				this.codeStream = new TypeAnnotationCodeStream(this);
331
			} else {
332
				this.codeStream = new StackMapFrameCodeStream(this);
333
			}
249
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
334
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
250
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
335
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
251
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
336
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
Lines 358-363 Link Here
358
			generateMissingTypesAttribute();
443
			generateMissingTypesAttribute();
359
			attributesNumber++;
444
			attributesNumber++;
360
		}
445
		}
446
		
447
		attributesNumber += generateTypeAnnotationAttributeForTypeDeclaration();
361
		// update the number of attributes
448
		// update the number of attributes
362
		if (attributeOffset + 2 >= this.contents.length) {
449
		if (attributeOffset + 2 >= this.contents.length) {
363
			resizeContents(2);
450
			resizeContents(2);
Lines 412-419 Link Here
412
			FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
499
			FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
413
			if (fieldDeclaration != null) {
500
			if (fieldDeclaration != null) {
414
				Annotation[] annotations = fieldDeclaration.annotations;
501
				Annotation[] annotations = fieldDeclaration.annotations;
502
				List allTypeAnnotationContexts = new ArrayList();
503
				int invisibleTypeAnnotationsCounter = 0;
504
				int visibleTypeAnnotationsCounter = 0;
415
				if (annotations != null) {
505
				if (annotations != null) {
416
					attributesNumber += generateRuntimeAnnotations(annotations);
506
					attributesNumber += generateRuntimeAnnotations(annotations);
507
					if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
508
						if ((fieldDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
509
							fieldDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
510
						}
511
					}
512
				}
513
				TypeReference fieldType = fieldDeclaration.type;
514
				if (fieldType != null 
515
						&& ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0)
516
						&& ((fieldType.bits & ASTNode.HasTypeAnnotations) != 0)) {
517
					fieldType.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
518
				}
519
				int size = allTypeAnnotationContexts.size();
520
				if (size != 0) {
521
					AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
522
					allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
523
					for (int i = 0, max = allTypeAnnotationContextsArray.length; i < max; i++) {
524
						AnnotationContext annotationContext = allTypeAnnotationContextsArray[i];
525
						if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
526
							invisibleTypeAnnotationsCounter++;
527
							allTypeAnnotationContexts.add(annotationContext);
528
						} else {
529
							visibleTypeAnnotationsCounter++;
530
							allTypeAnnotationContexts.add(annotationContext);
531
						}
532
					}
533
					attributesNumber += generateRuntimeTypeAnnotations(
534
							allTypeAnnotationContextsArray,
535
							visibleTypeAnnotationsCounter,
536
							invisibleTypeAnnotationsCounter);
417
				}
537
				}
418
			}
538
			}
419
		}
539
		}
Lines 1834-1843 Link Here
1834
			MethodBinding binding,
1954
			MethodBinding binding,
1835
			int methodAttributeOffset,
1955
			int methodAttributeOffset,
1836
			int attributesNumber) {
1956
			int attributesNumber) {
1957
1958
		if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
1959
			List allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts;
1960
			int invisibleTypeAnnotationsCounter = 0;
1961
			int visibleTypeAnnotationsCounter = 0;
1962
			for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) {
1963
				LocalVariableBinding localVariable = this.codeStream.locals[i];
1964
				LocalDeclaration declaration = localVariable.declaration;
1965
				if (declaration == null
1966
						|| (declaration.isArgument() && ((declaration.bits & ASTNode.CatchVariable) == 0))
1967
						|| (localVariable.initializationCount == 0)
1968
						|| ((declaration.bits & ASTNode.HasTypeAnnotations) == 0)) {
1969
					continue;
1970
				}
1971
				declaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.LOCAL_VARIABLE, localVariable, allTypeAnnotationContexts);
1972
			}
1973
			AbstractMethodDeclaration methodDeclaration = binding.sourceMethod();
1974
			if (methodDeclaration != null) {
1975
				if ((methodDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
1976
					Argument[] arguments = methodDeclaration.arguments;
1977
					if (arguments != null) {
1978
						for (int i = 0, max = arguments.length; i < max; i++) {
1979
							Argument argument = arguments[i];
1980
							if ((argument.bits & ASTNode.HasTypeAnnotations) != 0) {
1981
								argument.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_PARAMETER, i, allTypeAnnotationContexts);
1982
							}
1983
						}
1984
					}
1985
					Annotation[] annotations = methodDeclaration.receiverAnnotations;
1986
					if (annotations != null) {
1987
						for (int i = 0, max = annotations.length; i < max; i++) {
1988
							Annotation annotation = annotations[i];
1989
							AnnotationContext annotationContext = null;
1990
							if (annotation.isRuntimeTypeInvisible()) {
1991
								annotationContext = new AnnotationContext(annotation, null, AnnotationTargetTypeConstants.METHOD_RECEIVER, null, AnnotationContext.INVISIBLE, null);
1992
								invisibleTypeAnnotationsCounter++;
1993
							} else if (annotation.isRuntimeTypeVisible()) {
1994
								annotationContext = new AnnotationContext(annotation, null, AnnotationTargetTypeConstants.METHOD_RECEIVER, null, AnnotationContext.VISIBLE, null);
1995
								visibleTypeAnnotationsCounter++;
1996
							}
1997
							if (annotationContext != null) {
1998
								allTypeAnnotationContexts.add(annotationContext);
1999
							}
2000
						}
2001
					}
2002
				}
2003
				Annotation[] annotations = methodDeclaration.annotations;
2004
				if (annotations != null && binding.returnType.id != T_void) {
2005
					methodDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN_TYPE, allTypeAnnotationContexts);
2006
				}
2007
				if (!methodDeclaration.isConstructor() && !methodDeclaration.isClinit() && binding.returnType.id != T_void) {
2008
					MethodDeclaration declaration = (MethodDeclaration) methodDeclaration;
2009
					TypeReference typeReference = declaration.returnType;
2010
					if ((typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
2011
						typeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN_TYPE, allTypeAnnotationContexts);
2012
					}
2013
				}
2014
				TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
2015
				if (thrownExceptions != null) {
2016
					for (int i = 0, max = thrownExceptions.length; i < max; i++) {
2017
						TypeReference thrownException = thrownExceptions[i];
2018
						thrownException.getAllAnnotationContexts(AnnotationTargetTypeConstants.THROWS, i, allTypeAnnotationContexts);
2019
					}
2020
				}
2021
				TypeParameter[] typeParameters = methodDeclaration.typeParameters();
2022
				if (typeParameters != null) {
2023
					for (int i = 0, max = typeParameters.length; i < max; i++) {
2024
						TypeParameter typeParameter = typeParameters[i];
2025
						if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
2026
							typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER, i, allTypeAnnotationContexts);
2027
						}
2028
					}
2029
				}
2030
			}
2031
			int size = allTypeAnnotationContexts.size();
2032
			if (size != 0) {
2033
				AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
2034
				allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
2035
				for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) {
2036
					AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
2037
					if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
2038
						invisibleTypeAnnotationsCounter++;
2039
					} else {
2040
						visibleTypeAnnotationsCounter++;
2041
					}
2042
				}
2043
				attributesNumber += generateRuntimeTypeAnnotations(
2044
						allTypeAnnotationContextsArray,
2045
						visibleTypeAnnotationsCounter,
2046
						invisibleTypeAnnotationsCounter);
2047
			}
2048
		}
2049
1837
		// update the number of attributes
2050
		// update the number of attributes
1838
		this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8);
2051
		this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8);
1839
		this.contents[methodAttributeOffset] = (byte) attributesNumber;
2052
		this.contents[methodAttributeOffset] = (byte) attributesNumber;
1840
	}
2053
	}
2054
2055
	private void dumpLocations(int[] locations) {
2056
		if (locations != null) {
2057
			int length = locations.length;
2058
			int actualSize = 2 + length;
2059
			if (this.contentsOffset + actualSize >= this.contents.length) {
2060
				resizeContents(actualSize);
2061
			}
2062
			this.contents[this.contentsOffset++] = (byte) (length >> 8);
2063
			this.contents[this.contentsOffset++] = (byte) length;
2064
			for (int i = 0; i < length; i++) {
2065
				this.contents[this.contentsOffset++] = (byte) locations[i];
2066
			}
2067
		}
2068
	}
2069
	private void dumpTargetTypeContents(int targetType, AnnotationContext annotationContext) {
2070
		switch(targetType) {
2071
			case AnnotationTargetTypeConstants.THROWS :
2072
			case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS :
2073
			case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
2074
			case AnnotationTargetTypeConstants.OBJECT_CREATION :
2075
			case AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
2076
			case AnnotationTargetTypeConstants.CLASS_LITERAL :
2077
			case AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
2078
			case AnnotationTargetTypeConstants.TYPE_INSTANCEOF :
2079
			case AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
2080
			case AnnotationTargetTypeConstants.TYPE_CAST :
2081
			case AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY :
2082
				this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8);
2083
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2084
				break;
2085
			case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
2086
			case AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
2087
				int localVariableTableOffset = this.contentsOffset;
2088
				LocalVariableBinding localVariable = annotationContext.variableBinding;
2089
				int actualSize = 0;
2090
				int initializationCount = localVariable.initializationCount;
2091
				actualSize += 6 * initializationCount;
2092
				// reserve enough space
2093
				if (this.contentsOffset + actualSize >= this.contents.length) {
2094
					resizeContents(actualSize);
2095
				}
2096
				this.contentsOffset += 2;
2097
				int numberOfEntries = 0;
2098
				for (int j = 0; j < initializationCount; j++) {
2099
					int startPC = localVariable.initializationPCs[j << 1];
2100
					int endPC = localVariable.initializationPCs[(j << 1) + 1];
2101
					if (startPC != endPC) { // only entries for non zero length
2102
						// now we can safely add the local entry
2103
						numberOfEntries++;
2104
						this.contents[this.contentsOffset++] = (byte) (startPC >> 8);
2105
						this.contents[this.contentsOffset++] = (byte) startPC;
2106
						int length = endPC - startPC;
2107
						this.contents[this.contentsOffset++] = (byte) (length >> 8);
2108
						this.contents[this.contentsOffset++] = (byte) length;
2109
						int resolvedPosition = localVariable.resolvedPosition;
2110
						this.contents[this.contentsOffset++] = (byte) (resolvedPosition >> 8);
2111
						this.contents[this.contentsOffset++] = (byte) resolvedPosition;
2112
					}
2113
				}
2114
				this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8);
2115
				this.contents[localVariableTableOffset] = (byte) numberOfEntries;
2116
				break;
2117
			case AnnotationTargetTypeConstants.METHOD_PARAMETER :
2118
			case AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
2119
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2120
				break;
2121
			// nothing to do
2122
			// case AnnotationTargetTypeConstants.METHOD_RECEIVER :
2123
			// case AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
2124
			//	break;
2125
			// case AnnotationTargetTypeConstants.FIELD :
2126
			// case AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY :
2127
			//	break;
2128
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
2129
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
2130
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2131
				break;
2132
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
2133
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
2134
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
2135
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
2136
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2137
				this.contents[this.contentsOffset++] = (byte) annotationContext.info2;
2138
				break;
2139
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
2140
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
2141
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
2142
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
2143
				// offset
2144
				this.contents[this.contentsOffset++] = (byte) (annotationContext.info >> 8);
2145
				this.contents[this.contentsOffset++] = (byte) annotationContext.info;
2146
				// type index
2147
				this.contents[this.contentsOffset++] = (byte) annotationContext.info2;
2148
		}
2149
	}
2150
1841
	/**
2151
	/**
1842
	 * INTERNAL USE-ONLY
2152
	 * INTERNAL USE-ONLY
1843
	 * This methods returns a char[] representing the file name of the receiver
2153
	 * This methods returns a char[] representing the file name of the receiver
Lines 3124-3129 Link Here
3124
		}
3434
		}
3125
		return attributesNumber;
3435
		return attributesNumber;
3126
	}
3436
	}
3437
	/**
3438
	 * @param annotationContexts the given annotation contexts
3439
	 * @param visibleTypeAnnotationsNumber the given number of visible type annotations
3440
	 * @param invisibleTypeAnnotationsNumber the given number of invisible type annotations
3441
	 * @return the number of attributes created while dumping the annotations in the .class file
3442
	 */
3443
	private int generateRuntimeTypeAnnotations(final AnnotationContext[] annotationContexts, int visibleTypeAnnotationsNumber, int invisibleTypeAnnotationsNumber) {
3444
		int attributesNumber = 0;
3445
		final int length = annotationContexts.length;
3446
3447
		int visibleTypeAnnotationsCounter = visibleTypeAnnotationsNumber;
3448
		int invisibleTypeAnnotationsCounter = invisibleTypeAnnotationsNumber;
3449
		int annotationAttributeOffset = this.contentsOffset;
3450
		int constantPOffset = this.constantPool.currentOffset;
3451
		int constantPoolIndex = this.constantPool.currentIndex;
3452
		if (invisibleTypeAnnotationsCounter != 0) {
3453
			if (this.contentsOffset + 10 >= this.contents.length) {
3454
				resizeContents(10);
3455
			}
3456
			int runtimeInvisibleAnnotationsAttributeNameIndex =
3457
				this.constantPool.literalIndex(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName);
3458
			this.contents[this.contentsOffset++] = (byte) (runtimeInvisibleAnnotationsAttributeNameIndex >> 8);
3459
			this.contents[this.contentsOffset++] = (byte) runtimeInvisibleAnnotationsAttributeNameIndex;
3460
			int attributeLengthOffset = this.contentsOffset;
3461
			this.contentsOffset += 4; // leave space for the attribute length
3462
3463
			int annotationsLengthOffset = this.contentsOffset;
3464
			this.contentsOffset += 2; // leave space for the annotations length
3465
3466
			int counter = 0;
3467
			loop: for (int i = 0; i < length; i++) {
3468
				if (invisibleTypeAnnotationsCounter == 0) break loop;
3469
				AnnotationContext annotationContext = annotationContexts[i];
3470
				if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
3471
					int currentAnnotationOffset = this.contentsOffset;
3472
					generateTypeAnnotation(annotationContext, currentAnnotationOffset);
3473
					invisibleTypeAnnotationsCounter--;
3474
					if (this.contentsOffset != currentAnnotationOffset) {
3475
						counter++;
3476
					}
3477
				}
3478
			}
3479
			if (counter != 0) {
3480
				this.contents[annotationsLengthOffset++] = (byte) (counter >> 8);
3481
				this.contents[annotationsLengthOffset++] = (byte) counter;
3482
3483
				int attributeLength = this.contentsOffset - attributeLengthOffset - 4;
3484
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
3485
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
3486
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
3487
				this.contents[attributeLengthOffset++] = (byte) attributeLength;
3488
				attributesNumber++;
3489
			} else {
3490
				this.contentsOffset = annotationAttributeOffset;
3491
				// reset the constant pool to its state before the clinit
3492
				this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeInvisibleTypeAnnotationsName, constantPoolIndex, constantPOffset);
3493
			}
3494
		}
3495
3496
		annotationAttributeOffset = this.contentsOffset;
3497
		constantPOffset = this.constantPool.currentOffset;
3498
		constantPoolIndex = this.constantPool.currentIndex;
3499
		if (visibleTypeAnnotationsCounter != 0) {
3500
			if (this.contentsOffset + 10 >= this.contents.length) {
3501
				resizeContents(10);
3502
			}
3503
			int runtimeVisibleAnnotationsAttributeNameIndex =
3504
				this.constantPool.literalIndex(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName);
3505
			this.contents[this.contentsOffset++] = (byte) (runtimeVisibleAnnotationsAttributeNameIndex >> 8);
3506
			this.contents[this.contentsOffset++] = (byte) runtimeVisibleAnnotationsAttributeNameIndex;
3507
			int attributeLengthOffset = this.contentsOffset;
3508
			this.contentsOffset += 4; // leave space for the attribute length
3509
3510
			int annotationsLengthOffset = this.contentsOffset;
3511
			this.contentsOffset += 2; // leave space for the annotations length
3512
3513
			int counter = 0;
3514
			loop: for (int i = 0; i < length; i++) {
3515
				if (visibleTypeAnnotationsCounter == 0) break loop;
3516
				AnnotationContext annotationContext = annotationContexts[i];
3517
				if ((annotationContext.visibility & AnnotationContext.VISIBLE) != 0) {
3518
					visibleTypeAnnotationsCounter--;
3519
					int currentAnnotationOffset = this.contentsOffset;
3520
					generateTypeAnnotation(annotationContext, currentAnnotationOffset);
3521
					if (this.contentsOffset != currentAnnotationOffset) {
3522
						counter++;
3523
					}
3524
				}
3525
			}
3526
			if (counter != 0) {
3527
				this.contents[annotationsLengthOffset++] = (byte) (counter >> 8);
3528
				this.contents[annotationsLengthOffset++] = (byte) counter;
3529
3530
				int attributeLength = this.contentsOffset - attributeLengthOffset - 4;
3531
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24);
3532
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16);
3533
				this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8);
3534
				this.contents[attributeLengthOffset++] = (byte) attributeLength;
3535
				attributesNumber++;
3536
			} else {
3537
				this.contentsOffset = annotationAttributeOffset;
3538
				this.constantPool.resetForAttributeName(AttributeNamesConstants.RuntimeVisibleTypeAnnotationsName, constantPoolIndex, constantPOffset);
3539
			}
3540
		}
3541
		return attributesNumber;
3542
	}
3127
3543
3128
	private int generateSignatureAttribute(char[] genericSignature) {
3544
	private int generateSignatureAttribute(char[] genericSignature) {
3129
		int localContentsOffset = this.contentsOffset;
3545
		int localContentsOffset = this.contentsOffset;
Lines 3724-3729 Link Here
3724
		return 1;
4140
		return 1;
3725
	}
4141
	}
3726
4142
4143
	private void generateTypeAnnotation(AnnotationContext annotationContext, int currentOffset) {
4144
		int targetType = annotationContext.targetType;
4145
		if (annotationContext.wildcard != null) {
4146
			generateWilcardTypeAnnotation(annotationContext, currentOffset);
4147
			return;
4148
		}
4149
		// common part between type annotation and annotation
4150
		generateAnnotation(annotationContext.annotation, currentOffset);
4151
		if (this.contentsOffset == currentOffset) {
4152
			// error occurred while generating the annotation
4153
			return;
4154
		}
4155
		int[] locations = Annotation.getLocations(
4156
			annotationContext.typeReference,
4157
			annotationContext.primaryAnnotations,
4158
			annotationContext.annotation,
4159
			annotationContext.annotationsOnDimensions);
4160
		if (locations != null) {
4161
			// convert to GENERIC_OR_ARRAY type
4162
			switch(targetType) {
4163
				case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS :
4164
					targetType = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY;
4165
					break;
4166
				case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
4167
					targetType = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY;
4168
					break;
4169
				case AnnotationTargetTypeConstants.METHOD_PARAMETER :
4170
					targetType = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY;
4171
					break;
4172
				case AnnotationTargetTypeConstants.FIELD :
4173
					targetType = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY;
4174
					break;
4175
//					case AnnotationTargetTypeConstants.METHOD_RECEIVER :
4176
//					// should not happen - possible extension
4177
//					targetType = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY;
4178
//					break;
4179
//				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
4180
//					// should not happen - possible extension
4181
//					targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4182
//					break;
4183
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
4184
					// should not happen - possible extension
4185
					targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4186
					break;
4187
//				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
4188
//					// should not happen - possible extension
4189
//					targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4190
//					break;
4191
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
4192
					// should not happen - possible extension
4193
					targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4194
					break;
4195
//				case AnnotationTargetTypeConstants.THROWS :
4196
//					targetType = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY;
4197
				case AnnotationTargetTypeConstants.TYPE_INSTANCEOF:
4198
					targetType = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY;
4199
					break;
4200
				case AnnotationTargetTypeConstants.CLASS_LITERAL:
4201
					targetType = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY;
4202
					break;
4203
				case AnnotationTargetTypeConstants.OBJECT_CREATION:
4204
					targetType = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY;
4205
					break;
4206
				case AnnotationTargetTypeConstants.TYPE_CAST:
4207
					targetType = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY;
4208
					break;
4209
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
4210
					targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY;
4211
					break;
4212
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
4213
					targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY;
4214
					break;
4215
				case AnnotationTargetTypeConstants.METHOD_RETURN_TYPE :
4216
					targetType = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY;
4217
			}
4218
		}
4219
		// reserve enough space
4220
		if (this.contentsOffset + 5 >= this.contents.length) {
4221
			resizeContents(5);
4222
		}
4223
		this.contents[this.contentsOffset++] = (byte) targetType;
4224
		dumpTargetTypeContents(targetType, annotationContext);
4225
		dumpLocations(locations);
4226
	}
4227
4228
	private void generateWilcardTypeAnnotation(AnnotationContext annotationContext, int currentOffset) {
4229
		// common part between type annotation and annotation
4230
		generateAnnotation(annotationContext.annotation, currentOffset);
4231
		if (this.contentsOffset == currentOffset) {
4232
			// error occurred while generating the annotation
4233
			return;
4234
		}
4235
		int[] wildcardLocations = getWildcardLocations(annotationContext.typeReference, annotationContext.wildcard);
4236
		int targetType = annotationContext.targetType;
4237
		switch(targetType) {
4238
			case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS :
4239
				targetType = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY;
4240
				break;
4241
			case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
4242
				targetType = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY;
4243
				break;
4244
			case AnnotationTargetTypeConstants.METHOD_PARAMETER :
4245
				targetType = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY;
4246
				break;
4247
			case AnnotationTargetTypeConstants.FIELD :
4248
				targetType = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY;
4249
				break;
4250
//				case AnnotationTargetTypeConstants.METHOD_RECEIVER :
4251
//				// should not happen - possible extension
4252
//				targetType = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY;
4253
//				break;
4254
//			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
4255
//				// should not happen - possible extension
4256
//				targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4257
//				break;
4258
//			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
4259
//				// should not happen - possible extension
4260
//				targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4261
//				break;
4262
//			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
4263
//				// should not happen - possible extension
4264
//				targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY;
4265
//				break;
4266
//			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
4267
//				// should not happen - possible extension
4268
//				targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
4269
//				break;
4270
//			case AnnotationTargetTypeConstants.THROWS :
4271
//				targetType = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY;
4272
			case AnnotationTargetTypeConstants.TYPE_INSTANCEOF:
4273
				targetType = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY;
4274
				break;
4275
			case AnnotationTargetTypeConstants.CLASS_LITERAL:
4276
				targetType = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY;
4277
				break;
4278
			case AnnotationTargetTypeConstants.OBJECT_CREATION:
4279
				targetType = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY;
4280
				break;
4281
			case AnnotationTargetTypeConstants.TYPE_CAST:
4282
				targetType = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY;
4283
				break;
4284
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
4285
				targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY;
4286
				break;
4287
			case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
4288
				targetType = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY;
4289
				break;
4290
			case AnnotationTargetTypeConstants.METHOD_RETURN_TYPE :
4291
				targetType = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY;
4292
		}
4293
		int[] locations = Annotation.getLocations(
4294
				annotationContext.wildcard.bound,
4295
				null,
4296
				annotationContext.annotation,
4297
				null);
4298
		// reserve enough space
4299
		if (this.contentsOffset + 5 >= this.contents.length) {
4300
			resizeContents(5);
4301
		}
4302
		this.contents[this.contentsOffset++] =
4303
			(byte) (locations != null ?
4304
					AnnotationTargetTypeConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
4305
					AnnotationTargetTypeConstants.WILDCARD_BOUND);
4306
		this.contents[this.contentsOffset++] = (byte) targetType;
4307
		dumpTargetTypeContents(targetType, annotationContext);
4308
		dumpLocations(wildcardLocations);
4309
		dumpLocations(locations);
4310
	}
4311
	private int generateTypeAnnotationAttributeForTypeDeclaration() {
4312
		TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext;
4313
		if ((typeDeclaration.bits & ASTNode.HasTypeAnnotations) == 0) {
4314
			return 0;
4315
		}
4316
		int attributesNumber = 0;
4317
		int visibleTypeAnnotationsCounter = 0;
4318
		int invisibleTypeAnnotationsCounter = 0;
4319
		TypeReference superclass = typeDeclaration.superclass;
4320
		List allTypeAnnotationContexts = new ArrayList();
4321
		if (superclass != null && (superclass.bits & ASTNode.HasTypeAnnotations) != 0) {
4322
			superclass.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS, -1, allTypeAnnotationContexts);
4323
		}
4324
		TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
4325
		if (superInterfaces != null) {
4326
			for (int i = 0; i < superInterfaces.length; i++) {
4327
				TypeReference superInterface = superInterfaces[i];
4328
				if ((superInterface.bits & ASTNode.HasTypeAnnotations) == 0) {
4329
					continue;
4330
				}
4331
				superInterface.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS, i, allTypeAnnotationContexts);
4332
			}
4333
		}
4334
		TypeParameter[] typeParameters = typeDeclaration.typeParameters;
4335
		if (typeParameters != null) {
4336
			for (int i = 0, max = typeParameters.length; i < max; i++) {
4337
				TypeParameter typeParameter = typeParameters[i];
4338
				if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
4339
					typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER, i, allTypeAnnotationContexts);
4340
				}
4341
			}
4342
		}
4343
		int size = allTypeAnnotationContexts.size();
4344
		if (size != 0) {
4345
			AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
4346
			allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
4347
			for (int j = 0, max = allTypeAnnotationContextsArray.length; j < max; j++) {
4348
				AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
4349
				if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
4350
					invisibleTypeAnnotationsCounter++;
4351
					allTypeAnnotationContexts.add(annotationContext);
4352
				} else {
4353
					visibleTypeAnnotationsCounter++;
4354
					allTypeAnnotationContexts.add(annotationContext);
4355
				}
4356
			}
4357
			attributesNumber += generateRuntimeTypeAnnotations(
4358
					allTypeAnnotationContextsArray,
4359
					visibleTypeAnnotationsCounter,
4360
					invisibleTypeAnnotationsCounter);
4361
		}
4362
		return attributesNumber;
4363
	}
4364
	
3727
	private int generateVarargsAttribute() {
4365
	private int generateVarargsAttribute() {
3728
		int localContentsOffset = this.contentsOffset;
4366
		int localContentsOffset = this.contentsOffset;
3729
		/*
4367
		/*
Lines 4158-4163 Link Here
4158
		this.produceAttributes = options.produceDebugAttributes;
4796
		this.produceAttributes = options.produceDebugAttributes;
4159
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
4797
		if (this.targetJDK >= ClassFileConstants.JDK1_6) {
4160
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
4798
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
4799
			if (this.targetJDK >= ClassFileConstants.JDK1_7) {
4800
				this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
4801
			}
4161
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
4802
		} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
4162
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
4803
			this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
4163
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
4804
			this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-4 / +161 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 53-59 Link Here
53
	public final static int Bit27 = 0x4000000;		// parenthesis count (expression)
53
	public final static int Bit27 = 0x4000000;		// parenthesis count (expression)
54
	public final static int Bit28 = 0x8000000;		// parenthesis count (expression)
54
	public final static int Bit28 = 0x8000000;		// parenthesis count (expression)
55
	public final static int Bit29 = 0x10000000;		// parenthesis count (expression)
55
	public final static int Bit29 = 0x10000000;		// parenthesis count (expression)
56
	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)
56
	/* elseif (if statement)
57
	 * | try block exit (try statement)
58
	 * | fall-through (case statement)
59
	 * | ignore no effect assign (expression ref)
60
	 * | needScope (for statement)
61
	 * | isAnySubRoutineEscaping (return statement)
62
	 * | blockExit (synchronized statement)
63
	 * | hasTypeAnnotations (type decl, field decl, local decl, argument, method decl, type reference)
64
	 */
65
	public final static int Bit30 = 0x20000000;
57
	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 Bit31 = 0x40000000;		// local declaration reachable (local decl) | ignore raw type check (type ref) | discard entire assignment (assignment) | isSynchronized (return statement) | thenExit (if statement)
58
	public final static int Bit32 = 0x80000000;		// reachable (statement)
67
	public final static int Bit32 = 0x80000000;		// reachable (statement)
59
68
Lines 238-243 Link Here
238
	public static final int INVOCATION_ARGUMENT_UNCHECKED = 1;
247
	public static final int INVOCATION_ARGUMENT_UNCHECKED = 1;
239
	public static final int INVOCATION_ARGUMENT_WILDCARD = 2;
248
	public static final int INVOCATION_ARGUMENT_WILDCARD = 2;
240
249
250
	// for all declarations that can contain type references that have type annotations
251
	public static final int HasTypeAnnotations = Bit30;
252
253
	// tag catch block variable as catch variable to distinguish them from argument
254
	public static final int CatchVariable = Bit1;
255
241
	public ASTNode() {
256
	public ASTNode() {
242
257
243
		super();
258
		super();
Lines 494-501 Link Here
494
	public static StringBuffer printAnnotations(Annotation[] annotations, StringBuffer output) {
509
	public static StringBuffer printAnnotations(Annotation[] annotations, StringBuffer output) {
495
		int length = annotations.length;
510
		int length = annotations.length;
496
		for (int i = 0; i < length; i++) {
511
		for (int i = 0; i < length; i++) {
497
			annotations[i].print(0, output);
512
			if (i > 0) {
498
			output.append(" "); //$NON-NLS-1$
513
				output.append(" "); //$NON-NLS-1$
514
			}
515
			Annotation annotation2 = annotations[i];
516
			if (annotation2 != null) {
517
				annotation2.print(0, output);
518
			} else {
519
				output.append('?');
520
			}
499
		}
521
		}
500
		return output;
522
		return output;
501
	}
523
	}
Lines 582-587 Link Here
582
						local.setAnnotations(annotations);
604
						local.setAnnotations(annotations);
583
					}
605
					}
584
					break;
606
					break;
607
				case Binding.TYPE_PARAMETER :
608
					// jsr308
609
					ReferenceBinding typeVariableBinding = (ReferenceBinding) recipient;
610
					if ((typeVariableBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
611
					typeVariableBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
612
					if (length > 0) {
613
						annotations = new AnnotationBinding[length];
614
						typeVariableBinding.setAnnotations(annotations);
615
					}
616
					break;
617
				case Binding.TYPE_USE :
618
					ReferenceBinding typeUseBinding = (ReferenceBinding) recipient;
619
					if ((typeUseBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
620
					typeUseBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
621
					if (length > 0) {
622
						annotations = new AnnotationBinding[length];
623
						typeUseBinding.setAnnotations(annotations);
624
					}
625
					break;
585
				default :
626
				default :
586
					return;
627
					return;
587
			}
628
			}
Lines 678-683 Link Here
678
		}
719
		}
679
	}
720
	}
680
721
722
	/**
723
	 * Resolve annotations, and check duplicates, answers combined tagBits
724
	 * for recognized standard annotations
725
	 */
726
	public static void resolveAnnotations(ClassScope scope, Annotation[] sourceAnnotations, Binding recipient) {
727
		AnnotationBinding[] annotations = null;
728
		int length = sourceAnnotations == null ? 0 : sourceAnnotations.length;
729
		if (recipient != null) {
730
			switch (recipient.kind()) {
731
				case Binding.PACKAGE :
732
					PackageBinding packageBinding = (PackageBinding) recipient;
733
					if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
734
					packageBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
735
					break;
736
				case Binding.TYPE :
737
				case Binding.GENERIC_TYPE :
738
					ReferenceBinding type = (ReferenceBinding) recipient;
739
					if ((type.tagBits & TagBits.AnnotationResolved) != 0) return;
740
					type.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
741
					if (length > 0) {
742
						annotations = new AnnotationBinding[length];
743
						type.setAnnotations(annotations);
744
					}
745
					break;
746
				case Binding.METHOD :
747
					MethodBinding method = (MethodBinding) recipient;
748
					if ((method.tagBits & TagBits.AnnotationResolved) != 0) return;
749
					method.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
750
					if (length > 0) {
751
						annotations = new AnnotationBinding[length];
752
						method.setAnnotations(annotations);
753
					}
754
					break;
755
				case Binding.FIELD :
756
					FieldBinding field = (FieldBinding) recipient;
757
					if ((field.tagBits & TagBits.AnnotationResolved) != 0) return;
758
					field.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
759
					if (length > 0) {
760
						annotations = new AnnotationBinding[length];
761
						field.setAnnotations(annotations);
762
					}
763
					break;
764
				case Binding.LOCAL :
765
					LocalVariableBinding local = (LocalVariableBinding) recipient;
766
					if ((local.tagBits & TagBits.AnnotationResolved) != 0) return;
767
					local.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
768
					if (length > 0) {
769
						annotations = new AnnotationBinding[length];
770
						local.setAnnotations(annotations);
771
					}
772
					break;
773
				default :
774
					return;
775
			}
776
		}
777
		if (sourceAnnotations == null)
778
			return;
779
		for (int i = 0; i < length; i++) {
780
			Annotation annotation = sourceAnnotations[i];
781
			final Binding annotationRecipient = annotation.recipient;
782
			if (annotationRecipient != null && recipient != null) {
783
				// only local and field can share annnotations
784
				switch (recipient.kind()) {
785
					case Binding.FIELD :
786
						FieldBinding field = (FieldBinding) recipient;
787
						field.tagBits = ((FieldBinding) annotationRecipient).tagBits;
788
						break;
789
					case Binding.LOCAL :
790
						LocalVariableBinding local = (LocalVariableBinding) recipient;
791
						local.tagBits = ((LocalVariableBinding) annotationRecipient).tagBits;
792
						break;
793
				}
794
				if (annotations != null) {
795
					// need to fill the instances array
796
					annotations[0] = annotation.getCompilerAnnotation();
797
					for (int j = 1; j < length; j++) {
798
						Annotation annot = sourceAnnotations[j];
799
						annotations[j] = annot.getCompilerAnnotation();
800
					}
801
				}
802
				return;
803
			} else {
804
				annotation.recipient = recipient;
805
				annotation.resolveType(scope);
806
				// null if receiver is a package binding
807
				if (annotations != null) {
808
					annotations[i] = annotation.getCompilerAnnotation();
809
				}
810
			}
811
		}
812
		// check duplicate annotations
813
		if (annotations != null) {
814
			AnnotationBinding[] distinctAnnotations = annotations; // only copy after 1st duplicate is detected
815
			for (int i = 0; i < length; i++) {
816
				AnnotationBinding annotation = distinctAnnotations[i];
817
				if (annotation == null) continue;
818
				TypeBinding annotationType = annotation.getAnnotationType();
819
				boolean foundDuplicate = false;
820
				for (int j = i+1; j < length; j++) {
821
					AnnotationBinding otherAnnotation = distinctAnnotations[j];
822
					if (otherAnnotation == null) continue;
823
					if (otherAnnotation.getAnnotationType() == annotationType) {
824
						foundDuplicate = true;
825
						if (distinctAnnotations == annotations) {
826
							System.arraycopy(distinctAnnotations, 0, distinctAnnotations = new AnnotationBinding[length], 0, length);
827
						}
828
						distinctAnnotations[j] = null; // report it only once
829
						scope.problemReporter().duplicateAnnotation(sourceAnnotations[j]);
830
					}
831
				}
832
				if (foundDuplicate) {
833
					scope.problemReporter().duplicateAnnotation(sourceAnnotations[i]);
834
				}
835
			}
836
		}
837
	}
681
/**
838
/**
682
 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
839
 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
683
 */
840
 */
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java (-11 / +53 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-25 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import org.eclipse.jdt.core.compiler.*;
13
import java.util.List;
14
import org.eclipse.jdt.internal.compiler.*;
14
15
import org.eclipse.jdt.core.compiler.CategorizedProblem;
16
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.core.compiler.IProblem;
18
import org.eclipse.jdt.internal.compiler.ASTVisitor;
19
import org.eclipse.jdt.internal.compiler.ClassFile;
20
import org.eclipse.jdt.internal.compiler.CompilationResult;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
22
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
15
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
23
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
16
import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
24
import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
17
import org.eclipse.jdt.internal.compiler.impl.*;
25
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
18
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
26
import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
19
import org.eclipse.jdt.internal.compiler.codegen.*;
27
import org.eclipse.jdt.internal.compiler.lookup.Binding;
20
import org.eclipse.jdt.internal.compiler.lookup.*;
28
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
21
import org.eclipse.jdt.internal.compiler.problem.*;
29
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
22
import org.eclipse.jdt.internal.compiler.parser.*;
30
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
31
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
32
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
33
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
34
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
35
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
36
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
37
import org.eclipse.jdt.internal.compiler.parser.Parser;
38
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
39
import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;
40
import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
41
import org.eclipse.jdt.internal.compiler.problem.AbortType;
42
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
43
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
23
import org.eclipse.jdt.internal.compiler.util.Util;
44
import org.eclipse.jdt.internal.compiler.util.Util;
24
45
25
public abstract class AbstractMethodDeclaration
46
public abstract class AbstractMethodDeclaration
Lines 35-40 Link Here
35
	public int modifiers;
56
	public int modifiers;
36
	public int modifiersSourceStart;
57
	public int modifiersSourceStart;
37
	public Annotation[] annotations;
58
	public Annotation[] annotations;
59
	// jsr 308
60
	public Annotation[] receiverAnnotations;
38
	public Argument[] arguments;
61
	public Argument[] arguments;
39
	public TypeReference[] thrownExceptions;
62
	public TypeReference[] thrownExceptions;
40
	public Statement[] statements;
63
	public Statement[] statements;
Lines 265-273 Link Here
265
		classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber);
288
		classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber);
266
	}
289
	}
267
290
291
	public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
292
		// do nothing
293
	}
294
268
	private void checkArgumentsSize() {
295
	private void checkArgumentsSize() {
269
		TypeBinding[] parameters = this.binding.parameters;
296
		TypeBinding[] parameters = this.binding.parameters;
270
		int size = 1; // an abstract method or a native method cannot be static
297
		int size = 1; // an abstact method or a native method cannot be static
271
		for (int i = 0, max = parameters.length; i < max; i++) {
298
		for (int i = 0, max = parameters.length; i < max; i++) {
272
			switch(parameters[i].id) {
299
			switch(parameters[i].id) {
273
				case TypeIds.T_long :
300
				case TypeIds.T_long :
Lines 353-359 Link Here
353
		}
380
		}
354
		printIndent(tab, output);
381
		printIndent(tab, output);
355
		printModifiers(this.modifiers, output);
382
		printModifiers(this.modifiers, output);
356
		if (this.annotations != null) printAnnotations(this.annotations, output);
383
		if (this.annotations != null) {
384
			printAnnotations(this.annotations, output);
385
			output.append(' ');
386
		}
357
387
358
		TypeParameter[] typeParams = typeParameters();
388
		TypeParameter[] typeParams = typeParameters();
359
		if (typeParams != null) {
389
		if (typeParams != null) {
Lines 375-380 Link Here
375
			}
405
			}
376
		}
406
		}
377
		output.append(')');
407
		output.append(')');
408
		if (this.receiverAnnotations != null) {
409
			output.append(" "); //$NON-NLS-1$
410
			printAnnotations(this.receiverAnnotations, output);
411
		}
378
		if (this.thrownExceptions != null) {
412
		if (this.thrownExceptions != null) {
379
			output.append(" throws "); //$NON-NLS-1$
413
			output.append(" throws "); //$NON-NLS-1$
380
			for (int i = 0; i < this.thrownExceptions.length; i++) {
414
			for (int i = 0; i < this.thrownExceptions.length; i++) {
Lines 419-424 Link Here
419
			bindThrownExceptions();
453
			bindThrownExceptions();
420
			resolveJavadoc();
454
			resolveJavadoc();
421
			resolveAnnotations(this.scope, this.annotations, this.binding);
455
			resolveAnnotations(this.scope, this.annotations, this.binding);
456
			// jsr308
457
			if (this.receiverAnnotations != null && this.scope.isStatic) {
458
				int last = this.receiverAnnotations.length - 1;
459
				this.scope.problemReporter().illegalReceiverAnnotations(this.receiverAnnotations[0],
460
						                                                this.receiverAnnotations[last]);
461
			}
462
			// jsr 308
463
			resolveAnnotations(this.scope, this.receiverAnnotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
422
			resolveStatements();
464
			resolveStatements();
423
			// check @Deprecated annotation presence
465
			// check @Deprecated annotation presence
424
			if (this.binding != null
466
			if (this.binding != null
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java (-2 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 87-93 Link Here
87
	public StringBuffer printAsExpression(int indent, StringBuffer output) {
87
	public StringBuffer printAsExpression(int indent, StringBuffer output) {
88
		printIndent(indent, output);
88
		printIndent(indent, output);
89
		printModifiers(this.modifiers, output);
89
		printModifiers(this.modifiers, output);
90
		if (this.annotations != null) printAnnotations(this.annotations, output);
90
		if (this.annotations != null) {
91
			printAnnotations(this.annotations, output);
92
			output.append(' ');
93
		}
91
94
92
		if (this.type != null) {
95
		if (this.type != null) {
93
			this.type.print(0, output).append(' ');
96
			this.type.print(0, output).append(' ');
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 95-101 Link Here
95
	MethodBinding codegenBinding = this.binding.original();
95
	MethodBinding codegenBinding = this.binding.original();
96
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
96
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
97
97
98
	codeStream.new_(allocatedType);
98
	codeStream.new_(this.type, allocatedType);
99
	boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
99
	boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
100
	if (valueRequired || isUnboxing) {
100
	if (valueRequired || isUnboxing) {
101
		codeStream.dup();
101
		codeStream.dup();
Lines 128-134 Link Here
128
	}
128
	}
129
	// invoke constructor
129
	// invoke constructor
130
	if (this.syntheticAccessor == null) {
130
	if (this.syntheticAccessor == null) {
131
		codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
131
		codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments);
132
	} else {
132
	} else {
133
		// synthetic accessor got some extra arguments appended to its signature, which need values
133
		// synthetic accessor got some extra arguments appended to its signature, which need values
134
		for (int i = 0,
134
		for (int i = 0,
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java (-14 / +422 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import java.util.Stack;
14
13
import org.eclipse.jdt.core.compiler.CharOperation;
15
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
17
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
Lines 23-28 Link Here
23
 */
25
 */
24
public abstract class Annotation extends Expression {
26
public abstract class Annotation extends Expression {
25
27
28
	/**
29
	 * Return the location for the corresponding annotation inside the type reference, <code>null</code> if none.
30
	 */
31
	public static int[] getLocations(
32
			final TypeReference reference,
33
			final Annotation[] primaryAnnotation,
34
			final Annotation annotation,
35
			final Annotation[][] annotationsOnDimensionsOnExpression) {
36
		class LocationCollector extends ASTVisitor {
37
			Stack currentIndexes;
38
			Annotation currentAnnotation;
39
			boolean search = true;
40
			
41
			public LocationCollector(Annotation currentAnnotation) {
42
				this.currentIndexes = new Stack();
43
				this.currentAnnotation = currentAnnotation;
44
			}
45
			public boolean visit(ArrayTypeReference typeReference, BlockScope scope) {
46
				if (!this.search) return false;
47
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
48
				if (annotationsOnDimensions != null) {
49
					// check if the annotation is located on the first dimension
50
					Annotation[] annotations = annotationsOnDimensions[0];
51
					if (annotations != null) {
52
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
53
							Annotation current = annotations[j];
54
							if (current == this.currentAnnotation) {
55
								this.search = false;
56
								return false;
57
							}
58
						}
59
					}
60
61
					this.currentIndexes.push(new Integer(0));
62
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
63
						annotations = annotationsOnDimensions[i];
64
						if (annotations != null) {
65
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
66
								Annotation current = annotations[j];
67
								if (current == this.currentAnnotation) {
68
									this.search = false;
69
									return false;
70
								}
71
							}
72
						}
73
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
74
					}
75
				}
76
				Annotation[] annotations = typeReference.annotations;
77
				if (annotations == null) {
78
					annotations = primaryAnnotation;
79
				}
80
				if (annotations != null) {
81
					for (int i = 0; i < annotations.length; i++) {
82
						Annotation current = annotations[i];
83
						if (current == this.currentAnnotation) {
84
							this.search = false;
85
							return false;
86
						}
87
					}
88
				}
89
				this.currentIndexes.pop();
90
				return true;
91
			}
92
			public boolean visit(ArrayQualifiedTypeReference typeReference, BlockScope scope) {
93
				if (!this.search) return false;
94
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
95
				if (annotationsOnDimensions != null) {
96
					// check if the annotation is located on the first dimension
97
					Annotation[] annotations = annotationsOnDimensions[0];
98
					if (annotations != null) {
99
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
100
							Annotation current = annotations[j];
101
							if (current == this.currentAnnotation) {
102
								this.search = false;
103
								return false;
104
							}
105
						}
106
					}
107
108
					this.currentIndexes.push(new Integer(0));
109
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
110
						annotations = annotationsOnDimensions[i];
111
						if (annotations != null) {
112
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
113
								Annotation current = annotations[j];
114
								if (current == this.currentAnnotation) {
115
									this.search = false;
116
									return false;
117
								}
118
							}
119
						}
120
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
121
					}
122
				}
123
				Annotation[] annotations = typeReference.annotations;
124
				if (annotations == null) {
125
					annotations = primaryAnnotation;
126
				}
127
				if (annotations != null) {
128
					for (int i = 0; i < annotations.length; i++) {
129
						Annotation current = annotations[i];
130
						if (current == this.currentAnnotation) {
131
							this.search = false;
132
							return false;
133
						}
134
					}
135
				}
136
				this.currentIndexes.pop();
137
				return true;
138
			}
139
			public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) {
140
				if (!this.search) return false;
141
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
142
				if (annotationsOnDimensions != null) {
143
					// check if the annotation is located on the first dimension
144
					Annotation[] annotations = annotationsOnDimensions[0];
145
					if (annotations != null) {
146
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
147
							Annotation current = annotations[j];
148
							if (current == this.currentAnnotation) {
149
								this.search = false;
150
								return false;
151
							}
152
						}
153
					}
154
155
					this.currentIndexes.push(new Integer(0));
156
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
157
						annotations = annotationsOnDimensions[i];
158
						if (annotations != null) {
159
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
160
								Annotation current = annotations[j];
161
								if (current == this.currentAnnotation) {
162
									this.search = false;
163
									return false;
164
								}
165
							}
166
						}
167
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
168
					}
169
				}
170
				Annotation[] annotations = typeReference.annotations;
171
				if (annotations == null) {
172
					annotations = primaryAnnotation;
173
				}
174
				if (annotations != null) {
175
					for (int i = 0; i < annotations.length; i++) {
176
						Annotation current = annotations[i];
177
						if (current == this.currentAnnotation) {
178
							this.search = false;
179
							return false;
180
						}
181
					}
182
				}
183
				TypeReference[] typeReferences = typeReference.typeArguments;
184
				this.currentIndexes.push(new Integer(0));
185
				for (int i = 0, max = typeReferences.length; i < max; i++) {
186
					typeReferences[i].traverse(this, scope);
187
					if (!this.search) return false;
188
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
189
				}
190
				this.currentIndexes.pop();
191
				return true;
192
			}
193
			public boolean visit(ParameterizedQualifiedTypeReference typeReference, BlockScope scope) {
194
				if (!this.search) return false;
195
				Annotation[][] annotationsOnDimensions = typeReference.annotationsOnDimensions;
196
				if (annotationsOnDimensions != null) {
197
					// check if the annotation is located on the first dimension
198
					Annotation[] annotations = annotationsOnDimensions[0];
199
					if (annotations != null) {
200
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
201
							Annotation current = annotations[j];
202
							if (current == this.currentAnnotation) {
203
								this.search = false;
204
								return false;
205
							}
206
						}
207
					}
208
209
					this.currentIndexes.push(new Integer(0));
210
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
211
						annotations = annotationsOnDimensions[i];
212
						if (annotations != null) {
213
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
214
								Annotation current = annotations[j];
215
								if (current == this.currentAnnotation) {
216
									this.search = false;
217
									return false;
218
								}
219
							}
220
						}
221
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
222
					}
223
				}
224
				Annotation[] annotations = typeReference.annotations;
225
				if (annotations == null) {
226
					annotations = primaryAnnotation;
227
				}
228
				if (annotations != null) {
229
					for (int i = 0; i < annotations.length; i++) {
230
						Annotation current = annotations[i];
231
						if (current == this.currentAnnotation) {
232
							this.search = false;
233
							return false;
234
						}
235
					}
236
				}
237
				//TODO it is unclear how to manage annotations located in the first type arguments
238
				TypeReference[] typeReferences = typeReference.typeArguments[typeReference.typeArguments.length - 1];
239
				this.currentIndexes.push(new Integer(0));
240
				for (int i = 0, max = typeReferences.length; i < max; i++) {
241
					typeReferences[i].traverse(this, scope);
242
					if (!this.search) return false;
243
					this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
244
				}
245
				this.currentIndexes.pop();
246
				return true;
247
			}
248
			public boolean visit(SingleTypeReference typeReference, BlockScope scope) {
249
				if (!this.search) return false;
250
				Annotation[][] annotationsOnDimensions = annotationsOnDimensionsOnExpression;
251
				if (annotationsOnDimensions != null) {
252
					// check if the annotation is located on the first dimension
253
					Annotation[] annotations = annotationsOnDimensions[0];
254
					if (annotations != null) {
255
						for (int j = 0, max2 = annotations.length; j < max2; j++) {
256
							Annotation current = annotations[j];
257
							if (current == this.currentAnnotation) {
258
								this.search = false;
259
								return false;
260
							}
261
						}
262
					}
263
264
					this.currentIndexes.push(new Integer(0));
265
					for (int i = 1, max = annotationsOnDimensions.length; i < max; i++) {
266
						annotations = annotationsOnDimensions[i];
267
						if (annotations != null) {
268
							for (int j = 0, max2 = annotations.length; j < max2; j++) {
269
								Annotation current = annotations[j];
270
								if (current == this.currentAnnotation) {
271
									this.search = false;
272
									return false;
273
								}
274
							}
275
						}
276
						this.currentIndexes.push(new Integer(((Integer) this.currentIndexes.pop()).intValue() + 1));
277
					}
278
				}
279
				Annotation[] annotations = typeReference.annotations;
280
				if (annotations != null) {
281
					for (int i = 0; i < annotations.length; i++) {
282
						Annotation current = annotations[i];
283
						if (current == this.currentAnnotation) {
284
							this.search = false;
285
							return false;
286
						}
287
					}
288
				}
289
				return false;
290
			}
291
			public boolean visit(Wildcard typeReference, BlockScope scope) {
292
				if (!this.search) return false;
293
				TypeReference bound = typeReference.bound;
294
				bound.traverse(this, scope);
295
				return true;
296
			}
297
			public boolean visit(QualifiedTypeReference typeReference, BlockScope scope) {
298
				if (!this.search) return false;
299
				Annotation[] annotations = typeReference.annotations;
300
				if (annotations != null) {
301
					for (int i = 0; i < annotations.length; i++) {
302
						Annotation current = annotations[i];
303
						if (current == this.currentAnnotation) {
304
							this.search = false;
305
							return false;
306
						}
307
					}
308
				}
309
				return true;
310
			}
311
			public String toString() {
312
				StringBuffer buffer = new StringBuffer();
313
				buffer
314
					.append("search location for ") //$NON-NLS-1$
315
					.append(this.currentAnnotation)
316
					.append("\ncurrent indexes : ") //$NON-NLS-1$
317
					.append(this.currentIndexes);
318
				return String.valueOf(buffer);
319
			}
320
		}
321
		if (reference == null) return null;
322
		LocationCollector collector = new LocationCollector(annotation);
323
		reference.traverse(collector, (BlockScope) null);
324
		if (collector.currentIndexes.isEmpty()) {
325
			return null;
326
		}
327
		int size = collector.currentIndexes.size();
328
		int[] result = new int[size];
329
		for (int i = 0; i < size; i++) {
330
			result[size - i - 1] = ((Integer) collector.currentIndexes.pop()).intValue();
331
		}
332
		return result;
333
	}
334
	// jsr 308
335
	public static class TypeUseBinding extends ReferenceBinding {
336
		private int kind;
337
		public TypeUseBinding(int kind) {
338
			this.tagBits = 0L;
339
			this.kind = kind;
340
		}
341
		public int kind() {
342
			return this.kind;
343
		}
344
	}
345
26
	final static MemberValuePair[] NoValuePairs = new MemberValuePair[0];
346
	final static MemberValuePair[] NoValuePairs = new MemberValuePair[0];
27
	public int declarationSourceEnd;
347
	public int declarationSourceEnd;
28
	public Binding recipient;
348
	public Binding recipient;
Lines 86-91 Link Here
86
			case 'T' :
406
			case 'T' :
87
				if (CharOperation.equals(elementName, TypeConstants.TYPE))
407
				if (CharOperation.equals(elementName, TypeConstants.TYPE))
88
					return TagBits.AnnotationForType;
408
					return TagBits.AnnotationForType;
409
				if (CharOperation.equals(elementName, TypeConstants.TYPE_USE_TARGET))
410
					return TagBits.AnnotationForTypeUse;
411
				if (CharOperation.equals(elementName, TypeConstants.TYPE_PARAMETER_TARGET))
412
					return TagBits.AnnotationForTypeParameter;
89
				break;
413
				break;
90
		}
414
		}
91
		return 0; // unknown
415
		return 0; // unknown
Lines 175-192 Link Here
175
			return false;
499
			return false;
176
		}
500
		}
177
		long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference
501
		long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference
502
		// jsr 308
503
		// we need to filter out type use and type parameter annotations
504
		if ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) != 0) {
505
			return false;
506
		}
507
508
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
509
			return true; // by default the retention is CLASS
510
511
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention;
512
	}
513
514
	public boolean isRuntimeTypeInvisible() {
515
		final TypeBinding annotationBinding = this.resolvedType;
516
		if (annotationBinding == null) {
517
			return false;
518
		}
519
		long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference
520
		// jsr 308
521
		// we need to filter out type use and type parameter annotations
522
		if ((metaTagBits & (TagBits.AnnotationTargetMASK)) != 0
523
				&& ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) == 0)) {
524
			return false;
525
		}
526
178
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
527
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
179
			return true; // by default the retention is CLASS
528
			return true; // by default the retention is CLASS
180
529
181
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention;
530
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention;
182
	}
531
	}
183
532
533
	public boolean isRuntimeTypeVisible() {
534
		final TypeBinding annotationBinding = this.resolvedType;
535
		if (annotationBinding == null) {
536
			return false;
537
		}
538
		long metaTagBits = annotationBinding.getAnnotationTagBits();
539
		if ((metaTagBits & (TagBits.AnnotationTargetMASK)) != 0
540
				&& ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) == 0)) {
541
			return false;
542
		}
543
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
544
			return false; // by default the retention is CLASS
545
546
		return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention;
547
	}
548
184
	public boolean isRuntimeVisible() {
549
	public boolean isRuntimeVisible() {
185
		final TypeBinding annotationBinding = this.resolvedType;
550
		final TypeBinding annotationBinding = this.resolvedType;
186
		if (annotationBinding == null) {
551
		if (annotationBinding == null) {
187
			return false;
552
			return false;
188
		}
553
		}
189
		long metaTagBits = annotationBinding.getAnnotationTagBits();
554
		long metaTagBits = annotationBinding.getAnnotationTagBits();
555
		if ((metaTagBits & (TagBits.AnnotationForTypeParameter | TagBits.AnnotationForTypeUse)) != 0) {
556
			return false;
557
		}
190
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
558
		if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0)
191
			return false; // by default the retention is CLASS
559
			return false; // by default the retention is CLASS
192
560
Lines 264-270 Link Here
264
			scope.problemReporter().typeMismatchError(typeBinding, scope.getJavaLangAnnotationAnnotation(), this.type, null);
632
			scope.problemReporter().typeMismatchError(typeBinding, scope.getJavaLangAnnotationAnnotation(), this.type, null);
265
			return null;
633
			return null;
266
		}
634
		}
267
268
		ReferenceBinding annotationType = (ReferenceBinding) this.resolvedType;
635
		ReferenceBinding annotationType = (ReferenceBinding) this.resolvedType;
269
		MethodBinding[] methods = annotationType.methods();
636
		MethodBinding[] methods = annotationType.methods();
270
		// clone valuePairs to keep track of unused ones
637
		// clone valuePairs to keep track of unused ones
Lines 314-329 Link Here
314
					}
681
					}
315
				}
682
				}
316
			}
683
			}
317
			if (!foundValue &&
684
			if (!foundValue
318
					(method.modifiers & ClassFileConstants.AccAnnotationDefault) == 0 &&
685
					&& (method.modifiers & ClassFileConstants.AccAnnotationDefault) == 0
319
					(this.bits & IsRecovered) == 0) {
686
					&& (this.bits & IsRecovered) == 0
687
					&& annotationType.isValidBinding()) {
320
				scope.problemReporter().missingValueForAnnotationMember(this, selector);
688
				scope.problemReporter().missingValueForAnnotationMember(this, selector);
321
			}
689
			}
322
		}
690
		}
323
		// check unused pairs
691
		// check unused pairs
324
		for (int i = 0; i < pairsLength; i++) {
692
		for (int i = 0; i < pairsLength; i++) {
325
			if (pairs[i] != null) {
693
			if (pairs[i] != null) {
326
				scope.problemReporter().undefinedAnnotationValue(annotationType, pairs[i]);
694
				if (annotationType.isValidBinding()) {
695
					scope.problemReporter().undefinedAnnotationValue(annotationType, pairs[i]);
696
				}
327
				pairs[i].resolveTypeExpecting(scope, null); // resilient
697
				pairs[i].resolveTypeExpecting(scope, null); // resilient
328
			}
698
			}
329
		}
699
		}
Lines 386-404 Link Here
386
			}
756
			}
387
			// check (meta)target compatibility
757
			// check (meta)target compatibility
388
			checkTargetCompatibility: {
758
			checkTargetCompatibility: {
759
				if (!annotationType.isValidBinding()) {
760
					// no need to check annotation usage if missing
761
					break checkTargetCompatibility;
762
				}
763
389
				long metaTagBits = annotationType.getAnnotationTagBits(); // could be forward reference
764
				long metaTagBits = annotationType.getAnnotationTagBits(); // could be forward reference
390
				if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) // does not specify any target restriction
765
				if ((metaTagBits & TagBits.AnnotationTargetMASK) == 0) {
766
					// does not specify any target restriction - all locations are possible including type annotations
391
					break checkTargetCompatibility;
767
					break checkTargetCompatibility;
768
				}
392
769
393
				switch (this.recipient.kind()) {
770
				switch (this.recipient.kind()) {
394
					case Binding.PACKAGE :
771
					case Binding.PACKAGE :
395
						if ((metaTagBits & TagBits.AnnotationForPackage) != 0)
772
						if ((metaTagBits & TagBits.AnnotationForPackage) != 0)
396
							break checkTargetCompatibility;
773
							break checkTargetCompatibility;
397
						break;
774
						break;
775
					case Binding.TYPE_USE :
776
						if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
777
							// jsr 308
778
							break checkTargetCompatibility;
779
						}
780
						break;
398
					case Binding.TYPE :
781
					case Binding.TYPE :
399
					case Binding.GENERIC_TYPE :
782
					case Binding.GENERIC_TYPE :
400
						if (((ReferenceBinding)this.recipient).isAnnotationType()) {
783
						if (((ReferenceBinding)this.recipient).isAnnotationType()) {
401
							if ((metaTagBits & (TagBits.AnnotationForAnnotationType|TagBits.AnnotationForType)) != 0)
784
							if ((metaTagBits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType)) != 0)
402
							break checkTargetCompatibility;
785
							break checkTargetCompatibility;
403
						} else if ((metaTagBits & TagBits.AnnotationForType) != 0) {
786
						} else if ((metaTagBits & TagBits.AnnotationForType) != 0) {
404
							break checkTargetCompatibility;
787
							break checkTargetCompatibility;
Lines 408-431 Link Here
408
						}
791
						}
409
						break;
792
						break;
410
					case Binding.METHOD :
793
					case Binding.METHOD :
411
						if (((MethodBinding)this.recipient).isConstructor()) {
794
						MethodBinding methodBinding = (MethodBinding) this.recipient;
795
						if (methodBinding.isConstructor()) {
412
							if ((metaTagBits & TagBits.AnnotationForConstructor) != 0)
796
							if ((metaTagBits & TagBits.AnnotationForConstructor) != 0)
413
								break checkTargetCompatibility;
797
								break checkTargetCompatibility;
414
						} else 	if ((metaTagBits & TagBits.AnnotationForMethod) != 0)
798
						} else if ((metaTagBits & TagBits.AnnotationForMethod) != 0) {
415
							break checkTargetCompatibility;
799
							break checkTargetCompatibility;
800
						} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
801
							// jsr 308 - annotation on method return type
802
							if (methodBinding.returnType != null && methodBinding.returnType.id == T_void) {
803
								scope.problemReporter().illegalUsageOfTypeAnnotations(this);
804
							}
805
							break checkTargetCompatibility;
806
						}
416
						break;
807
						break;
417
					case Binding.FIELD :
808
					case Binding.FIELD :
418
						if ((metaTagBits & TagBits.AnnotationForField) != 0)
809
						if ((metaTagBits & TagBits.AnnotationForField) != 0) {
810
							break checkTargetCompatibility;
811
						} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
812
							// jsr 308 - annotation on field type
419
							break checkTargetCompatibility;
813
							break checkTargetCompatibility;
814
						}
420
						break;
815
						break;
421
					case Binding.LOCAL :
816
					case Binding.LOCAL :
422
						if ((((LocalVariableBinding)this.recipient).tagBits & TagBits.IsArgument) != 0) {
817
						if ((((LocalVariableBinding)this.recipient).tagBits & TagBits.IsArgument) != 0) {
423
							if ((metaTagBits & TagBits.AnnotationForParameter) != 0)
818
							if ((metaTagBits & TagBits.AnnotationForParameter) != 0) {
819
								break checkTargetCompatibility;
820
							} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
821
								// jsr 308 - annotation on method parameter type
424
								break checkTargetCompatibility;
822
								break checkTargetCompatibility;
425
						} else 	if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0)
823
							}
824
						} else if ((annotationType.tagBits & TagBits.AnnotationForLocalVariable) != 0) {
426
							break checkTargetCompatibility;
825
							break checkTargetCompatibility;
826
						} else if ((metaTagBits & TagBits.AnnotationForTypeUse) != 0) {
827
							// jsr 308 - annotation on local type
828
							break checkTargetCompatibility;
829
						}
427
						break;
830
						break;
428
				}
831
					case Binding.TYPE_PARAMETER : // jsr308
832
						if ((metaTagBits & TagBits.AnnotationForTypeParameter) != 0) {
833
							break checkTargetCompatibility;
834
						}
835
					}
429
				scope.problemReporter().disallowedTargetForAnnotation(this);
836
				scope.problemReporter().disallowedTargetForAnnotation(this);
430
			}
837
			}
431
		}
838
		}
Lines 434-437 Link Here
434
841
435
	public abstract void traverse(ASTVisitor visitor, BlockScope scope);
842
	public abstract void traverse(ASTVisitor visitor, BlockScope scope);
436
843
844
	public abstract void traverse(ASTVisitor visitor, ClassScope scope);
437
}
845
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java (-1 / +4 lines)
Lines 55-61 Link Here
55
55
56
		printIndent(tab, output);
56
		printIndent(tab, output);
57
		printModifiers(this.modifiers, output);
57
		printModifiers(this.modifiers, output);
58
		if (this.annotations != null) printAnnotations(this.annotations, output);
58
		if (this.annotations != null) {
59
			printAnnotations(this.annotations, output);
60
			output.append(' ');
61
		}
59
62
60
		TypeParameter[] typeParams = typeParameters();
63
		TypeParameter[] typeParams = typeParameters();
61
		if (typeParams != null) {
64
		if (typeParams != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java (-3 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 26-31 Link Here
26
		this.declarationSourceEnd = (int) posNom;
26
		this.declarationSourceEnd = (int) posNom;
27
		this.modifiers = modifiers;
27
		this.modifiers = modifiers;
28
		this.type = tr;
28
		this.type = tr;
29
		if (tr != null) {
30
			this.bits |= (tr.bits & ASTNode.HasTypeAnnotations);
31
		}
29
		this.bits |= IsLocalDeclarationReachable;
32
		this.bits |= IsLocalDeclarationReachable;
30
	}
33
	}
31
34
Lines 76-82 Link Here
76
	public int getKind() {
79
	public int getKind() {
77
		return PARAMETER;
80
		return PARAMETER;
78
	}
81
	}
79
82
	public boolean isArgument() {
83
		return true;
84
	}
80
	public boolean isVarArgs() {
85
	public boolean isVarArgs() {
81
		return this.type != null &&  (this.type.bits & IsVarArgs) != 0;
86
		return this.type != null &&  (this.type.bits & IsVarArgs) != 0;
82
	}
87
	}
Lines 85-91 Link Here
85
90
86
		printIndent(indent, output);
91
		printIndent(indent, output);
87
		printModifiers(this.modifiers, output);
92
		printModifiers(this.modifiers, output);
88
		if (this.annotations != null) printAnnotations(this.annotations, output);
93
		if (this.annotations != null) {
94
			printAnnotations(this.annotations, output);
95
			output.append(' ');
96
		}
89
97
90
		if (this.type == null) {
98
		if (this.type == null) {
91
			output.append("<no type> "); //$NON-NLS-1$
99
			output.append("<no type> "); //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java (-4 / +16 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 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 130-136 Link Here
130
			}
136
			}
131
			// allow new List<?>[5] - only check for generic array when no initializer, since also checked inside initializer resolution
137
			// allow new List<?>[5] - only check for generic array when no initializer, since also checked inside initializer resolution
132
			if (referenceType != null && !referenceType.isReifiable()) {
138
			if (referenceType != null && !referenceType.isReifiable()) {
133
			    scope.problemReporter().illegalGenericArray(referenceType, this);
139
				scope.problemReporter().illegalGenericArray(referenceType, this);
134
			}
140
			}
135
		} else if (explicitDimIndex >= 0) {
141
		} else if (explicitDimIndex >= 0) {
136
			scope.problemReporter().cannotDefineDimensionsAndInitializer(this);
142
			scope.problemReporter().cannotDefineDimensionsAndInitializer(this);
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
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 48-54 Link Here
48
		int pc = codeStream.position;
48
		int pc = codeStream.position;
49
		int expressionLength = (this.expressions == null) ? 0: this.expressions.length;
49
		int expressionLength = (this.expressions == null) ? 0: this.expressions.length;
50
		codeStream.generateInlinedValue(expressionLength);
50
		codeStream.generateInlinedValue(expressionLength);
51
		codeStream.newArray(this.binding);
51
		codeStream.newArray(null, this.binding);
52
		if (this.expressions != null) {
52
		if (this.expressions != null) {
53
			// binding is an ArrayType, so I can just deal with the dimension
53
			// binding is an ArrayType, so I can just deal with the dimension
54
			int elementsTypeID = this.binding.dimensions > 1 ? -1 : this.binding.leafComponentType.id;
54
			int elementsTypeID = this.binding.dimensions > 1 ? -1 : this.binding.leafComponentType.id;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java (-5 / +86 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 17-33 Link Here
17
17
18
public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
18
public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
19
	int dimensions;
19
	int dimensions;
20
	Annotation[][] annotationsOnDimensions;  // jsr308 style type annotations on dimensions
20
21
21
	public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
22
	public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
22
23
23
		super( sources , poss);
24
		super( sources , poss);
24
		this.dimensions = dim ;
25
		this.dimensions = dim ;
26
		this.annotationsOnDimensions = null; 
27
	}
28
29
	public ArrayQualifiedTypeReference(char[][] sources, int dim, Annotation[][] annotationsOnDimensions, long[] poss) {
30
		this(sources, dim, poss);
31
		this.annotationsOnDimensions = annotationsOnDimensions;
32
		this.bits |= ASTNode.HasTypeAnnotations;
25
	}
33
	}
26
34
27
	public int dimensions() {
35
	public int dimensions() {
28
36
29
		return this.dimensions;
37
		return this.dimensions;
30
	}
38
	}
39
	
40
	public Annotation[][] getAnnotationsOnDimensions() {
41
		return this.annotationsOnDimensions;
42
	}
31
43
32
	/**
44
	/**
33
	 * @return char[][]
45
	 * @return char[][]
Lines 70-85 Link Here
70
		}
82
		}
71
	}
83
	}
72
84
85
	protected TypeBinding internalResolveType(Scope scope) {
86
		TypeBinding internalResolveType = super.internalResolveType(scope);
87
		if (this.annotationsOnDimensions != null) {
88
			switch(scope.kind) {
89
				case Scope.BLOCK_SCOPE :
90
				case Scope.METHOD_SCOPE :
91
					for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
92
						Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
93
						resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
94
					}
95
					break;
96
			}
97
		}
98
		return internalResolveType;
99
	}
100
73
	public StringBuffer printExpression(int indent, StringBuffer output){
101
	public StringBuffer printExpression(int indent, StringBuffer output){
74
102
75
		super.printExpression(indent, output);
103
		super.printExpression(indent, output);
76
		if ((this.bits & IsVarArgs) != 0) {
104
		if ((this.bits & IsVarArgs) != 0) {
77
			for (int i= 0 ; i < this.dimensions - 1; i++) {
105
			for (int i= 0 ; i < this.dimensions - 1; i++) {
106
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
107
					output.append(' ');
108
					printAnnotations(this.annotationsOnDimensions[i], output);
109
					output.append(' ');
110
				}
78
				output.append("[]"); //$NON-NLS-1$
111
				output.append("[]"); //$NON-NLS-1$
79
			}
112
			}
113
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
114
				output.append(' ');
115
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
116
				output.append(' ');
117
			}
80
			output.append("..."); //$NON-NLS-1$
118
			output.append("..."); //$NON-NLS-1$
81
		} else {
119
		} else {
82
			for (int i= 0 ; i < this.dimensions; i++) {
120
			for (int i= 0 ; i < this.dimensions; i++) {
121
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
122
					output.append(" "); //$NON-NLS-1$
123
					printAnnotations(this.annotationsOnDimensions[i], output);
124
					output.append(" "); //$NON-NLS-1$
125
				}
83
				output.append("[]"); //$NON-NLS-1$
126
				output.append("[]"); //$NON-NLS-1$
84
			}
127
			}
85
		}
128
		}
Lines 87-100 Link Here
87
	}
130
	}
88
131
89
	public void traverse(ASTVisitor visitor, BlockScope scope) {
132
	public void traverse(ASTVisitor visitor, BlockScope scope) {
90
133
		if (visitor.visit(this, scope)) {
91
		visitor.visit(this, scope);
134
			if (this.annotations != null) {
135
				int annotationsLength = this.annotations.length;
136
				for (int i = 0; i < annotationsLength; i++)
137
					this.annotations[i].traverse(visitor, scope);
138
			}
139
			if (this.annotationsOnDimensions != null) {
140
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
141
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
142
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
143
						Annotation annotation = annotations2[j];
144
						annotation.traverse(visitor, scope);
145
					}
146
				}
147
			}
148
		}
92
		visitor.endVisit(this, scope);
149
		visitor.endVisit(this, scope);
93
	}
150
	}
94
151
95
	public void traverse(ASTVisitor visitor, ClassScope scope) {
152
	public void traverse(ASTVisitor visitor, ClassScope scope) {
96
153
		if (visitor.visit(this, scope)) {
97
		visitor.visit(this, scope);
154
			if (this.annotations != null) {
155
				int annotationsLength = this.annotations.length;
156
				for (int i = 0; i < annotationsLength; i++)
157
					this.annotations[i].traverse(visitor, scope);
158
			}
159
			if (this.annotationsOnDimensions != null) {
160
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
161
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
162
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
163
						Annotation annotation = annotations2[j];
164
						annotation.traverse(visitor, scope);
165
					}
166
				}
167
			}
168
		}
98
		visitor.endVisit(this, scope);
169
		visitor.endVisit(this, scope);
99
	}
170
	}
171
172
	protected void resolveAnnotations(BlockScope scope) {
173
		super.resolveAnnotations(scope);
174
		if (this.annotationsOnDimensions != null) {
175
			for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
176
				Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
177
				resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
178
			}
179
		}
180
	}
100
}
181
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java (-5 / +92 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 12-17 Link Here
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.lookup.Binding;
15
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
16
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
16
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
17
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
17
import org.eclipse.jdt.internal.compiler.lookup.Scope;
18
import org.eclipse.jdt.internal.compiler.lookup.Scope;
Lines 19-24 Link Here
19
20
20
public class ArrayTypeReference extends SingleTypeReference {
21
public class ArrayTypeReference extends SingleTypeReference {
21
	public int dimensions;
22
	public int dimensions;
23
	public Annotation[][] annotationsOnDimensions; // jsr308 style type annotations on dimensions.
22
	public int originalSourceEnd;
24
	public int originalSourceEnd;
23
25
24
	/**
26
	/**
Lines 32-43 Link Here
32
		super(source, pos);
34
		super(source, pos);
33
		this.originalSourceEnd = this.sourceEnd;
35
		this.originalSourceEnd = this.sourceEnd;
34
		this.dimensions = dimensions ;
36
		this.dimensions = dimensions ;
37
		this.annotationsOnDimensions = null;
38
	}
39
40
	public ArrayTypeReference(char[] source, int dimensions, Annotation[][] annotationsOnDimensions, long pos) {
41
		this(source, dimensions, pos);
42
		if (annotationsOnDimensions != null) {
43
			this.bits |= ASTNode.HasTypeAnnotations;
44
		}
45
		this.annotationsOnDimensions = annotationsOnDimensions;
35
	}
46
	}
36
47
37
	public int dimensions() {
48
	public int dimensions() {
38
49
39
		return this.dimensions;
50
		return this.dimensions;
40
	}
51
	}
52
	
53
	public Annotation[][] getAnnotationsOnDimensions() {
54
		return this.annotationsOnDimensions;
55
	}
41
	/**
56
	/**
42
	 * @return char[][]
57
	 * @return char[][]
43
	 */
58
	 */
Lines 69-79 Link Here
69
		super.printExpression(indent, output);
84
		super.printExpression(indent, output);
70
		if ((this.bits & IsVarArgs) != 0) {
85
		if ((this.bits & IsVarArgs) != 0) {
71
			for (int i= 0 ; i < this.dimensions - 1; i++) {
86
			for (int i= 0 ; i < this.dimensions - 1; i++) {
87
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
88
					output.append(' ');
89
					printAnnotations(this.annotationsOnDimensions[i], output);
90
					output.append(' ');
91
				}
72
				output.append("[]"); //$NON-NLS-1$
92
				output.append("[]"); //$NON-NLS-1$
73
			}
93
			}
94
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
95
				output.append(' ');
96
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
97
				output.append(' ');
98
			}
74
			output.append("..."); //$NON-NLS-1$
99
			output.append("..."); //$NON-NLS-1$
75
		} else {
100
		} else {
76
			for (int i= 0 ; i < this.dimensions; i++) {
101
			for (int i= 0 ; i < this.dimensions; i++) {
102
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
103
					output.append(" "); //$NON-NLS-1$
104
					printAnnotations(this.annotationsOnDimensions[i], output);
105
					output.append(" "); //$NON-NLS-1$
106
				}
77
				output.append("[]"); //$NON-NLS-1$
107
				output.append("[]"); //$NON-NLS-1$
78
			}
108
			}
79
		}
109
		}
Lines 81-94 Link Here
81
	}
111
	}
82
112
83
	public void traverse(ASTVisitor visitor, BlockScope scope) {
113
	public void traverse(ASTVisitor visitor, BlockScope scope) {
84
114
		if (visitor.visit(this, scope)) {
85
		visitor.visit(this, scope);
115
			if (this.annotations != null) {
116
				int annotationsLength = this.annotations.length;
117
				for (int i = 0; i < annotationsLength; i++)
118
					this.annotations[i].traverse(visitor, scope);
119
			}
120
			if (this.annotationsOnDimensions != null) {
121
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
122
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
123
					if (annotations2 != null) {
124
						for (int j = 0, max2 = annotations2.length; j < max2; j++) {
125
							Annotation annotation = annotations2[j];
126
							annotation.traverse(visitor, scope);
127
						}
128
					}
129
				}
130
			}
131
		}
86
		visitor.endVisit(this, scope);
132
		visitor.endVisit(this, scope);
87
	}
133
	}
88
134
89
	public void traverse(ASTVisitor visitor, ClassScope scope) {
135
	public void traverse(ASTVisitor visitor, ClassScope scope) {
90
136
		if (visitor.visit(this, scope)) {
91
		visitor.visit(this, scope);
137
			if (this.annotations != null) {
138
				int annotationsLength = this.annotations.length;
139
				for (int i = 0; i < annotationsLength; i++)
140
					this.annotations[i].traverse(visitor, scope);
141
			}
142
			if (this.annotationsOnDimensions != null) {
143
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
144
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
145
					if (annotations2 != null) {
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
			}
153
		}
92
		visitor.endVisit(this, scope);
154
		visitor.endVisit(this, scope);
93
	}
155
	}
156
157
	protected TypeBinding internalResolveType(Scope scope) {
158
		TypeBinding internalResolveType = super.internalResolveType(scope);
159
		if (this.annotationsOnDimensions != null) {
160
			switch(scope.kind) {
161
				case Scope.BLOCK_SCOPE :
162
				case Scope.METHOD_SCOPE :
163
					for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
164
						Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
165
						resolveAnnotations((BlockScope) scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
166
					}
167
					break;
168
			}
169
		}
170
		return internalResolveType;
171
	}
172
	protected void resolveAnnotations(BlockScope scope) {
173
		super.resolveAnnotations(scope);
174
		if (this.annotationsOnDimensions != null) {
175
			for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
176
				Annotation[] annotationsOnDimension = this.annotationsOnDimensions[i];
177
				resolveAnnotations(scope, annotationsOnDimension, new Annotation.TypeUseBinding(Binding.TYPE_USE));
178
			}
179
		}
180
	}
94
}
181
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 12-18 Link Here
12
12
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
14
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.codegen.CaseLabel;
15
import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
16
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
16
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
17
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
17
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
18
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
18
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
Lines 27-33 Link Here
27
public class CaseStatement extends Statement {
27
public class CaseStatement extends Statement {
28
28
29
	public Expression constantExpression;
29
	public Expression constantExpression;
30
	public CaseLabel targetLabel;
30
	public BranchLabel targetLabel;
31
31
32
public CaseStatement(Expression constantExpression, int sourceEnd, int sourceStart) {
32
public CaseStatement(Expression constantExpression, int sourceEnd, int sourceStart) {
33
	this.constantExpression = constantExpression;
33
	this.constantExpression = constantExpression;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java (-47 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 37-47 Link Here
37
public class CastExpression extends Expression {
37
public class CastExpression extends Expression {
38
38
39
	public Expression expression;
39
	public Expression expression;
40
	public Expression type;
40
	public TypeReference type;
41
	public TypeBinding expectedType; // when assignment conversion to a given expected type: String s = (String) t;
41
	public TypeBinding expectedType; // when assignment conversion to a given expected type: String s = (String) t;
42
42
43
//expression.implicitConversion holds the cast for baseType casting
43
//expression.implicitConversion holds the cast for baseType casting
44
public CastExpression(Expression expression, Expression type) {
44
public CastExpression(Expression expression, TypeReference type) {
45
	this.expression = expression;
45
	this.expression = expression;
46
	this.type = type;
46
	this.type = type;
47
	type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
47
	type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
Lines 407-413 Link Here
407
		if (valueRequired || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
407
		if (valueRequired || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
408
			codeStream.generateConstant(this.constant, this.implicitConversion);
408
			codeStream.generateConstant(this.constant, this.implicitConversion);
409
			if (needRuntimeCheckcast) {
409
			if (needRuntimeCheckcast) {
410
				codeStream.checkcast(this.resolvedType);
410
				codeStream.checkcast(this.type, this.resolvedType);
411
			}
411
			}
412
			if (!valueRequired) {
412
			if (!valueRequired) {
413
				// the resolveType cannot be double or long
413
				// the resolveType cannot be double or long
Lines 419-425 Link Here
419
	}
419
	}
420
	this.expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast);
420
	this.expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast);
421
	if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType.erasure()) { // no need to issue a checkcast if already done as genericCast
421
	if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType.erasure()) { // no need to issue a checkcast if already done as genericCast
422
		codeStream.checkcast(this.resolvedType);
422
		codeStream.checkcast(this.type, this.resolvedType);
423
	}
423
	}
424
	if (valueRequired) {
424
	if (valueRequired) {
425
		codeStream.generateImplicitConversion(this.implicitConversion);
425
		codeStream.generateImplicitConversion(this.implicitConversion);
Lines 476-530 Link Here
476
	this.constant = Constant.NotAConstant;
476
	this.constant = Constant.NotAConstant;
477
	this.implicitConversion = TypeIds.T_undefined;
477
	this.implicitConversion = TypeIds.T_undefined;
478
478
479
	if ((this.type instanceof TypeReference) || (this.type instanceof NameReference)
479
	boolean exprContainCast = false;
480
			&& ((this.type.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) { // no extra parenthesis around type: ((A))exp
481
480
482
		boolean exprContainCast = false;
481
	TypeBinding castType = this.resolvedType = this.type.resolveType(scope);
483
482
	//expression.setExpectedType(this.resolvedType); // needed in case of generic method invocation
484
		TypeBinding castType = this.resolvedType = this.type.resolveType(scope);
483
	if (this.expression instanceof CastExpression) {
485
		//expression.setExpectedType(this.resolvedType); // needed in case of generic method invocation
484
		this.expression.bits |= ASTNode.DisableUnnecessaryCastCheck;
486
		if (this.expression instanceof CastExpression) {
485
		exprContainCast = true;
487
			this.expression.bits |= ASTNode.DisableUnnecessaryCastCheck;
486
	}
488
			exprContainCast = true;
487
	TypeBinding expressionType = this.expression.resolveType(scope);
489
		}
488
	if (castType != null) {
490
		TypeBinding expressionType = this.expression.resolveType(scope);
489
		if (expressionType != null) {
491
		if (castType != null) {
490
			boolean isLegal = checkCastTypesCompatibility(scope, castType, expressionType, this.expression);
492
			if (expressionType != null) {
491
			if (isLegal) {
493
				boolean isLegal = checkCastTypesCompatibility(scope, castType, expressionType, this.expression);
492
				this.expression.computeConversion(scope, castType, expressionType);
494
				if (isLegal) {
493
				if ((this.bits & ASTNode.UnsafeCast) != 0) { // unsafe cast
495
					this.expression.computeConversion(scope, castType, expressionType);
494
					if (scope.compilerOptions().reportUnavoidableGenericTypeProblems || !this.expression.forcedToBeRaw(scope.referenceContext())) {
496
					if ((this.bits & ASTNode.UnsafeCast) != 0) { // unsafe cast
495
						scope.problemReporter().unsafeCast(this, scope);
497
						if (scope.compilerOptions().reportUnavoidableGenericTypeProblems || !this.expression.forcedToBeRaw(scope.referenceContext())) {
498
							scope.problemReporter().unsafeCast(this, scope);
499
						}
500
					} else {
501
						if (castType.isRawType() && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){
502
							scope.problemReporter().rawTypeReference(this.type, castType);
503
						}
504
						if ((this.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == ASTNode.UnnecessaryCast) { // unnecessary cast
505
							if (!isIndirectlyUsed()) // used for generic type inference or boxing ?
506
								scope.problemReporter().unnecessaryCast(this);
507
						}
508
					}
496
					}
509
				} else { // illegal cast
497
				} else {
510
					if ((castType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error
498
					if (castType.isRawType() && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){
511
						scope.problemReporter().typeCastError(this, castType, expressionType);
499
						scope.problemReporter().rawTypeReference(this.type, castType);
500
					}
501
					if ((this.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == ASTNode.UnnecessaryCast) { // unnecessary cast
502
						if (!isIndirectlyUsed()) // used for generic type inference or boxing ?
503
							scope.problemReporter().unnecessaryCast(this);
512
					}
504
					}
513
					this.bits |= ASTNode.DisableUnnecessaryCastCheck; // disable further secondary diagnosis
514
				}
505
				}
506
			} else { // illegal cast
507
				if ((castType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error
508
					scope.problemReporter().typeCastError(this, castType, expressionType);
509
				}
510
				this.bits |= ASTNode.DisableUnnecessaryCastCheck; // disable further secondary diagnosis
515
			}
511
			}
516
			this.resolvedType = castType.capture(scope, this.sourceEnd);
517
			if (exprContainCast) {
518
				checkNeedForCastCast(scope, this);
519
			}
520
		}
512
		}
521
		return this.resolvedType;
513
		this.resolvedType = castType.capture(scope, this.sourceEnd);
522
	} else { // expression as a cast
514
		if (exprContainCast) {
523
		TypeBinding expressionType = this.expression.resolveType(scope);
515
			checkNeedForCastCast(scope, this);
524
		if (expressionType == null) return null;
516
		}
525
		scope.problemReporter().invalidTypeReference(this.type);
526
		return null;
527
	}
517
	}
518
	return this.resolvedType;
528
}
519
}
529
520
530
/**
521
/**
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java (-1 / +1 lines)
Lines 61-67 Link Here
61
61
62
		// in interface case, no caching occurs, since cannot make a cache field for interface
62
		// in interface case, no caching occurs, since cannot make a cache field for interface
63
		if (valueRequired) {
63
		if (valueRequired) {
64
			codeStream.generateClassLiteralAccessForType(this.type.resolvedType, this.syntheticField);
64
			codeStream.generateClassLiteralAccessForType(this.type, this.type.resolvedType, this.syntheticField);
65
			codeStream.generateImplicitConversion(this.implicitConversion);
65
			codeStream.generateImplicitConversion(this.implicitConversion);
66
		}
66
		}
67
		codeStream.recordPositionsFrom(pc, this.sourceStart);
67
		codeStream.recordPositionsFrom(pc, this.sourceStart);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java (+1 lines)
Lines 176-181 Link Here
176
		if (this.assertionSyntheticFieldBinding != null) {
176
		if (this.assertionSyntheticFieldBinding != null) {
177
			// generate code related to the activation of assertion for this class
177
			// generate code related to the activation of assertion for this class
178
			codeStream.generateClassLiteralAccessForType(
178
			codeStream.generateClassLiteralAccessForType(
179
					null,
179
					classScope.outerMostClassScope().enclosingSourceType(),
180
					classScope.outerMostClassScope().enclosingSourceType(),
180
					this.classLiteralSyntheticField);
181
					this.classLiteralSyntheticField);
181
			codeStream.invokeJavaLangClassDesiredAssertionStatus();
182
			codeStream.invokeJavaLangClassDesiredAssertionStatus();
(-)compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.impl.*;
15
import org.eclipse.jdt.internal.compiler.impl.*;
15
import org.eclipse.jdt.internal.compiler.codegen.*;
16
import org.eclipse.jdt.internal.compiler.codegen.*;
Lines 26-31 Link Here
26
27
27
public void computeConstant() {
28
public void computeConstant() {
28
	Double computedValue;
29
	Double computedValue;
30
	boolean containsUnderscores = CharOperation.indexOf('_', this.source) > 0;
31
	if (containsUnderscores) {
32
		// remove all underscores from source
33
		this.source = CharOperation.remove(this.source, '_');
34
	}
29
	try {
35
	try {
30
		computedValue = Double.valueOf(String.valueOf(this.source));
36
		computedValue = Double.valueOf(String.valueOf(this.source));
31
	} catch (NumberFormatException e) {
37
	} catch (NumberFormatException e) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 159-165 Link Here
159
				}
159
				}
160
				codeStream.invoke(Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */);
160
				codeStream.invoke(Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */);
161
			} else {
161
			} else {
162
				codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
162
				codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments);
163
			}
163
			}
164
			codeStream.recordPositionsFrom(pc, this.sourceStart);
164
			codeStream.recordPositionsFrom(pc, this.sourceStart);
165
		} finally {
165
		} finally {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java (-2 / +11 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import java.util.List;
14
13
import org.eclipse.jdt.core.compiler.IProblem;
15
import org.eclipse.jdt.core.compiler.IProblem;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.impl.*;
17
import org.eclipse.jdt.internal.compiler.impl.*;
18
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
16
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
19
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
17
import org.eclipse.jdt.internal.compiler.codegen.*;
20
import org.eclipse.jdt.internal.compiler.codegen.*;
18
import org.eclipse.jdt.internal.compiler.flow.*;
21
import org.eclipse.jdt.internal.compiler.flow.*;
Lines 41-47 Link Here
41
	// for subtypes or conversion
44
	// for subtypes or conversion
42
}
45
}
43
46
44
public FieldDeclaration(	char[] name, int sourceStart, int sourceEnd) {
47
public FieldDeclaration(char[] name, int sourceStart, int sourceEnd) {
45
	this.name = name;
48
	this.name = name;
46
	//due to some declaration like
49
	//due to some declaration like
47
	// int x, y = 3, z , x ;
50
	// int x, y = 3, z , x ;
Lines 109-115 Link Here
109
	}
112
	}
110
	codeStream.recordPositionsFrom(pc, this.sourceStart);
113
	codeStream.recordPositionsFrom(pc, this.sourceStart);
111
}
114
}
112
115
public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
116
	AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
117
	for (int i = 0, max = this.annotations.length; i < max; i++) {
118
		Annotation annotation = this.annotations[i];
119
		annotation.traverse(collector, (BlockScope) null);
120
	}
121
}
113
/**
122
/**
114
 * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind()
123
 * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#getKind()
115
 */
124
 */
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
14
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
15
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
15
import org.eclipse.jdt.internal.compiler.impl.FloatConstant;
16
import org.eclipse.jdt.internal.compiler.impl.FloatConstant;
Lines 27-32 Link Here
27
28
28
public void computeConstant() {
29
public void computeConstant() {
29
	Float computedValue;
30
	Float computedValue;
31
	boolean containsUnderscores = CharOperation.indexOf('_', this.source) > 0;
32
	if (containsUnderscores) {
33
		// remove all underscores from source
34
		this.source = CharOperation.remove(this.source, '_');
35
	}
30
	try {
36
	try {
31
		computedValue = Float.valueOf(String.valueOf(this.source));
37
		computedValue = Float.valueOf(String.valueOf(this.source));
32
	} catch (NumberFormatException e) {
38
	} catch (NumberFormatException e) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java (-2 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 87-93 Link Here
87
		if (this.modifiers != 0) {
87
		if (this.modifiers != 0) {
88
			printIndent(indent, output);
88
			printIndent(indent, output);
89
			printModifiers(this.modifiers, output);
89
			printModifiers(this.modifiers, output);
90
			if (this.annotations != null) printAnnotations(this.annotations, output);
90
			if (this.annotations != null) {
91
				printAnnotations(this.annotations, output);
92
				output.append(' ');
93
			}
91
			output.append("{\n"); //$NON-NLS-1$
94
			output.append("{\n"); //$NON-NLS-1$
92
			if (this.block != null) {
95
			if (this.block != null) {
93
				this.block.printBody(indent, output);
96
				this.block.printBody(indent, output);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 59-65 Link Here
59
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
59
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
60
	int pc = codeStream.position;
60
	int pc = codeStream.position;
61
	this.expression.generateCode(currentScope, codeStream, true);
61
	this.expression.generateCode(currentScope, codeStream, true);
62
	codeStream.instance_of(this.type.resolvedType);
62
	codeStream.instance_of(this.type, this.type.resolvedType);
63
	if (valueRequired) {
63
	if (valueRequired) {
64
		codeStream.generateImplicitConversion(this.implicitConversion);
64
		codeStream.generateImplicitConversion(this.implicitConversion);
65
	} else {
65
	} else {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java (-20 / +29 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 35-79 Link Here
35
	//which is legal if used with a - as prefix....cool....
35
	//which is legal if used with a - as prefix....cool....
36
	//notice that Integer.MIN_VALUE  == -2147483648
36
	//notice that Integer.MIN_VALUE  == -2147483648
37
	long MAX = Integer.MAX_VALUE;
37
	long MAX = Integer.MAX_VALUE;
38
	if (this == One) {	
38
	if (this == One) {
39
		this.constant = IntConstant.fromValue(1); 
39
		this.constant = IntConstant.fromValue(1); 
40
		return ;
40
		return ;
41
	}
41
	}
42
	int length = this.source.length;
42
	int length = this.source.length;
43
	long computedValue = 0L;
43
	long computedValue = 0L;
44
	if (this.source[0] == '0') {	
44
	if (this.source[0] == '0') {
45
		MAX = 0xFFFFFFFFL ; //a long in order to be positive !
45
		MAX = 0xFFFFFFFFL ; //a long in order to be positive !
46
		if (length == 1) {
46
		if (length == 1) {
47
			this.constant = IntConstant.fromValue(0); return ;
47
			this.constant = IntConstant.fromValue(0);
48
			return ;
48
		}
49
		}
49
		final int shift,radix;
50
		final int shift,radix;
50
		int j ;
51
		int j ;
51
		if ((this.source[1] == 'x') || (this.source[1] == 'X')) {	
52
		if ((this.source[1] == 'x') || (this.source[1] == 'X')) {
52
			shift = 4 ; j = 2; radix = 16;
53
			shift = 4; j = 2; radix = 16;
53
		} else {	
54
		} else if ((this.source[1] == 'b') || (this.source[1] == 'B')) {
54
			shift = 3 ; j = 1; radix = 8;
55
			shift = 1; j = 2; radix = 2;
56
		} else {
57
			shift = 3; j = 1; radix = 8;
55
		}
58
		}
56
		while (this.source[j]=='0')	 {	
59
		if (j < length) {
57
			j++; //jump over redondant zero
60
			while (this.source[j]=='0') {
58
			if (j == length) {
61
				j++; //jump over redundant zero
59
				//watch for 000000000000000000
62
				if (j == length) {
60
				this.constant = IntConstant.fromValue(this.value = (int)computedValue);
63
					//watch for 000000000000000000
61
				return;
64
					this.constant = IntConstant.fromValue(this.value = (int)computedValue);
65
					return;
66
				}
62
			}
67
			}
63
		}
68
		}
64
		while (j<length) {	
69
		while (j < length) {
65
			int digitValue ;
70
			int digitValue;
66
			if ((digitValue = ScannerHelper.digit(this.source[j++],radix))	< 0 ) {
71
			char currentChar = this.source[j++];
72
			if (currentChar == '_') continue;
73
			if ((digitValue = ScannerHelper.digit(currentChar,radix)) < 0 ) {
67
				return; /*constant stays null*/
74
				return; /*constant stays null*/
68
			}
75
			}
69
			computedValue = (computedValue<<shift) | digitValue ;
76
			computedValue = (computedValue<<shift) | digitValue ;
70
			if (computedValue > MAX) return; /*constant stays null*/
77
			if (computedValue > MAX) return; /*constant stays null*/
71
		}
78
		}
72
	} else {	
79
	} else {
73
		//-----------regular case : radix = 10-----------
80
		//-----------regular case : radix = 10-----------
74
		for (int i = 0 ; i < length;i++) {	
81
		loop: for (int i = 0 ; i < length;i++) {	
82
			char currentChar = this.source[i];
83
			if (currentChar == '_') continue loop;
75
			int digitValue ;
84
			int digitValue ;
76
			if ((digitValue = ScannerHelper.digit(this.source[i],10))	< 0 ) {
85
			if ((digitValue = ScannerHelper.digit(this.source[i],10)) < 0 ) {
77
				return; /*constant stays null*/
86
				return; /*constant stays null*/
78
			}
87
			}
79
			computedValue = 10*computedValue + digitValue;
88
			computedValue = 10*computedValue + digitValue;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 30-35 Link Here
30
	public TypeReference copyDims(int dim) {
30
	public TypeReference copyDims(int dim) {
31
		return null;
31
		return null;
32
	}
32
	}
33
	
34
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) {
35
		return null;
36
	}
33
37
34
	/* (non-Javadoc)
38
	/* (non-Javadoc)
35
	 * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
39
	 * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (-2 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 12-19 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.jdt.internal.compiler.ast;
13
package org.eclipse.jdt.internal.compiler.ast;
14
14
15
import java.util.List;
16
15
import org.eclipse.jdt.internal.compiler.ASTVisitor;
17
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.impl.*;
18
import org.eclipse.jdt.internal.compiler.impl.*;
19
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
17
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
20
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
18
import org.eclipse.jdt.internal.compiler.codegen.*;
21
import org.eclipse.jdt.internal.compiler.codegen.*;
19
import org.eclipse.jdt.internal.compiler.flow.*;
22
import org.eclipse.jdt.internal.compiler.flow.*;
Lines 152-162 Link Here
152
		return LOCAL_VARIABLE;
155
		return LOCAL_VARIABLE;
153
	}
156
	}
154
157
158
	// for local variables
159
	public void getAllAnnotationContexts(int targetType, LocalVariableBinding localVariable, List allAnnotationContexts) {
160
		AnnotationCollector collector = new AnnotationCollector(this, targetType, localVariable, allAnnotationContexts);
161
		this.traverse(collector, (BlockScope) null);
162
	}
163
	// for arguments
164
	public void getAllAnnotationContexts(int targetType, int parameterIndex, List allAnnotationContexts) {
165
		AnnotationCollector collector = new AnnotationCollector(this, targetType, parameterIndex, allAnnotationContexts);
166
		this.traverse(collector, (BlockScope) null);
167
	}
168
	public boolean isArgument() {
169
		return false;
170
	}
155
	public void resolve(BlockScope scope) {
171
	public void resolve(BlockScope scope) {
156
172
157
		// create a binding and add it to the scope
173
		// create a binding and add it to the scope
158
		TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/);
174
		TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/);
159
175
176
		this.bits |= (this.type.bits & ASTNode.HasTypeAnnotations);
160
		checkModifiers();
177
		checkModifiers();
161
		if (variableType != null) {
178
		if (variableType != null) {
162
			if (variableType == TypeBinding.VOID) {
179
			if (variableType == TypeBinding.VOID) {
Lines 202-208 Link Here
202
					this.initialization.computeConversion(scope, variableType, initializationType);
219
					this.initialization.computeConversion(scope, variableType, initializationType);
203
				}
220
				}
204
			} else {
221
			} else {
205
			    this.initialization.setExpectedType(variableType);
222
				this.initialization.setExpectedType(variableType);
206
				TypeBinding initializationType = this.initialization.resolveType(scope);
223
				TypeBinding initializationType = this.initialization.resolveType(scope);
207
				if (initializationType != null) {
224
				if (initializationType != null) {
208
					if (variableType != initializationType) // must call before computeConversion() and typeMismatchError()
225
					if (variableType != initializationType) // must call before computeConversion() and typeMismatchError()
Lines 245-250 Link Here
245
		}
262
		}
246
		// only resolve annotation at the end, for constant to be positioned before (96991)
263
		// only resolve annotation at the end, for constant to be positioned before (96991)
247
		resolveAnnotations(scope, this.annotations, this.binding);
264
		resolveAnnotations(scope, this.annotations, this.binding);
265
		// jsr 308
266
		Annotation[] typeAnnotations = this.type.annotations;
267
		if (typeAnnotations != null) {
268
			ASTNode.resolveAnnotations(scope, typeAnnotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
269
		}
248
	}
270
	}
249
271
250
	public void traverse(ASTVisitor visitor, BlockScope scope) {
272
	public void traverse(ASTVisitor visitor, BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java (-23 / +29 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 26-32 Link Here
26
	//the overflow (when radix=10) is tested using the fact that
26
	//the overflow (when radix=10) is tested using the fact that
27
	//the value should always grow during its computation
27
	//the value should always grow during its computation
28
	int length = this.source.length - 1; //minus one because the last char is 'l' or 'L'
28
	int length = this.source.length - 1; //minus one because the last char is 'l' or 'L'
29
	long computedValue ;
29
	long computedValue = 0;
30
	if (this.source[0] == '0') {
30
	if (this.source[0] == '0') {
31
		if (length == 1) {
31
		if (length == 1) {
32
			this.constant = LongConstant.fromValue(0L);
32
			this.constant = LongConstant.fromValue(0L);
Lines 49-83 Link Here
49
			}
49
			}
50
		}
50
		}
51
51
52
		int digitValue ;
52
		char currentChar = this.source[j++];
53
		if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0 ) {
53
		if (currentChar != '_') {
54
			return; /*constant stays null*/
54
			int digitValue ;
55
		}
55
			if ((digitValue = ScannerHelper.digit(currentChar,radix)) < 0 ) {
56
		if (digitValue >= 8)
57
			nbDigit = 4;
58
		else if (digitValue >= 4)
59
			nbDigit = 3;
60
		else if (digitValue >= 2)
61
			nbDigit = 2;
62
		else
63
			nbDigit = 1; //digitValue is not 0
64
		computedValue = digitValue ;
65
		while (j<length) {
66
			if ((digitValue = ScannerHelper.digit(this.source[j++],radix)) < 0) {
67
				return; /*constant stays null*/
56
				return; /*constant stays null*/
68
			}
57
			}
69
			if ((nbDigit += shift) > 64)
58
			if (digitValue >= 8)
70
				return; /*constant stays null*/
59
				nbDigit = 4;
71
			computedValue = (computedValue<<shift) | digitValue ;
60
			else if (digitValue >= 4)
61
				nbDigit = 3;
62
			else if (digitValue >= 2)
63
				nbDigit = 2;
64
			else
65
				nbDigit = 1; //digitValue is not 0
66
			computedValue = digitValue ;
67
			while (j<length) {
68
				currentChar = this.source[j++];
69
				if (currentChar == '_') continue;
70
				if ((digitValue = ScannerHelper.digit(currentChar,radix)) < 0) {
71
					return; /*constant stays null*/
72
				}
73
				if ((nbDigit += shift) > 64)
74
					return; /*constant stays null*/
75
				computedValue = (computedValue<<shift) | digitValue ;
76
			}
72
		}
77
		}
73
	} else {
78
	} else {
74
		//-----------case radix=10-----------------
79
		//-----------case radix=10-----------------
75
		long previous = 0;
80
		long previous = 0;
76
		computedValue = 0;
77
		final long limit = Long.MAX_VALUE / 10; // needed to check prior to the multiplication
81
		final long limit = Long.MAX_VALUE / 10; // needed to check prior to the multiplication
78
		for (int i = 0 ; i < length; i++) {
82
		loop: for (int i = 0 ; i < length; i++) {
79
			int digitValue ;
83
			int digitValue ;
80
			if ((digitValue = ScannerHelper.digit(this.source[i], 10)) < 0 ) return /*constant stays null*/;
84
			char currentChar = this.source[i];
85
			if (currentChar == '_') continue loop;
86
			if ((digitValue = ScannerHelper.digit(currentChar, 10)) < 0 ) return /*constant stays null*/;
81
			previous = computedValue;
87
			previous = computedValue;
82
			if (computedValue > limit)
88
			if (computedValue > limit)
83
				return; /*constant stays null*/
89
				return; /*constant stays null*/
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 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 42-45 Link Here
42
		}
42
		}
43
		visitor.endVisit(this, scope);
43
		visitor.endVisit(this, scope);
44
	}
44
	}
45
	public void traverse(ASTVisitor visitor, ClassScope scope) {
46
		if (visitor.visit(this, scope)) {
47
			if (this.type != null) {
48
				this.type.traverse(visitor, scope);
49
			}
50
		}
51
		visitor.endVisit(this, scope);
52
	}
45
}
53
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java (-1 / +10 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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-19 Link Here
14
import org.eclipse.jdt.internal.compiler.impl.Constant;
14
import org.eclipse.jdt.internal.compiler.impl.Constant;
15
import org.eclipse.jdt.internal.compiler.lookup.Binding;
15
import org.eclipse.jdt.internal.compiler.lookup.Binding;
16
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
16
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
17
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
17
import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair;
18
import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair;
18
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
19
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
19
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
20
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
Lines 238-241 Link Here
238
		}
239
		}
239
		visitor.endVisit(this, scope);
240
		visitor.endVisit(this, scope);
240
	}
241
	}
242
	public void traverse(ASTVisitor visitor, ClassScope scope) {
243
		if (visitor.visit(this, scope)) {
244
			if (this.value != null) {
245
				this.value.traverse(visitor, scope);
246
			}
247
		}
248
		visitor.endVisit(this, scope);
249
	}
241
}
250
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 166-178 Link Here
166
	if (this.syntheticAccessor == null){
166
	if (this.syntheticAccessor == null){
167
		TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenBinding, this.actualReceiverType, this.receiver.isImplicitThis());
167
		TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenBinding, this.actualReceiverType, this.receiver.isImplicitThis());
168
		if (isStatic){
168
		if (isStatic){
169
			codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass);
169
			codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
170
		} else if((this.receiver.isSuper()) || codegenBinding.isPrivate()){
170
		} else if((this.receiver.isSuper()) || codegenBinding.isPrivate()){
171
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass);
171
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
172
		} else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
172
		} else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
173
			codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass);
173
			codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
174
		} else {
174
		} else {
175
			codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass);
175
			codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
176
		}
176
		}
177
	} else {
177
	} else {
178
		codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessor, null /* default declaringClass */);
178
		codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessor, null /* default declaringClass */);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java (-5 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-24 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import java.util.List;
14
13
import org.eclipse.jdt.core.compiler.CharOperation;
15
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.CompilationResult;
17
import org.eclipse.jdt.internal.compiler.CompilationResult;
18
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
16
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
19
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
17
import org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext;
20
import org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext;
18
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
21
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
19
import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
22
import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
20
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
23
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
21
import org.eclipse.jdt.internal.compiler.lookup.Binding;
24
import org.eclipse.jdt.internal.compiler.lookup.Binding;
25
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
22
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
26
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
23
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
27
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
24
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
28
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
Lines 81-91 Link Here
81
			// tag parameters as being set
85
			// tag parameters as being set
82
			if (this.arguments != null) {
86
			if (this.arguments != null) {
83
				for (int i = 0, count = this.arguments.length; i < count; i++) {
87
				for (int i = 0, count = this.arguments.length; i < count; i++) {
84
					flowInfo.markAsDefinitelyAssigned(this.arguments[i].binding);
88
					Argument argument = this.arguments[i];
89
					this.bits |= (argument.bits & ASTNode.HasTypeAnnotations);
90
					flowInfo.markAsDefinitelyAssigned(argument.binding);
85
					// if this method uses a type parameter declared by the declaring class,
91
					// if this method uses a type parameter declared by the declaring class,
86
					// it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
92
					// it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
87
					if (this.arguments[i].binding != null && (this.arguments[i].binding.type instanceof TypeVariableBinding)) {
93
					if (argument.binding != null && (argument.binding.type instanceof TypeVariableBinding)) {
88
						Binding declaringElement = ((TypeVariableBinding)this.arguments[i].binding.type).declaringElement;
94
						Binding declaringElement = ((TypeVariableBinding)argument.binding.type).declaringElement;
89
						if (this.binding != null && this.binding.declaringClass == declaringElement)
95
						if (this.binding != null && this.binding.declaringClass == declaringElement)
90
							this.bits &= ~ASTNode.CanBeStatic;
96
							this.bits &= ~ASTNode.CanBeStatic;
91
					}
97
					}
Lines 95-100 Link Here
95
				// method of a non-static member type can't be static.
101
				// method of a non-static member type can't be static.
96
				this.bits &= ~ASTNode.CanBeStatic;
102
				this.bits &= ~ASTNode.CanBeStatic;
97
			}
103
			}
104
98
			// propagate to statements
105
			// propagate to statements
99
			if (this.statements != null) {
106
			if (this.statements != null) {
100
				int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE;
107
				int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE;
Lines 139-144 Link Here
139
		}
146
		}
140
	}
147
	}
141
148
149
	public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
150
		AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
151
		for (int i = 0, max = this.annotations.length; i < max; i++) {
152
			Annotation annotation = this.annotations[i];
153
			annotation.traverse(collector, (BlockScope) null);
154
		}
155
	}
156
142
	public boolean isMethod() {
157
	public boolean isMethod() {
143
		return true;
158
		return true;
144
	}
159
	}
Lines 156-161 Link Here
156
	public void resolveStatements() {
171
	public void resolveStatements() {
157
		// ========= abort on fatal error =============
172
		// ========= abort on fatal error =============
158
		if (this.returnType != null && this.binding != null) {
173
		if (this.returnType != null && this.binding != null) {
174
			this.bits |= (this.returnType.bits & ASTNode.HasTypeAnnotations);
159
			this.returnType.resolvedType = this.binding.returnType;
175
			this.returnType.resolvedType = this.binding.returnType;
160
			// record the return type binding
176
			// record the return type binding
161
		}
177
		}
Lines 168-176 Link Here
168
		if (this.returnType != null && this.returnType.resolvedType instanceof TypeVariableBinding) {
184
		if (this.returnType != null && this.returnType.resolvedType instanceof TypeVariableBinding) {
169
			returnsUndeclTypeVar = true;
185
			returnsUndeclTypeVar = true;
170
		}
186
		}
187
171
		if (this.typeParameters != null) {
188
		if (this.typeParameters != null) {
172
			for (int i = 0, length = this.typeParameters.length; i < length; i++) {
189
			for (int i = 0, length = this.typeParameters.length; i < length; i++) {
173
				this.typeParameters[i].resolve(this.scope);
190
				TypeParameter typeParameter = this.typeParameters[i];
191
				this.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
192
				typeParameter.resolve(this.scope);
193
				typeParameter.resolveAnnotations(this.scope);
174
				if (returnsUndeclTypeVar && this.typeParameters[i].binding == this.returnType.resolvedType) {
194
				if (returnsUndeclTypeVar && this.typeParameters[i].binding == this.returnType.resolvedType) {
175
					returnsUndeclTypeVar = false;
195
					returnsUndeclTypeVar = false;
176
				}
196
				}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java (-1 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 71-74 Link Here
71
		}
71
		}
72
		visitor.endVisit(this, scope);
72
		visitor.endVisit(this, scope);
73
	}
73
	}
74
	public void traverse(ASTVisitor visitor, ClassScope scope) {
75
		if (visitor.visit(this, scope)) {
76
			if (this.type != null) {
77
				this.type.traverse(visitor, scope);
78
			}
79
			if (this.memberValuePairs != null) {
80
				int memberValuePairsLength = this.memberValuePairs.length;
81
				for (int i = 0; i < memberValuePairsLength; i++)
82
					this.memberValuePairs[i].traverse(visitor, scope);
83
			}
84
		}
85
		visitor.endVisit(this, scope);
86
	}
74
}
87
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java (-23 / +97 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 34-39 Link Here
34
		super(tokens, dim, positions);
34
		super(tokens, dim, positions);
35
		this.typeArguments = typeArguments;
35
		this.typeArguments = typeArguments;
36
	}
36
	}
37
	public ParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, int dim, Annotation[][] annotationsOnDimensions, long[] positions) {
38
		this(tokens, typeArguments, dim, positions);
39
		this.annotationsOnDimensions = annotationsOnDimensions;
40
		if (annotationsOnDimensions != null) {
41
			this.bits |= ASTNode.HasTypeAnnotations;
42
		}
43
	}
37
	public void checkBounds(Scope scope) {
44
	public void checkBounds(Scope scope) {
38
		if (this.resolvedType == null) return;
45
		if (this.resolvedType == null) return;
39
46
Lines 59-64 Link Here
59
	public TypeReference copyDims(int dim){
66
	public TypeReference copyDims(int dim){
60
		return new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, this.sourcePositions);
67
		return new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, this.sourcePositions);
61
	}
68
	}
69
	public TypeReference copyDims(int dim, Annotation[][] dimensionAnnotations){
70
		ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(this.tokens, this.typeArguments, dim, dimensionAnnotations, this.sourcePositions);
71
		parameterizedQualifiedTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
72
		if (dimensionAnnotations != null) {
73
			parameterizedQualifiedTypeReference.bits |= ASTNode.HasTypeAnnotations;
74
		}
75
		return parameterizedQualifiedTypeReference;
76
	}
77
	public boolean isParameterizedTypeReference() {
78
		return true;
79
	}
62
80
63
	/**
81
	/**
64
	 * @return char[][]
82
	 * @return char[][]
Lines 128-133 Link Here
128
			}
146
			}
129
		}
147
		}
130
		this.bits |= ASTNode.DidResolve;
148
		this.bits |= ASTNode.DidResolve;
149
		if (this.annotations != null) {
150
			switch(scope.kind) {
151
				case Scope.BLOCK_SCOPE :
152
				case Scope.METHOD_SCOPE :
153
					resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
154
					break;
155
			}
156
		}
131
		boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
157
		boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
132
		Binding binding = scope.getPackage(this.tokens);
158
		Binding binding = scope.getPackage(this.tokens);
133
		if (binding != null && !binding.isValidBinding()) {
159
		if (binding != null && !binding.isValidBinding()) {
Lines 160-177 Link Here
160
				reportInvalidType(scope);
186
				reportInvalidType(scope);
161
				// be resilient, still attempt resolving arguments
187
				// be resilient, still attempt resolving arguments
162
				for (int j = i; j < max; j++) {
188
				for (int j = i; j < max; j++) {
163
				    TypeReference[] args = this.typeArguments[j];
189
					TypeReference[] args = this.typeArguments[j];
164
				    if (args != null) {
190
					if (args != null) {
165
						int argLength = args.length;
191
						int argLength = args.length;
166
						for (int k = 0; k < argLength; k++) {
192
						for (int k = 0; k < argLength; k++) {
167
						    TypeReference typeArgument = args[k];
193
							TypeReference typeArgument = args[k];
168
						    if (isClassScope) {
194
							if (isClassScope) {
169
						    	typeArgument.resolveType((ClassScope) scope);
195
								typeArgument.resolveType((ClassScope) scope);
170
						    } else {
196
							} else {
171
						    	typeArgument.resolveType((BlockScope) scope);
197
								typeArgument.resolveType((BlockScope) scope);
172
						    }
198
							}
173
						}
199
						}
174
				    }
200
					}
175
				}
201
				}
176
				return null;
202
				return null;
177
			}
203
			}
Lines 196-215 Link Here
196
			}
222
			}
197
223
198
			// check generic and arity
224
			// check generic and arity
199
		    TypeReference[] args = this.typeArguments[i];
225
			TypeReference[] args = this.typeArguments[i];
200
		    if (args != null) {
226
			if (args != null) {
201
			    TypeReference keep = null;
227
				TypeReference keep = null;
202
			    if (isClassScope) {
228
				if (isClassScope) {
203
			    	keep = ((ClassScope) scope).superTypeReference;
229
					keep = ((ClassScope) scope).superTypeReference;
204
			    	((ClassScope) scope).superTypeReference = null;
230
					((ClassScope) scope).superTypeReference = null;
205
			    }
231
				}
206
				int argLength = args.length;
232
				int argLength = args.length;
207
				TypeBinding[] argTypes = new TypeBinding[argLength];
233
				TypeBinding[] argTypes = new TypeBinding[argLength];
208
				boolean argHasError = false;
234
				boolean argHasError = false;
209
				ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
235
				ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
210
				for (int j = 0; j < argLength; j++) {
236
				for (int j = 0; j < argLength; j++) {
211
				    TypeReference arg = args[j];
237
					TypeReference arg = args[j];
212
				    TypeBinding argType = isClassScope
238
					TypeBinding argType = isClassScope
213
						? arg.resolveTypeArgument((ClassScope) scope, currentOriginal, j)
239
						? arg.resolveTypeArgument((ClassScope) scope, currentOriginal, j)
214
						: arg.resolveTypeArgument((BlockScope) scope, currentOriginal, j);
240
						: arg.resolveTypeArgument((BlockScope) scope, currentOriginal, j);
215
					if (argType == null) {
241
					if (argType == null) {
Lines 227-233 Link Here
227
						return null;
253
						return null;
228
				}
254
				}
229
255
230
			    TypeVariableBinding[] typeVariables = currentOriginal.typeVariables();
256
				TypeVariableBinding[] typeVariables = currentOriginal.typeVariables();
231
				if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
257
				if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
232
					if (scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error
258
					if (scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error
233
						scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes);
259
						scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes);
Lines 262-278 Link Here
262
				else
288
				else
263
					scope.deferBoundCheck(this);
289
					scope.deferBoundCheck(this);
264
				qualifyingType = parameterizedType;
290
				qualifyingType = parameterizedType;
265
		    } else {
291
			} else {
266
				ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
292
				ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
267
				if (isClassScope)
293
				if (isClassScope)
268
					if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this))
294
					if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this))
269
						return null;
295
						return null;
270
				if (currentOriginal.isGenericType()) {
296
				if (currentOriginal.isGenericType()) {
271
	   			    if (typeIsConsistent && qualifyingType != null && qualifyingType.isParameterizedType()) {
297
					if (typeIsConsistent && qualifyingType != null && qualifyingType.isParameterizedType()) {
272
						scope.problemReporter().parameterizedMemberTypeMissingArguments(this, scope.environment().createParameterizedType(currentOriginal, null, qualifyingType), i);
298
						scope.problemReporter().parameterizedMemberTypeMissingArguments(this, scope.environment().createParameterizedType(currentOriginal, null, qualifyingType), i);
273
						typeIsConsistent = false;
299
						typeIsConsistent = false;
274
					}
300
					}
275
	   			    qualifyingType = scope.environment().createRawType(currentOriginal, qualifyingType); // raw type
301
					qualifyingType = scope.environment().createRawType(currentOriginal, qualifyingType); // raw type
276
				} else {
302
				} else {
277
					qualifyingType = (qualifyingType != null && qualifyingType.isParameterizedType())
303
					qualifyingType = (qualifyingType != null && qualifyingType.isParameterizedType())
278
													? scope.environment().createParameterizedType(currentOriginal, null, qualifyingType)
304
													? scope.environment().createParameterizedType(currentOriginal, null, qualifyingType)
Lines 293-298 Link Here
293
	}
319
	}
294
320
295
	public StringBuffer printExpression(int indent, StringBuffer output) {
321
	public StringBuffer printExpression(int indent, StringBuffer output) {
322
		if (this.annotations != null) {
323
			output.append(" "); //$NON-NLS-1$
324
			printAnnotations(this.annotations, output);
325
			output.append(' ');
326
		}
296
		int length = this.tokens.length;
327
		int length = this.tokens.length;
297
		for (int i = 0; i < length - 1; i++) {
328
		for (int i = 0; i < length - 1; i++) {
298
			output.append(this.tokens[i]);
329
			output.append(this.tokens[i]);
Lines 323-333 Link Here
323
		}
354
		}
324
		if ((this.bits & IsVarArgs) != 0) {
355
		if ((this.bits & IsVarArgs) != 0) {
325
			for (int i= 0 ; i < this.dimensions - 1; i++) {
356
			for (int i= 0 ; i < this.dimensions - 1; i++) {
357
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
358
					output.append(" "); //$NON-NLS-1$
359
					printAnnotations(this.annotationsOnDimensions[i], output);
360
					output.append(" "); //$NON-NLS-1$
361
				}
326
				output.append("[]"); //$NON-NLS-1$
362
				output.append("[]"); //$NON-NLS-1$
327
			}
363
			}
364
			if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[this.dimensions - 1] != null) {
365
				output.append(" "); //$NON-NLS-1$
366
				printAnnotations(this.annotationsOnDimensions[this.dimensions - 1], output);
367
				output.append(" "); //$NON-NLS-1$
368
			}
328
			output.append("..."); //$NON-NLS-1$
369
			output.append("..."); //$NON-NLS-1$
329
		} else {
370
		} else {
330
			for (int i= 0 ; i < this.dimensions; i++) {
371
			for (int i= 0 ; i < this.dimensions; i++) {
372
				if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {
373
					output.append(" "); //$NON-NLS-1$
374
					printAnnotations(this.annotationsOnDimensions[i], output);
375
					output.append(" "); //$NON-NLS-1$
376
				}
331
				output.append("[]"); //$NON-NLS-1$
377
				output.append("[]"); //$NON-NLS-1$
332
			}
378
			}
333
		}
379
		}
Lines 342-347 Link Here
342
	}
388
	}
343
	public void traverse(ASTVisitor visitor, BlockScope scope) {
389
	public void traverse(ASTVisitor visitor, BlockScope scope) {
344
		if (visitor.visit(this, scope)) {
390
		if (visitor.visit(this, scope)) {
391
			if (this.annotations != null) {
392
				int annotationsLength = this.annotations.length;
393
				for (int i = 0; i < annotationsLength; i++)
394
					this.annotations[i].traverse(visitor, scope);
395
			}
396
			if (this.annotationsOnDimensions != null) {
397
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
398
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
399
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
400
						Annotation annotation = annotations2[j];
401
						annotation.traverse(visitor, scope);
402
					}
403
				}
404
			}
345
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
405
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
346
				if (this.typeArguments[i] != null) {
406
				if (this.typeArguments[i] != null) {
347
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
407
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
Lines 355-360 Link Here
355
415
356
	public void traverse(ASTVisitor visitor, ClassScope scope) {
416
	public void traverse(ASTVisitor visitor, ClassScope scope) {
357
		if (visitor.visit(this, scope)) {
417
		if (visitor.visit(this, scope)) {
418
			if (this.annotations != null) {
419
				int annotationsLength = this.annotations.length;
420
				for (int i = 0; i < annotationsLength; i++)
421
					this.annotations[i].traverse(visitor, scope);
422
			}
423
			if (this.annotationsOnDimensions != null) {
424
				for (int i = 0, max = this.annotationsOnDimensions.length; i < max; i++) {
425
					Annotation[] annotations2 = this.annotationsOnDimensions[i];
426
					for (int j = 0, max2 = annotations2.length; j < max2; j++) {
427
						Annotation annotation = annotations2[j];
428
						annotation.traverse(visitor, scope);
429
					}
430
				}
431
			}
358
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
432
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
359
				if (this.typeArguments[i] != null) {
433
				if (this.typeArguments[i] != null) {
360
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
434
					for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-19 / +102 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 29-34 Link Here
29
		this.originalSourceEnd = this.sourceEnd;
29
		this.originalSourceEnd = this.sourceEnd;
30
		this.typeArguments = typeArguments;
30
		this.typeArguments = typeArguments;
31
	}
31
	}
32
	public ParameterizedSingleTypeReference(char[] name, TypeReference[] typeArguments, int dim, Annotation[][] annotationsOnDimensions, long pos) {
33
		this(name, typeArguments, dim, pos);
34
		this.annotationsOnDimensions = annotationsOnDimensions;
35
		if (annotationsOnDimensions != null) {
36
			this.bits |= ASTNode.HasTypeAnnotations;
37
		}
38
	}
32
	public void checkBounds(Scope scope) {
39
	public void checkBounds(Scope scope) {
33
		if (this.resolvedType == null) return;
40
		if (this.resolvedType == null) return;
34
41
Lines 48-53 Link Here
48
	public TypeReference copyDims(int dim) {
55
	public TypeReference copyDims(int dim) {
49
		return new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, (((long)this.sourceStart)<<32)+this.sourceEnd);
56
		return new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, (((long)this.sourceStart)<<32)+this.sourceEnd);
50
	}
57
	}
58
	public TypeReference copyDims(int dim, Annotation [][] annotationsOnDims) {
59
		ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.token, this.typeArguments, dim, annotationsOnDims, (((long)this.sourceStart)<<32)+this.sourceEnd);
60
		parameterizedSingleTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
61
		if (annotationsOnDims != null) {
62
			parameterizedSingleTypeReference.bits |= ASTNode.HasTypeAnnotations;
63
		}
64
		return parameterizedSingleTypeReference;
65
	}
51
66
52
	/**
67
	/**
53
	 * @return char[][]
68
	 * @return char[][]
Lines 81-86 Link Here
81
    protected TypeBinding getTypeBinding(Scope scope) {
96
    protected TypeBinding getTypeBinding(Scope scope) {
82
        return null; // not supported here - combined with resolveType(...)
97
        return null; // not supported here - combined with resolveType(...)
83
    }
98
    }
99
    
100
    public boolean isParameterizedTypeReference() {
101
    	return true;
102
    }
84
103
85
    /*
104
    /*
86
     * No need to check for reference to raw type per construction
105
     * No need to check for reference to raw type per construction
Lines 105-113 Link Here
105
				}
124
				}
106
			}
125
			}
107
		}
126
		}
127
		this.bits |= ASTNode.DidResolve;
128
		if (this.annotations != null) {
129
			switch(scope.kind) {
130
				case Scope.BLOCK_SCOPE :
131
				case Scope.METHOD_SCOPE :
132
					resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
133
					break;
134
			}
135
		}
108
		boolean hasGenericError = false;
136
		boolean hasGenericError = false;
109
		ReferenceBinding currentType;
137
		ReferenceBinding currentType;
110
		this.bits |= ASTNode.DidResolve;
111
		if (enclosingType == null) {
138
		if (enclosingType == null) {
112
			this.resolvedType = scope.getType(this.token);
139
			this.resolvedType = scope.getType(this.token);
113
			if (this.resolvedType.isValidBinding()) {
140
			if (this.resolvedType.isValidBinding()) {
Lines 163-194 Link Here
163
		}
190
		}
164
191
165
		// check generic and arity
192
		// check generic and arity
166
	    boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
193
		boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
167
	    TypeReference keep = null;
194
		TypeReference keep = null;
168
	    if (isClassScope) {
195
		if (isClassScope) {
169
	    	keep = ((ClassScope) scope).superTypeReference;
196
			keep = ((ClassScope) scope).superTypeReference;
170
	    	((ClassScope) scope).superTypeReference = null;
197
			((ClassScope) scope).superTypeReference = null;
171
	    }
198
		}
172
		int argLength = this.typeArguments.length;
199
		int argLength = this.typeArguments.length;
173
		TypeBinding[] argTypes = new TypeBinding[argLength];
200
		TypeBinding[] argTypes = new TypeBinding[argLength];
174
		boolean argHasError = false;
201
		boolean argHasError = false;
175
		ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
202
		ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
176
		for (int i = 0; i < argLength; i++) {
203
		for (int i = 0; i < argLength; i++) {
177
		    TypeReference typeArgument = this.typeArguments[i];
204
			TypeReference typeArgument = this.typeArguments[i];
178
		    TypeBinding argType = isClassScope
205
			TypeBinding argType = isClassScope
179
				? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i)
206
					? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i)
180
				: typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i);
207
					: typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i);
181
		     if (argType == null) {
208
			this.bits |= (typeArgument.bits & ASTNode.HasTypeAnnotations);
182
		         argHasError = true;
209
			if (argType == null) {
183
		     } else {
210
				argHasError = true;
184
			    argTypes[i] = argType;
211
			} else {
185
		     }
212
				argTypes[i] = argType;
213
			}
186
		}
214
		}
187
		if (argHasError) {
215
		if (argHasError) {
188
			return null;
216
			return null;
189
		}
217
		}
190
		if (isClassScope) {
218
		if (isClassScope) {
191
	    	((ClassScope) scope).superTypeReference = keep;
219
			((ClassScope) scope).superTypeReference = keep;
192
			if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this))
220
			if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this))
193
				return null;
221
				return null;
194
		}
222
		}
Lines 229-235 Link Here
229
			}
257
			}
230
		}
258
		}
231
259
232
    	ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType(currentOriginal, argTypes, enclosingType);
260
		ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType(currentOriginal, argTypes, enclosingType);
233
		// check argument type compatibility
261
		// check argument type compatibility
234
		if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
262
		if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution
235
			parameterizedType.boundCheck(scope, this.typeArguments);
263
			parameterizedType.boundCheck(scope, this.typeArguments);
Lines 251-257 Link Here
251
		return this.resolvedType = type;
279
		return this.resolvedType = type;
252
	}
280
	}
253
281
282
	protected void resolveAnnotations(BlockScope scope) {
283
		super.resolveAnnotations(scope);
284
		for (int i = 0, length = this.typeArguments.length; i < length; i++) {
285
			this.typeArguments[i].resolveAnnotations(scope);
286
		}
287
	}
254
	public StringBuffer printExpression(int indent, StringBuffer output){
288
	public StringBuffer printExpression(int indent, StringBuffer output){
289
		if (this.annotations != null) {
290
			printAnnotations(this.annotations, output);
291
			output.append(' ');
292
		}
255
		output.append(this.token);
293
		output.append(this.token);
256
		output.append("<"); //$NON-NLS-1$
294
		output.append("<"); //$NON-NLS-1$
257
		int max = this.typeArguments.length - 1;
295
		int max = this.typeArguments.length - 1;
Lines 263-273 Link Here
263
		output.append(">"); //$NON-NLS-1$
301
		output.append(">"); //$NON-NLS-1$
264
		if ((this.bits & IsVarArgs) != 0) {
302
		if ((this.bits & IsVarArgs) != 0) {
265
			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
				}
266
				output.append("[]"); //$NON-NLS-1$
309
				output.append("[]"); //$NON-NLS-1$
267
			}
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$
315
			}
268
			output.append("..."); //$NON-NLS-1$
316
			output.append("..."); //$NON-NLS-1$
269
		} else {
317
		} else {
270
			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
				}
271
				output.append("[]"); //$NON-NLS-1$
324
				output.append("[]"); //$NON-NLS-1$
272
			}
325
			}
273
		}
326
		}
Lines 288-293 Link Here
288
341
289
	public void traverse(ASTVisitor visitor, BlockScope scope) {
342
	public void traverse(ASTVisitor visitor, BlockScope scope) {
290
		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
			}
291
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
360
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
292
				this.typeArguments[i].traverse(visitor, scope);
361
				this.typeArguments[i].traverse(visitor, scope);
293
			}
362
			}
Lines 297-302 Link Here
297
366
298
	public void traverse(ASTVisitor visitor, ClassScope scope) {
367
	public void traverse(ASTVisitor visitor, ClassScope scope) {
299
		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
			}
300
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
383
			for (int i = 0, max = this.typeArguments.length; i < max; i++) {
301
				this.typeArguments[i].traverse(visitor, scope);
384
				this.typeArguments[i].traverse(visitor, scope);
302
			}
385
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 113-119 Link Here
113
		int pc = codeStream.position;
113
		int pc = codeStream.position;
114
		MethodBinding codegenBinding = this.binding.original();
114
		MethodBinding codegenBinding = this.binding.original();
115
		ReferenceBinding allocatedType = codegenBinding.declaringClass;
115
		ReferenceBinding allocatedType = codegenBinding.declaringClass;
116
		codeStream.new_(allocatedType);
116
		codeStream.new_(this.type, allocatedType);
117
		boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
117
		boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
118
		if (valueRequired || isUnboxing) {
118
		if (valueRequired || isUnboxing) {
119
			codeStream.dup();
119
			codeStream.dup();
Lines 146-152 Link Here
146
146
147
		// invoke constructor
147
		// invoke constructor
148
		if (this.syntheticAccessor == null) {
148
		if (this.syntheticAccessor == null) {
149
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
149
			codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */, this.typeArguments);
150
		} else {
150
		} else {
151
			// synthetic accessor got some extra arguments appended to its signature, which need values
151
			// synthetic accessor got some extra arguments appended to its signature, which need values
152
			for (int i = 0,
152
			for (int i = 0,
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java (-6 / +30 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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-38 Link Here
33
		//warning : the new type ref has a null binding
33
		//warning : the new type ref has a null binding
34
		return new ArrayQualifiedTypeReference(this.tokens, dim, this.sourcePositions);
34
		return new ArrayQualifiedTypeReference(this.tokens, dim, this.sourcePositions);
35
	}
35
	}
36
	
37
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions) {
38
		//return a type reference copy of me with some dimensions
39
		//warning : the new type ref has a null binding
40
		ArrayQualifiedTypeReference arrayQualifiedTypeReference = new ArrayQualifiedTypeReference(this.tokens, dim, annotationsOnDimensions, this.sourcePositions);
41
		arrayQualifiedTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
42
		if (annotationsOnDimensions != null) {
43
			arrayQualifiedTypeReference.bits |= ASTNode.HasTypeAnnotations;
44
		}
45
		return arrayQualifiedTypeReference;
46
	}
36
47
37
	protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) {
48
	protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) {
38
		LookupEnvironment env = scope.environment();
49
		LookupEnvironment env = scope.environment();
Lines 122-128 Link Here
122
	}
133
	}
123
134
124
	public StringBuffer printExpression(int indent, StringBuffer output) {
135
	public StringBuffer printExpression(int indent, StringBuffer output) {
125
136
		if (this.annotations != null) {
137
			printAnnotations(this.annotations, output);
138
			output.append(' ');
139
		}
126
		for (int i = 0; i < this.tokens.length; i++) {
140
		for (int i = 0; i < this.tokens.length; i++) {
127
			if (i > 0) output.append('.');
141
			if (i > 0) output.append('.');
128
			output.append(this.tokens[i]);
142
			output.append(this.tokens[i]);
Lines 131-144 Link Here
131
	}
145
	}
132
146
133
	public void traverse(ASTVisitor visitor, BlockScope scope) {
147
	public void traverse(ASTVisitor visitor, BlockScope scope) {
134
148
		if (visitor.visit(this, scope)) {
135
		visitor.visit(this, scope);
149
			if (this.annotations != null) {
150
				int annotationsLength = this.annotations.length;
151
				for (int i = 0; i < annotationsLength; i++)
152
					this.annotations[i].traverse(visitor, scope);
153
			}
154
		}
136
		visitor.endVisit(this, scope);
155
		visitor.endVisit(this, scope);
137
	}
156
	}
138
157
139
	public void traverse(ASTVisitor visitor, ClassScope scope) {
158
	public void traverse(ASTVisitor visitor, ClassScope scope) {
140
159
		if (visitor.visit(this, scope)) {
141
		visitor.visit(this, scope);
160
			if (this.annotations != null) {
161
				int annotationsLength = this.annotations.length;
162
				for (int i = 0; i < annotationsLength; i++)
163
					this.annotations[i].traverse(visitor, scope);
164
			}
165
		}
142
		visitor.endVisit(this, scope);
166
		visitor.endVisit(this, scope);
143
	}
167
	}
144
}
168
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java (-1 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 62-65 Link Here
62
		}
62
		}
63
		visitor.endVisit(this, scope);
63
		visitor.endVisit(this, scope);
64
	}
64
	}
65
66
	public void traverse(ASTVisitor visitor, ClassScope scope) {
67
		if (visitor.visit(this, scope)) {
68
			if (this.type != null) {
69
				this.type.traverse(visitor, scope);
70
			}
71
			if (this.memberValue != null) {
72
				this.memberValue.traverse(visitor, scope);
73
			}
74
		}
75
		visitor.endVisit(this, scope);
76
	}
65
}
77
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java (-4 / +30 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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-38 Link Here
33
33
34
		return new ArrayTypeReference(this.token, dim,(((long)this.sourceStart)<<32)+this.sourceEnd);
34
		return new ArrayTypeReference(this.token, dim,(((long)this.sourceStart)<<32)+this.sourceEnd);
35
	}
35
	}
36
	
37
	public TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions){
38
		//return a type reference copy of me with some dimensions
39
		//warning : the new type ref has a null binding
40
		ArrayTypeReference arrayTypeReference = new ArrayTypeReference(this.token, dim, annotationsOnDimensions, (((long)this.sourceStart)<<32)+this.sourceEnd);
41
		arrayTypeReference.bits |= (this.bits & ASTNode.HasTypeAnnotations);
42
		if (annotationsOnDimensions != null) {
43
			arrayTypeReference.bits |= ASTNode.HasTypeAnnotations;
44
		}
45
		return arrayTypeReference;
46
	}
36
47
37
	public char[] getLastToken() {
48
	public char[] getLastToken() {
38
		return this.token;
49
		return this.token;
Lines 54-60 Link Here
54
	}
65
	}
55
66
56
	public StringBuffer printExpression(int indent, StringBuffer output){
67
	public StringBuffer printExpression(int indent, StringBuffer output){
57
68
		if (this.annotations != null) {
69
			printAnnotations(this.annotations, output);
70
			output.append(' ');
71
		}
58
		return output.append(this.token);
72
		return output.append(this.token);
59
	}
73
	}
60
74
Lines 85-96 Link Here
85
	}
99
	}
86
100
87
	public void traverse(ASTVisitor visitor, BlockScope scope) {
101
	public void traverse(ASTVisitor visitor, BlockScope scope) {
88
		visitor.visit(this, scope);
102
		if (visitor.visit(this, scope)) {
103
			if (this.annotations != null) {
104
				int annotationsLength = this.annotations.length;
105
				for (int i = 0; i < annotationsLength; i++)
106
					this.annotations[i].traverse(visitor, scope);
107
			}
108
		}
89
		visitor.endVisit(this, scope);
109
		visitor.endVisit(this, scope);
90
	}
110
	}
91
111
92
	public void traverse(ASTVisitor visitor, ClassScope scope) {
112
	public void traverse(ASTVisitor visitor, ClassScope scope) {
93
		visitor.visit(this, scope);
113
		if (visitor.visit(this, scope)) {
114
			if (this.annotations != null) {
115
				int annotationsLength = this.annotations.length;
116
				for (int i = 0; i < annotationsLength; i++)
117
					this.annotations[i].traverse(visitor, scope);
118
			}
119
		}
94
		visitor.endVisit(this, scope);
120
		visitor.endVisit(this, scope);
95
	}
121
	}
96
}
122
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java (-3 / +3 lines)
Lines 106-112 Link Here
106
			// called with (argLength - lastIndex) elements : foo(1, 2) or foo(1, 2, 3, 4)
106
			// called with (argLength - lastIndex) elements : foo(1, 2) or foo(1, 2, 3, 4)
107
			// need to gen elements into an array, then gen each remaining element into created array
107
			// need to gen elements into an array, then gen each remaining element into created array
108
			codeStream.generateInlinedValue(argLength - varArgIndex);
108
			codeStream.generateInlinedValue(argLength - varArgIndex);
109
			codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
109
			codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
110
			for (int i = varArgIndex; i < argLength; i++) {
110
			for (int i = varArgIndex; i < argLength; i++) {
111
				codeStream.dup();
111
				codeStream.dup();
112
				codeStream.generateInlinedValue(i - varArgIndex);
112
				codeStream.generateInlinedValue(i - varArgIndex);
Lines 125-131 Link Here
125
				// right number but not directly compatible or too many arguments - wrap extra into array
125
				// right number but not directly compatible or too many arguments - wrap extra into array
126
				// need to gen elements into an array, then gen each remaining element into created array
126
				// need to gen elements into an array, then gen each remaining element into created array
127
				codeStream.generateInlinedValue(1);
127
				codeStream.generateInlinedValue(1);
128
				codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
128
				codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
129
				codeStream.dup();
129
				codeStream.dup();
130
				codeStream.generateInlinedValue(0);
130
				codeStream.generateInlinedValue(0);
131
				arguments[varArgIndex].generateCode(currentScope, codeStream, true);
131
				arguments[varArgIndex].generateCode(currentScope, codeStream, true);
Lines 135-141 Link Here
135
			// scenario: foo(1) --> foo(1, new int[0])
135
			// scenario: foo(1) --> foo(1, new int[0])
136
			// generate code for an empty array of parameterType
136
			// generate code for an empty array of parameterType
137
			codeStream.generateInlinedValue(0);
137
			codeStream.generateInlinedValue(0);
138
			codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
138
			codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
139
		}
139
		}
140
	} else if (arguments != null) { // standard generation for method arguments
140
	} else if (arguments != null) { // standard generation for method arguments
141
		for (int i = 0, max = arguments.length; i < max; i++)
141
		for (int i = 0, max = arguments.length; i < max; i++)
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java (-30 / +238 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.jdt.internal.compiler.ast;
12
package org.eclipse.jdt.internal.compiler.ast;
13
13
14
import java.util.Arrays;
15
14
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
17
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
16
import org.eclipse.jdt.internal.compiler.codegen.*;
18
import org.eclipse.jdt.internal.compiler.codegen.*;
Lines 32-42 Link Here
32
	public int blockStart;
34
	public int blockStart;
33
	public int caseCount;
35
	public int caseCount;
34
	int[] constants;
36
	int[] constants;
37
	String[] stringConstants;
35
38
36
	// fallthrough
39
	// fallthrough
37
	public final static int CASE = 0;
40
	public final static int CASE = 0;
38
	public final static int FALLTHROUGH = 1;
41
	public final static int FALLTHROUGH = 1;
39
	public final static int ESCAPING = 2;
42
	public final static int ESCAPING = 2;
43
	private static final char[] SecretStringVariableName = " switchDispatchString".toCharArray(); //$NON-NLS-1$
40
44
41
45
42
	public SyntheticMethodBinding synthetic; // use for switch on enums types
46
	public SyntheticMethodBinding synthetic; // use for switch on enums types
Lines 44-49 Link Here
44
	// for local variables table attributes
48
	// for local variables table attributes
45
	int preSwitchInitStateIndex = -1;
49
	int preSwitchInitStateIndex = -1;
46
	int mergedInitStateIndex = -1;
50
	int mergedInitStateIndex = -1;
51
	
52
	CaseStatement[] duplicateCaseStatements = null;
53
	int duplicateCaseStatementsCounter = 0;
54
	private LocalVariableBinding dispatchStringCopy = null;
55
	
47
56
48
	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
57
	public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
49
		try {
58
		try {
Lines 121-133 Link Here
121
	}
130
	}
122
131
123
	/**
132
	/**
133
	 * Switch on String code generation
134
	 * This assumes that hashCode() specification for java.lang.String is API
135
	 * and is stable.
136
	 * @see "http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html"
137
	 * @see "http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/lang/String.html"
138
	 *
139
	 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
140
	 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
141
	 */
142
	public void generateCodeForStringSwitch(BlockScope currentScope, CodeStream codeStream) {
143
144
		try {
145
			if ((this.bits & IsReachable) == 0) {
146
				return;
147
			}
148
			int pc = codeStream.position;
149
			
150
			class StringSwitchCase implements Comparable {
151
				int hashCode;
152
				String string;
153
				BranchLabel label;
154
				public StringSwitchCase(int hashCode, String string, BranchLabel label) {
155
					this.hashCode = hashCode;
156
					this.string = string;
157
					this.label = label;
158
				}
159
				public int compareTo(Object o) {
160
					StringSwitchCase that = (StringSwitchCase) o;
161
					if (this.hashCode == that.hashCode) {
162
						return 0;
163
					}
164
					if (this.hashCode > that.hashCode) {
165
						return 1;
166
					}
167
					return -1;
168
				}
169
				public String toString() {
170
					return "StringSwitchCase :\n" + //$NON-NLS-1$
171
					       "case " + this.hashCode + ":(" + this.string + ")\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$	       
172
				}
173
			}
174
175
			final boolean hasCases = this.caseCount != 0;
176
			final boolean valueRequired = this.expression.constant == Constant.NotAConstant || hasCases;
177
178
			StringSwitchCase [] stringCases = new StringSwitchCase[this.caseCount]; // may have to shrink later if multiple strings hash to same code.
179
			BranchLabel[] sourceCaseLabels = new BranchLabel[this.caseCount];
180
			CaseLabel [] hashCodeCaseLabels = new CaseLabel[this.caseCount];
181
			this.constants = new int[this.caseCount];  // hashCode() values.
182
			for (int i = 0, max = this.caseCount; i < max; i++) {
183
				this.cases[i].targetLabel = (sourceCaseLabels[i] = new BranchLabel(codeStream));  // A branch label, not a case label.
184
				sourceCaseLabels[i].tagBits |= BranchLabel.USED;
185
				stringCases[i] = new StringSwitchCase(this.stringConstants[i].hashCode(), this.stringConstants[i], sourceCaseLabels[i]);
186
				hashCodeCaseLabels[i] = new CaseLabel(codeStream);
187
				hashCodeCaseLabels[i].tagBits |= BranchLabel.USED;
188
				
189
			}
190
			Arrays.sort(stringCases);
191
				
192
			int uniqHashCount = 0;
193
			int lastHashCode = 0; 
194
			for (int i = 0, length = this.caseCount; i < length; ++i) {
195
				int hashCode = stringCases[i].hashCode;
196
				if (i == 0 || hashCode != lastHashCode) {
197
					lastHashCode = this.constants[uniqHashCount++] = hashCode;
198
				}
199
			}
200
				
201
			if (uniqHashCount != this.caseCount) { // multiple keys hashed to the same value.
202
				System.arraycopy(this.constants, 0, this.constants = new int[uniqHashCount], 0, uniqHashCount);
203
				System.arraycopy(hashCodeCaseLabels, 0, hashCodeCaseLabels = new CaseLabel[uniqHashCount], 0, uniqHashCount);
204
			}
205
			int[] sortedIndexes = new int[uniqHashCount]; // hash code are sorted already anyways.
206
			for (int i = 0; i < uniqHashCount; i++) {
207
				sortedIndexes[i] = i;
208
			}
209
210
			CaseLabel defaultCaseLabel = new CaseLabel(codeStream);
211
			defaultCaseLabel.tagBits |= BranchLabel.USED;
212
213
			// prepare the labels and constants
214
			this.breakLabel.initialize(codeStream);
215
			
216
			BranchLabel defaultBranchLabel = new BranchLabel(codeStream);
217
			if (hasCases) defaultBranchLabel.tagBits |= BranchLabel.USED;
218
			if (this.defaultCase != null) {
219
				this.defaultCase.targetLabel = defaultBranchLabel;
220
			}
221
			// generate expression
222
			this.expression.generateCode(currentScope, codeStream, true);
223
			codeStream.store(this.dispatchStringCopy, true);  // leaves string on operand stack
224
			codeStream.addVariable(this.dispatchStringCopy);
225
			codeStream.invokeStringHashCode();
226
			if (hasCases) {
227
				codeStream.lookupswitch(defaultCaseLabel, this.constants, sortedIndexes, hashCodeCaseLabels);
228
				for (int i = 0, j = 0, max = this.caseCount; i < max; i++) {
229
					int hashCode = stringCases[i].hashCode;
230
					if (i == 0 || hashCode != lastHashCode) {
231
						lastHashCode = hashCode;
232
						if (i != 0) {
233
							codeStream.goto_(defaultBranchLabel);
234
						}
235
						hashCodeCaseLabels[j++].place();
236
					}
237
					codeStream.load(this.dispatchStringCopy);
238
					codeStream.ldc(stringCases[i].string);
239
					codeStream.invokeStringEquals();
240
					codeStream.ifne(stringCases[i].label);
241
				}
242
				codeStream.goto_(defaultBranchLabel);
243
			} else if (valueRequired) {
244
				codeStream.pop();
245
			}
246
247
			// generate the switch block statements
248
			int caseIndex = 0;
249
			if (this.statements != null) {
250
				for (int i = 0, maxCases = this.statements.length; i < maxCases; i++) {
251
					Statement statement = this.statements[i];
252
					if ((caseIndex < this.caseCount) && (statement == this.cases[caseIndex])) { // statements[i] is a case
253
						this.scope.enclosingCase = this.cases[caseIndex]; // record entering in a switch case block
254
						if (this.preSwitchInitStateIndex != -1) {
255
							codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.preSwitchInitStateIndex);
256
						}
257
						caseIndex++;
258
					} else {
259
						if (statement == this.defaultCase) { // statements[i] is a case or a default case
260
							defaultCaseLabel.place(); // branch label gets placed by generateCode below.
261
							this.scope.enclosingCase = this.defaultCase; // record entering in a switch case block
262
							if (this.preSwitchInitStateIndex != -1) {
263
								codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.preSwitchInitStateIndex);
264
							}
265
						}
266
					}
267
					statement.generateCode(this.scope, codeStream);
268
				}
269
			}
270
			
271
			// May loose some local variable initializations : affecting the local variable attributes
272
			if (this.mergedInitStateIndex != -1) {
273
				codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex);
274
				codeStream.addDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex);
275
			}
276
			codeStream.removeVariable(this.dispatchStringCopy);
277
			if (this.scope != currentScope) {
278
				codeStream.exitUserScope(this.scope);
279
			}
280
			// place the trailing labels (for break and default case)
281
			this.breakLabel.place();
282
			if (this.defaultCase == null) {
283
				// we want to force an line number entry to get an end position after the switch statement
284
				codeStream.recordPositionsFrom(codeStream.position, this.sourceEnd, true);
285
				defaultCaseLabel.place();
286
				defaultBranchLabel.place();
287
			}
288
			codeStream.recordPositionsFrom(pc, this.sourceStart);
289
		} catch (Throwable e) {
290
			e.printStackTrace();
291
		}
292
		finally {
293
			if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block
294
		}
295
	}
296
297
	
298
	/**
124
	 * Switch code generation
299
	 * Switch code generation
125
	 *
300
	 *
126
	 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
301
	 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
127
	 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
302
	 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
128
	 */
303
	 */
129
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
304
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
130
305
		if (this.expression.resolvedType.id == TypeIds.T_JavaLangString) {
306
			generateCodeForStringSwitch(currentScope, codeStream);
307
			return;
308
		}
131
		try {
309
		try {
132
			if ((this.bits & IsReachable) == 0) {
310
			if ((this.bits & IsReachable) == 0) {
133
				return;
311
				return;
Lines 267-272 Link Here
267
	public void resolve(BlockScope upperScope) {
445
	public void resolve(BlockScope upperScope) {
268
		try {
446
		try {
269
			boolean isEnumSwitch = false;
447
			boolean isEnumSwitch = false;
448
			boolean isStringSwitch = false;
270
			TypeBinding expressionType = this.expression.resolveType(upperScope);
449
			TypeBinding expressionType = this.expression.resolveType(upperScope);
271
			if (expressionType != null) {
450
			if (expressionType != null) {
272
				this.expression.computeConversion(upperScope, expressionType, expressionType);
451
				this.expression.computeConversion(upperScope, expressionType, expressionType);
Lines 285-290 Link Here
285
					} else if (upperScope.isBoxingCompatibleWith(expressionType, TypeBinding.INT)) {
464
					} else if (upperScope.isBoxingCompatibleWith(expressionType, TypeBinding.INT)) {
286
						this.expression.computeConversion(upperScope, TypeBinding.INT, expressionType);
465
						this.expression.computeConversion(upperScope, TypeBinding.INT, expressionType);
287
						break checkType;
466
						break checkType;
467
					} else if (upperScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_7 && expressionType.id == TypeIds.T_JavaLangString) {
468
						isStringSwitch = true;
469
						break checkType;
288
					}
470
					}
289
					upperScope.problemReporter().incorrectSwitchType(this.expression, expressionType);
471
					upperScope.problemReporter().incorrectSwitchType(this.expression, expressionType);
290
					expressionType = null; // fault-tolerance: ignore type mismatch from constants from hereon
472
					expressionType = null; // fault-tolerance: ignore type mismatch from constants from hereon
Lines 295-345 Link Here
295
				int length;
477
				int length;
296
				// collection of cases is too big but we will only iterate until caseCount
478
				// collection of cases is too big but we will only iterate until caseCount
297
				this.cases = new CaseStatement[length = this.statements.length];
479
				this.cases = new CaseStatement[length = this.statements.length];
298
				this.constants = new int[length];
480
				if (!isStringSwitch) {
299
				CaseStatement[] duplicateCaseStatements = null;
481
					this.constants = new int[length];
300
				int duplicateCaseStatementsCounter = 0;
482
				} else {
483
					this.stringConstants = new String[length];
484
				}
301
				int counter = 0;
485
				int counter = 0;
302
				for (int i = 0; i < length; i++) {
486
				for (int i = 0; i < length; i++) {
303
					Constant constant;
487
					Constant constant;
304
					final Statement statement = this.statements[i];
488
					final Statement statement = this.statements[i];
305
					if ((constant = statement.resolveCase(this.scope, expressionType, this)) != Constant.NotAConstant) {
489
					if ((constant = statement.resolveCase(this.scope, expressionType, this)) != Constant.NotAConstant) {
306
						int key = constant.intValue();
490
						if (!isStringSwitch) {
307
						//----check for duplicate case statement------------
491
							int key = constant.intValue();
308
						for (int j = 0; j < counter; j++) {
492
							//----check for duplicate case statement------------
309
							if (this.constants[j] == key) {
493
							for (int j = 0; j < counter; j++) {
310
								final CaseStatement currentCaseStatement = (CaseStatement) statement;
494
								if (this.constants[j] == key) {
311
								if (duplicateCaseStatements == null) {
495
									reportDuplicateCase((CaseStatement) statement, this.cases[j], length);
312
									this.scope.problemReporter().duplicateCase(this.cases[j]);
496
								}
313
									this.scope.problemReporter().duplicateCase(currentCaseStatement);
497
							}
314
									duplicateCaseStatements = new CaseStatement[length];
498
							this.constants[counter++] = key;
315
									duplicateCaseStatements[duplicateCaseStatementsCounter++] = this.cases[j];
499
						} else {
316
									duplicateCaseStatements[duplicateCaseStatementsCounter++] = currentCaseStatement;
500
							String key = constant.stringValue();
317
								} else {
501
							//----check for duplicate case statement------------
318
									boolean found = false;
502
							for (int j = 0; j < counter; j++) {
319
									searchReportedDuplicate: for (int k = 2; k < duplicateCaseStatementsCounter; k++) {
503
								if (this.stringConstants[j].equals(key)) {
320
										if (duplicateCaseStatements[k] == statement) {
504
									reportDuplicateCase((CaseStatement) statement, this.cases[j], length);
321
											found = true;
322
											break searchReportedDuplicate;
323
										}
324
									}
325
									if (!found) {
326
										this.scope.problemReporter().duplicateCase(currentCaseStatement);
327
										duplicateCaseStatements[duplicateCaseStatementsCounter++] = currentCaseStatement;
328
									}
329
								}
505
								}
330
							}
506
							}
507
							this.stringConstants[counter++] = key;			
331
						}
508
						}
332
						this.constants[counter++] = key;
333
					}
509
					}
334
				}
510
				}
335
				if (length != counter) { // resize constants array
511
				if (length != counter) { // resize constants array
336
					System.arraycopy(this.constants, 0, this.constants = new int[counter], 0, counter);
512
					if (!isStringSwitch) {
513
						System.arraycopy(this.constants, 0, this.constants = new int[counter], 0, counter);
514
					} else {
515
						System.arraycopy(this.stringConstants, 0, this.stringConstants = new String[counter], 0, counter);
516
					}
337
				}
517
				}
338
			} else {
518
			} else {
339
				if ((this.bits & UndocumentedEmptyBlock) != 0) {
519
				if ((this.bits & UndocumentedEmptyBlock) != 0) {
340
					upperScope.problemReporter().undocumentedEmptyBlock(this.blockStart, this.sourceEnd);
520
					upperScope.problemReporter().undocumentedEmptyBlock(this.blockStart, this.sourceEnd);
341
				}
521
				}
342
			}
522
			}
523
			if (isStringSwitch) {
524
				this.dispatchStringCopy  = new LocalVariableBinding(SecretStringVariableName, upperScope.getJavaLangString(), ClassFileConstants.AccDefault, false);
525
				upperScope.addLocalVariable(this.dispatchStringCopy);
526
				this.dispatchStringCopy.setConstant(Constant.NotAConstant);
527
				this.dispatchStringCopy.useFlag = LocalVariableBinding.USED;
528
			}
343
			// for enum switch, check if all constants are accounted for (if no default)
529
			// for enum switch, check if all constants are accounted for (if no default)
344
			if (isEnumSwitch && this.defaultCase == null
530
			if (isEnumSwitch && this.defaultCase == null
345
					&& upperScope.compilerOptions().getSeverity(CompilerOptions.IncompleteEnumSwitch) != ProblemSeverities.Ignore) {
531
					&& upperScope.compilerOptions().getSeverity(CompilerOptions.IncompleteEnumSwitch) != ProblemSeverities.Ignore) {
Lines 366-371 Link Here
366
		}
552
		}
367
	}
553
	}
368
554
555
	private void reportDuplicateCase(final CaseStatement duplicate, final CaseStatement original, int length) {
556
		if (this.duplicateCaseStatements == null) {
557
			this.scope.problemReporter().duplicateCase(original);
558
			this.scope.problemReporter().duplicateCase(duplicate);
559
			this.duplicateCaseStatements = new CaseStatement[length];
560
			this.duplicateCaseStatements[this.duplicateCaseStatementsCounter++] = original;
561
			this.duplicateCaseStatements[this.duplicateCaseStatementsCounter++] = duplicate;
562
		} else {
563
			boolean found = false;
564
			searchReportedDuplicate: for (int k = 2; k < this.duplicateCaseStatementsCounter; k++) {
565
				if (this.duplicateCaseStatements[k] == duplicate) {
566
					found = true;
567
					break searchReportedDuplicate;
568
				}
569
			}
570
			if (!found) {
571
				this.scope.problemReporter().duplicateCase(duplicate);
572
				this.duplicateCaseStatements[this.duplicateCaseStatementsCounter++] = duplicate;
573
			}
574
		}
575
	}
576
369
	public void traverse(
577
	public void traverse(
370
			ASTVisitor visitor,
578
			ASTVisitor visitor,
371
			BlockScope blockScope) {
579
			BlockScope blockScope) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java (-4 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 7-13 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for bug 332637 - Dead Code detection removing code that isn't dead
11
 *******************************************************************************/
10
 *******************************************************************************/
12
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
13
12
Lines 139-145 Link Here
139
				}
138
				}
140
139
141
				// catch var is always set
140
				// catch var is always set
142
				LocalVariableBinding catchArg = this.catchArguments[i].binding;
141
				Argument catchVariable = this.catchArguments[i];
142
				catchVariable.bits |= ASTNode.CatchVariable;
143
				LocalVariableBinding catchArg = catchVariable.binding;
143
				catchInfo.markAsDefinitelyAssigned(catchArg);
144
				catchInfo.markAsDefinitelyAssigned(catchArg);
144
				catchInfo.markAsDefinitelyNonNull(catchArg);
145
				catchInfo.markAsDefinitelyNonNull(catchArg);
145
				/*
146
				/*
Lines 235-241 Link Here
235
								addPotentialInitializationsFrom(tryInfo).
236
								addPotentialInitializationsFrom(tryInfo).
236
								addPotentialInitializationsFrom(
237
								addPotentialInitializationsFrom(
237
									handlingContext.initsOnReturn));
238
									handlingContext.initsOnReturn));
238
				}else {
239
				} else {
239
					FlowInfo initsOnException = handlingContext.initsOnException(this.caughtExceptionTypes[i]);
240
					FlowInfo initsOnException = handlingContext.initsOnException(this.caughtExceptionTypes[i]);
240
					catchInfo =
241
					catchInfo =
241
						flowInfo.nullInfoLessUnconditionalCopy()
242
						flowInfo.nullInfoLessUnconditionalCopy()
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-3 / +18 lines)
Lines 892-898 Link Here
892
892
893
public StringBuffer printHeader(int indent, StringBuffer output) {
893
public StringBuffer printHeader(int indent, StringBuffer output) {
894
	printModifiers(this.modifiers, output);
894
	printModifiers(this.modifiers, output);
895
	if (this.annotations != null) printAnnotations(this.annotations, output);
895
	if (this.annotations != null) {
896
		printAnnotations(this.annotations, output);
897
		output.append(' ');
898
	}
896
899
897
	switch (kind(this.modifiers)) {
900
	switch (kind(this.modifiers)) {
898
		case TypeDeclaration.CLASS_DECL :
901
		case TypeDeclaration.CLASS_DECL :
Lines 944-951 Link Here
944
	return print(tab, output);
947
	return print(tab, output);
945
}
948
}
946
949
947
948
949
public void resolve() {
950
public void resolve() {
950
	SourceTypeBinding sourceType = this.binding;
951
	SourceTypeBinding sourceType = this.binding;
951
	if (sourceType == null) {
952
	if (sourceType == null) {
Lines 957-965 Link Here
957
		try {
958
		try {
958
			this.staticInitializerScope.insideTypeAnnotation = true;
959
			this.staticInitializerScope.insideTypeAnnotation = true;
959
			resolveAnnotations(this.staticInitializerScope, this.annotations, sourceType);
960
			resolveAnnotations(this.staticInitializerScope, this.annotations, sourceType);
961
			if (this.superclass != null) {
962
				this.superclass.resolveAnnotations(this.staticInitializerScope);
963
			}
964
			if (this.superInterfaces != null) {
965
				for (int i = 0, max = this.superInterfaces.length; i < max; i++) {
966
					this.superInterfaces[i].resolveAnnotations(this.staticInitializerScope);
967
				}
968
			}
969
			if (this.typeParameters != null) {
970
				for (int i = 0, count = this.typeParameters.length; i < count; i++) {
971
					this.typeParameters[i].resolveAnnotations(this.staticInitializerScope);
972
				}
973
			}
960
		} finally {
974
		} finally {
961
			this.staticInitializerScope.insideTypeAnnotation = old;
975
			this.staticInitializerScope.insideTypeAnnotation = old;
962
		}
976
		}
977
		
963
		// check @Deprecated annotation
978
		// check @Deprecated annotation
964
		if ((sourceType.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0
979
		if ((sourceType.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0
965
				&& (sourceType.modifiers & ClassFileConstants.AccDeprecated) != 0
980
				&& (sourceType.modifiers & ClassFileConstants.AccDeprecated) != 0
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java (-4 / +65 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import java.util.List;
14
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
15
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
17
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
14
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
18
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
15
import org.eclipse.jdt.internal.compiler.lookup.Binding;
19
import org.eclipse.jdt.internal.compiler.lookup.Binding;
16
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
20
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
Lines 20-26 Link Here
20
24
21
public class TypeParameter extends AbstractVariableDeclaration {
25
public class TypeParameter extends AbstractVariableDeclaration {
22
26
23
    public TypeVariableBinding binding;
27
	public TypeVariableBinding binding;
24
	public TypeReference[] bounds;
28
	public TypeReference[] bounds;
25
29
26
	/**
30
	/**
Lines 42-49 Link Here
42
		}
46
		}
43
	}
47
	}
44
48
49
	public void getAllAnnotationContexts(int targetType, int typeParameterIndex, List allAnnotationContexts) {
50
		AnnotationCollector collector = new AnnotationCollector(this, targetType, typeParameterIndex, allAnnotationContexts);
51
		if (this.annotations != null) {
52
			int annotationsLength = this.annotations.length;
53
			for (int i = 0; i < annotationsLength; i++)
54
				this.annotations[i].traverse(collector, (BlockScope) null);
55
		}
56
		switch(collector.targetType) {
57
			case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
58
				collector.targetType = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND;
59
				break;
60
			case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
61
				collector.targetType = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND;
62
		}
63
		if (this.type != null && ((this.type.bits & ASTNode.HasTypeAnnotations) != 0)) {
64
			collector.info2 = 0;
65
			this.type.traverse(collector, (BlockScope) null);
66
		}
67
		if (this.bounds != null) {
68
			int boundsLength = this.bounds.length;
69
			for (int i = 0; i < boundsLength; i++) {
70
				TypeReference bound = this.bounds[i];
71
				if ((bound.bits & ASTNode.HasTypeAnnotations) == 0) {
72
					continue;
73
				}
74
				collector.info2 = i + 1;
75
				bound.traverse(collector, (BlockScope) null);
76
			}
77
		}
78
	}
45
	private void internalResolve(Scope scope, boolean staticContext) {
79
	private void internalResolve(Scope scope, boolean staticContext) {
46
	    // detect variable/type name collisions
80
		// detect variable/type name collisions
47
		if (this.binding != null) {
81
		if (this.binding != null) {
48
			Binding existingType = scope.parent.getBinding(this.name, Binding.TYPE, this, false/*do not resolve hidden field*/);
82
			Binding existingType = scope.parent.getBinding(this.name, Binding.TYPE, this, false/*do not resolve hidden field*/);
49
			if (existingType != null
83
			if (existingType != null
Lines 63-72 Link Here
63
		internalResolve(scope, scope.enclosingSourceType().isStatic());
97
		internalResolve(scope, scope.enclosingSourceType().isStatic());
64
	}
98
	}
65
99
100
	public void resolveAnnotations(BlockScope scope) {
101
		if (this.annotations != null) {
102
			resolveAnnotations(scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_PARAMETER));
103
		}
104
		if (this.type != null) {
105
			this.type.resolveAnnotations(scope);
106
		}
107
		if (this.bounds != null) {
108
			for (int i = 0, max = this.bounds.length; i < max; i++) {
109
				this.bounds[i].resolveAnnotations(scope);
110
			}
111
		}
112
	}
66
	/* (non-Javadoc)
113
	/* (non-Javadoc)
67
	 * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
114
	 * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
68
	 */
115
	 */
69
	public StringBuffer printStatement(int indent, StringBuffer output) {
116
	public StringBuffer printStatement(int indent, StringBuffer output) {
117
		if (this.annotations != null) {
118
			printAnnotations(this.annotations, output);
119
			output.append(' ');
120
		}
70
		output.append(this.name);
121
		output.append(this.name);
71
		if (this.type != null) {
122
		if (this.type != null) {
72
			output.append(" extends "); //$NON-NLS-1$
123
			output.append(" extends "); //$NON-NLS-1$
Lines 82-92 Link Here
82
	}
133
	}
83
134
84
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
135
	public void generateCode(BlockScope currentScope, CodeStream codeStream) {
85
	    // nothing to do
136
		// nothing to do
86
	}
137
	}
87
138
88
	public void traverse(ASTVisitor visitor, BlockScope scope) {
139
	public void traverse(ASTVisitor visitor, BlockScope scope) {
89
		if (visitor.visit(this, scope)) {
140
		if (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
			}
90
			if (this.type != null) {
146
			if (this.type != null) {
91
				this.type.traverse(visitor, scope);
147
				this.type.traverse(visitor, scope);
92
			}
148
			}
Lines 102-107 Link Here
102
158
103
	public void traverse(ASTVisitor visitor, ClassScope scope) {
159
	public void traverse(ASTVisitor visitor, ClassScope scope) {
104
		if (visitor.visit(this, scope)) {
160
		if (visitor.visit(this, scope)) {
161
			if (this.annotations != null) {
162
				int annotationsLength = this.annotations.length;
163
				for (int i = 0; i < annotationsLength; i++)
164
					this.annotations[i].traverse(visitor, scope);
165
			}
105
			if (this.type != null) {
166
			if (this.type != null) {
106
				this.type.traverse(visitor, scope);
167
				this.type.traverse(visitor, scope);
107
			}
168
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java (-15 / +289 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 10-23 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
11
package org.eclipse.jdt.internal.compiler.ast;
12
12
13
import java.util.ArrayList;
14
import java.util.List;
15
13
import org.eclipse.jdt.internal.compiler.ASTVisitor;
16
import org.eclipse.jdt.internal.compiler.ASTVisitor;
17
import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext;
18
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
14
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
19
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
15
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
20
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
16
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
21
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
17
import org.eclipse.jdt.internal.compiler.impl.Constant;
22
import org.eclipse.jdt.internal.compiler.impl.Constant;
18
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
23
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.Binding;
19
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
25
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
20
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
26
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
27
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
21
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
28
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
22
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
29
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
23
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
30
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
Lines 28-38 Link Here
28
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
35
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
29
36
30
public abstract class TypeReference extends Expression {
37
public abstract class TypeReference extends Expression {
38
static class AnnotationCollector extends ASTVisitor {
39
	List annotationContexts;
40
	TypeReference typeReference;
41
	int targetType;
42
	Annotation[] primaryAnnotations;
43
	int info = -1;
44
	int info2 = -1;
45
	LocalVariableBinding localVariable;
46
	Annotation[][] annotationsOnDimensions;
47
	Wildcard currentWildcard;
48
49
	public AnnotationCollector(
50
			TypeParameter typeParameter,
51
			int targetType,
52
			int typeParameterIndex,
53
			List annotationContexts) {
54
		this.annotationContexts = annotationContexts;
55
		this.typeReference = typeParameter.type;
56
		this.targetType = targetType;
57
		this.primaryAnnotations = typeParameter.annotations;
58
		this.info = typeParameterIndex;
59
	}
60
61
	public AnnotationCollector(
62
			LocalDeclaration localDeclaration,
63
			int targetType,
64
			LocalVariableBinding localVariable,
65
			List annotationContexts) {
66
		this.annotationContexts = annotationContexts;
67
		this.typeReference = localDeclaration.type;
68
		this.targetType = targetType;
69
		this.primaryAnnotations = localDeclaration.annotations;
70
		this.localVariable = localVariable;
71
	}
72
73
	public AnnotationCollector(
74
			LocalDeclaration localDeclaration,
75
			int targetType,
76
			int parameterIndex,
77
			List annotationContexts) {
78
		this.annotationContexts = annotationContexts;
79
		this.typeReference = localDeclaration.type;
80
		this.targetType = targetType;
81
		this.primaryAnnotations = localDeclaration.annotations;
82
		this.info = parameterIndex;
83
	}
84
85
	public AnnotationCollector(
86
			MethodDeclaration methodDeclaration,
87
			int targetType,
88
			List annotationContexts) {
89
		this.annotationContexts = annotationContexts;
90
		this.typeReference = methodDeclaration.returnType;
91
		this.targetType = targetType;
92
		this.primaryAnnotations = methodDeclaration.annotations;
93
	}
31
94
95
	public AnnotationCollector(
96
			FieldDeclaration fieldDeclaration,
97
			int targetType,
98
			List annotationContexts) {
99
		this.annotationContexts = annotationContexts;
100
		this.typeReference = fieldDeclaration.type;
101
		this.targetType = targetType;
102
		this.primaryAnnotations = fieldDeclaration.annotations;
103
	}
104
	public AnnotationCollector(
105
			TypeReference typeReference,
106
			int targetType,
107
			List annotationContexts) {
108
		this.annotationContexts = annotationContexts;
109
		this.typeReference = typeReference;
110
		this.targetType = targetType;
111
	}
112
	public AnnotationCollector(
113
			TypeReference typeReference,
114
			int targetType,
115
			int info,
116
			List annotationContexts) {
117
		this.annotationContexts = annotationContexts;
118
		this.typeReference = typeReference;
119
		this.info = info;
120
		this.targetType = targetType;
121
	}
122
	public AnnotationCollector(
123
			TypeReference typeReference,
124
			int targetType,
125
			int info,
126
			int typeIndex,
127
			List annotationContexts) {
128
		this.annotationContexts = annotationContexts;
129
		this.typeReference = typeReference;
130
		this.info = info;
131
		this.targetType = targetType;
132
		this.info2 = typeIndex;
133
	}
134
	public AnnotationCollector(
135
			TypeReference typeReference,
136
			int targetType,
137
			int info,
138
			List annotationContexts,
139
			Annotation[][] annotationsOnDimensions) {
140
		this.annotationContexts = annotationContexts;
141
		this.typeReference = typeReference;
142
		this.info = info;
143
		this.targetType = targetType;
144
		this.annotationsOnDimensions = annotationsOnDimensions;
145
	}
146
	private boolean internalVisit(Annotation annotation) {
147
		AnnotationContext annotationContext = null;
148
		if (annotation.isRuntimeTypeInvisible()) {
149
			annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.INVISIBLE, this.annotationsOnDimensions);
150
		} else if (annotation.isRuntimeTypeVisible()) {
151
			annotationContext = new AnnotationContext(annotation, this.typeReference, this.targetType, this.primaryAnnotations, AnnotationContext.VISIBLE, this.annotationsOnDimensions);
152
		}
153
		if (annotationContext != null) {
154
			annotationContext.wildcard = this.currentWildcard;
155
			switch(this.targetType) {
156
				case AnnotationTargetTypeConstants.THROWS :
157
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER :
158
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER :
159
				case AnnotationTargetTypeConstants.METHOD_PARAMETER :
160
				case AnnotationTargetTypeConstants.TYPE_CAST :
161
				case AnnotationTargetTypeConstants.TYPE_INSTANCEOF :
162
				case AnnotationTargetTypeConstants.OBJECT_CREATION :
163
				case AnnotationTargetTypeConstants.CLASS_LITERAL :
164
				case AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS:
165
					annotationContext.info = this.info;
166
					break;
167
				case AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND :
168
				case AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND :
169
					annotationContext.info2 = this.info2;
170
					annotationContext.info = this.info;
171
					break;
172
				case AnnotationTargetTypeConstants.LOCAL_VARIABLE :
173
					annotationContext.variableBinding = this.localVariable;
174
					break;
175
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL :
176
				case AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
177
					annotationContext.info2 = this.info2;
178
					annotationContext.info = this.info;
179
			}
180
			this.annotationContexts.add(annotationContext);
181
		}
182
		return true;
183
	}
184
	public boolean visit(MarkerAnnotation annotation, BlockScope scope) {
185
		return internalVisit(annotation);
186
	}
187
	public boolean visit(NormalAnnotation annotation, BlockScope scope) {
188
		return internalVisit(annotation);
189
	}
190
	public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
191
		return internalVisit(annotation);
192
	}
193
	public boolean visit(Wildcard wildcard, BlockScope scope) {
194
		this.currentWildcard = wildcard;
195
		return true;
196
	}
197
	public boolean visit(Argument argument, BlockScope scope) {
198
		if ((argument.bits & ASTNode.CatchVariable) == 0) {
199
			return true;
200
		}
201
		for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) {
202
			int startPC = this.localVariable.initializationPCs[i << 1];
203
			int endPC = this.localVariable.initializationPCs[(i << 1) + 1];
204
			if (startPC != endPC) { // only entries for non zero length
205
				return true;
206
			}
207
		}
208
		return false;
209
	}
210
	public boolean visit(Argument argument, ClassScope scope) {
211
		if ((argument.bits & ASTNode.CatchVariable) == 0) {
212
			return true;
213
		}
214
		for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) {
215
			int startPC = this.localVariable.initializationPCs[i << 1];
216
			int endPC = this.localVariable.initializationPCs[(i << 1) + 1];
217
			if (startPC != endPC) { // only entries for non zero length
218
				return true;
219
			}
220
		}
221
		return false;
222
	}
223
	public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) {
224
		for (int i = 0, max = this.localVariable.initializationCount; i < max; i++) {
225
			int startPC = this.localVariable.initializationPCs[i << 1];
226
			int endPC = this.localVariable.initializationPCs[(i << 1) + 1];
227
			if (startPC != endPC) { // only entries for non zero length
228
				return true;
229
			}
230
		}
231
		return false;
232
	}
233
	public void endVisit(Wildcard wildcard, BlockScope scope) {
234
		this.currentWildcard = null;
235
	}
236
}
32
/*
237
/*
33
 * Answer a base type reference (can be an array of base type).
238
 * Answer a base type reference (can be an array of base type).
34
 */
239
 */
35
public static final TypeReference baseTypeReference(int baseType, int dim) {
240
public static final TypeReference baseTypeReference(int baseType, int dim, Annotation [][] dimAnnotations) {
36
241
37
	if (dim == 0) {
242
	if (dim == 0) {
38
		switch (baseType) {
243
		switch (baseType) {
Lines 58-83 Link Here
58
	}
263
	}
59
	switch (baseType) {
264
	switch (baseType) {
60
		case (TypeIds.T_void) :
265
		case (TypeIds.T_void) :
61
			return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, 0);
266
			return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, dimAnnotations, 0);
62
		case (TypeIds.T_boolean) :
267
		case (TypeIds.T_boolean) :
63
			return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, 0);
268
			return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, dimAnnotations, 0);
64
		case (TypeIds.T_char) :
269
		case (TypeIds.T_char) :
65
			return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, 0);
270
			return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, dimAnnotations, 0);
66
		case (TypeIds.T_float) :
271
		case (TypeIds.T_float) :
67
			return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, 0);
272
			return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, dimAnnotations, 0);
68
		case (TypeIds.T_double) :
273
		case (TypeIds.T_double) :
69
			return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, 0);
274
			return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, dimAnnotations, 0);
70
		case (TypeIds.T_byte) :
275
		case (TypeIds.T_byte) :
71
			return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, 0);
276
			return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, dimAnnotations, 0);
72
		case (TypeIds.T_short) :
277
		case (TypeIds.T_short) :
73
			return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, 0);
278
			return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, dimAnnotations, 0);
74
		case (TypeIds.T_int) :
279
		case (TypeIds.T_int) :
75
			return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, 0);
280
			return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, dimAnnotations, 0);
76
		default : //T_long
281
		default : //T_long
77
			return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0);
282
			return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, dimAnnotations, 0);
78
	}
283
	}
79
}
284
}
80
285
286
// JSR308 type annotations...
287
public Annotation[] annotations = null;
288
81
// allows us to trap completion & selection nodes
289
// allows us to trap completion & selection nodes
82
public void aboutToResolve(Scope scope) {
290
public void aboutToResolve(Scope scope) {
83
	// default implementation: do nothing
291
	// default implementation: do nothing
Lines 89-97 Link Here
89
	// only parameterized type references have bounds
297
	// only parameterized type references have bounds
90
}
298
}
91
public abstract TypeReference copyDims(int dim);
299
public abstract TypeReference copyDims(int dim);
300
public abstract TypeReference copyDims(int dim, Annotation[][] annotationsOnDimensions);
92
public int dimensions() {
301
public int dimensions() {
93
	return 0;
302
	return 0;
94
}
303
}
304
public AnnotationContext[] getAllAnnotationContexts(int targetType) {
305
	List allAnnotationContexts = new ArrayList();
306
	AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
307
	this.traverse(collector, (BlockScope) null);
308
	return (AnnotationContext[]) allAnnotationContexts.toArray(new AnnotationContext[allAnnotationContexts.size()]);
309
}
310
/**
311
 * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
312
 * @param targetType
313
 * @param info
314
 * @param allAnnotationContexts
315
 */
316
public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts) {
317
	AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts);
318
	this.traverse(collector, (BlockScope) null);
319
}
320
/**
321
 * info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
322
 * @param targetType
323
 * @param info
324
 * @param allAnnotationContexts
325
 */
326
public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts, Annotation[][] annotationsOnDimensions) {
327
	AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts, annotationsOnDimensions);
328
	this.traverse(collector, (BlockScope) null);
329
	if (annotationsOnDimensions != null) {
330
		for (int i = 0, max = annotationsOnDimensions.length; i < max; i++) {
331
			Annotation[] annotationsOnDimension = annotationsOnDimensions[i];
332
			if (annotationsOnDimension != null) {
333
				for (int j = 0, max2 = annotationsOnDimension.length; j< max2; j++) {
334
					annotationsOnDimension[j].traverse(collector, (BlockScope) null);
335
				}
336
			}
337
		}
338
	}
339
}
340
public void getAllAnnotationContexts(int targetType, int info, int typeIndex, List allAnnotationContexts) {
341
	AnnotationCollector collector = new AnnotationCollector(this, targetType, info, typeIndex, allAnnotationContexts);
342
	this.traverse(collector, (BlockScope) null);
343
}
344
public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
345
	AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
346
	this.traverse(collector, (BlockScope) null);
347
}
348
public Annotation[][] getAnnotationsOnDimensions() {
349
	return null;
350
}
95
351
96
public abstract char[] getLastToken();
352
public abstract char[] getLastToken();
97
353
Lines 158-163 Link Here
158
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
414
			&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
159
		scope.problemReporter().rawTypeReference(this, type);
415
		scope.problemReporter().rawTypeReference(this, type);
160
	}
416
	}
417
	if (this.annotations != null) {
418
		switch(scope.kind) {
419
			case Scope.BLOCK_SCOPE :
420
			case Scope.METHOD_SCOPE :
421
				resolveAnnotations((BlockScope) scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
422
				break;
423
		}
424
	}
425
161
	if (hasError) {
426
	if (hasError) {
162
		// do not store the computed type, keep the problem type instead
427
		// do not store the computed type, keep the problem type instead
163
		return type;
428
		return type;
Lines 168-173 Link Here
168
	return true;
433
	return true;
169
}
434
}
170
435
436
public boolean isParameterizedTypeReference() {
437
	return false;
438
}
171
protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) {
439
protected void reportDeprecatedType(TypeBinding type, Scope scope, int index) {
172
	scope.problemReporter().deprecatedType(type, this, index);
440
	scope.problemReporter().deprecatedType(type, this, index);
173
}
441
}
Lines 208-220 Link Here
208
}
476
}
209
477
210
public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
478
public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
211
    return resolveType(blockScope, true /* check bounds*/);
479
	return resolveType(blockScope, true /* check bounds*/);
212
}
480
}
213
481
214
public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
482
public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
215
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057, circularity is allowed when we are
483
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057, circularity is allowed when we are
216
	// resolving type arguments i.e interface A<T extends C> {}	interface B extends A<D> {}
484
	// resolving type arguments i.e interface A<T extends C> {} interface B extends A<D> {}
217
	// interface D extends C {}	interface C extends B {}
485
	// interface D extends C {} interface C extends B {}
218
	ReferenceBinding ref = classScope.referenceContext.binding;
486
	ReferenceBinding ref = classScope.referenceContext.binding;
219
	boolean pauseHierarchyCheck = false;
487
	boolean pauseHierarchyCheck = false;
220
	try {
488
	try {
Lines 222-228 Link Here
222
			ref.tagBits |= TagBits.PauseHierarchyCheck;
490
			ref.tagBits |= TagBits.PauseHierarchyCheck;
223
			pauseHierarchyCheck = true;
491
			pauseHierarchyCheck = true;
224
		}
492
		}
225
	    return resolveType(classScope);
493
		return resolveType(classScope);
226
	} finally {
494
	} finally {
227
		if (pauseHierarchyCheck) {
495
		if (pauseHierarchyCheck) {
228
			ref.tagBits &= ~TagBits.PauseHierarchyCheck;
496
			ref.tagBits &= ~TagBits.PauseHierarchyCheck;
Lines 233-236 Link Here
233
public abstract void traverse(ASTVisitor visitor, BlockScope scope);
501
public abstract void traverse(ASTVisitor visitor, BlockScope scope);
234
502
235
public abstract void traverse(ASTVisitor visitor, ClassScope scope);
503
public abstract void traverse(ASTVisitor visitor, ClassScope scope);
504
505
protected void resolveAnnotations(BlockScope scope) {
506
	if (this.annotations != null) {
507
		resolveAnnotations(scope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_USE));
508
	}
509
}
236
}
510
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java (-3 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 59-65 Link Here
59
			boundType = scope.kind == Scope.CLASS_SCOPE
59
			boundType = scope.kind == Scope.CLASS_SCOPE
60
					? this.bound.resolveType((ClassScope)scope)
60
					? this.bound.resolveType((ClassScope)scope)
61
					: this.bound.resolveType((BlockScope)scope, true /* check bounds*/);
61
					: this.bound.resolveType((BlockScope)scope, true /* check bounds*/);
62
62
			this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations);
63
			if (boundType == null) {
63
			if (boundType == null) {
64
				return null;
64
				return null;
65
			}
65
			}
Lines 89-94 Link Here
89
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
89
	public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
90
		if (this.bound != null) {
90
		if (this.bound != null) {
91
			this.bound.resolveType(scope, checkBounds);
91
			this.bound.resolveType(scope, checkBounds);
92
			this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations);
92
		}
93
		}
93
		return null;
94
		return null;
94
	}
95
	}
Lines 96-101 Link Here
96
	public TypeBinding resolveType(ClassScope scope) {
97
	public TypeBinding resolveType(ClassScope scope) {
97
		if (this.bound != null) {
98
		if (this.bound != null) {
98
			this.bound.resolveType(scope);
99
			this.bound.resolveType(scope);
100
			this.bits |= (this.bound.bits & ASTNode.HasTypeAnnotations);
99
		}
101
		}
100
		return null;
102
		return null;
101
	}
103
	}
Lines 104-110 Link Here
104
	}
106
	}
105
107
106
	public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
108
	public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
107
	    return internalResolveType(classScope, genericType, rank);
109
		return internalResolveType(classScope, genericType, rank);
108
	}
110
	}
109
111
110
	public void traverse(ASTVisitor visitor, BlockScope scope) {
112
	public void traverse(ASTVisitor visitor, BlockScope scope) {
(-)compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 120-123 Link Here
120
	int ATTR_VARS = 0x4; // LocalVariableTableAttribute
120
	int ATTR_VARS = 0x4; // LocalVariableTableAttribute
121
	int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
121
	int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
122
	int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
122
	int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
123
	int ATTR_TYPE_ANNOTATION = 0x20; // annotation type annotation (jsr 308)
123
}
124
}
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java (+60 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.codegen;
12
13
import org.eclipse.jdt.internal.compiler.ast.Annotation;
14
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
15
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
16
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
17
18
public class AnnotationContext {
19
	public static final int VISIBLE = 0x1;
20
	public static final int INVISIBLE = 0x2;
21
	public Annotation annotation;
22
	public TypeReference typeReference;
23
	public int targetType;
24
	public int info;
25
	public int info2;
26
	public int visibility;
27
	public Annotation[] primaryAnnotations;
28
	public LocalVariableBinding variableBinding;
29
	public Annotation[][] annotationsOnDimensions;
30
	public Wildcard wildcard;
31
32
	public AnnotationContext(
33
			Annotation annotation,
34
			TypeReference typeReference,
35
			int targetType,
36
			Annotation[] primaryAnnotations,
37
			int visibility,
38
			Annotation[][] annotationsOnDimensions) {
39
		this.annotation = annotation;
40
		this.typeReference = typeReference;
41
		this.targetType = targetType;
42
		this.primaryAnnotations = primaryAnnotations;
43
		this.visibility = visibility;
44
		this.annotationsOnDimensions = annotationsOnDimensions;
45
	}
46
47
	public String toString() {
48
		return "AnnotationContext [annotation=" //$NON-NLS-1$
49
				+ this.annotation
50
				+ ", typeReference=" //$NON-NLS-1$
51
				+ this.typeReference
52
				+ ", targetType=" //$NON-NLS-1$
53
				+ this.targetType
54
				+ ", info =" //$NON-NLS-1$
55
				+ this.info
56
				+ ", boundIndex=" //$NON-NLS-1$
57
				+ this.info2
58
				+ "]"; //$NON-NLS-1$
59
	}
60
}
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java (+50 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.codegen;
12
13
public interface AnnotationTargetTypeConstants {
14
	int METHOD_RECEIVER = 0x06;
15
	int METHOD_RECEIVER_GENERIC_OR_ARRAY = 0x07;
16
	int METHOD_RETURN_TYPE = 0x0A;
17
	int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = 0x0B;
18
	int METHOD_PARAMETER = 0x0C;
19
	int METHOD_PARAMETER_GENERIC_OR_ARRAY = 0x0D;
20
	int FIELD = 0x0E;
21
	int FIELD_GENERIC_OR_ARRAY = 0x0F;
22
	int CLASS_TYPE_PARAMETER_BOUND = 0x10;
23
	int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x11;
24
	int METHOD_TYPE_PARAMETER_BOUND = 0x12;
25
	int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = 0x13;
26
	int CLASS_EXTENDS_IMPLEMENTS = 0x14;
27
	int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = 0x15;
28
	int THROWS = 0x16;
29
	int THROWS_GENERIC_OR_ARRAY = 0x17;
30
	int WILDCARD_BOUND = 0x1C;
31
	int WILDCARD_BOUND_GENERIC_OR_ARRAY = 0x1D;
32
	int METHOD_TYPE_PARAMETER = 0x20;
33
	int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x21;
34
	int CLASS_TYPE_PARAMETER = 0x22;
35
	int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = 0x23;
36
	int TYPE_CAST = 0x00;
37
	int TYPE_CAST_GENERIC_OR_ARRAY = 0x01;
38
	int TYPE_INSTANCEOF = 0x02;
39
	int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = 0x03;
40
	int OBJECT_CREATION = 0x04;
41
	int OBJECT_CREATION_GENERIC_OR_ARRAY = 0x05;
42
	int LOCAL_VARIABLE = 0x08;
43
	int LOCAL_VARIABLE_GENERIC_OR_ARRAY = 0x09;
44
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL = 0x18;
45
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = 0x19;
46
	int TYPE_ARGUMENT_METHOD_CALL = 0x1A;
47
	int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = 0x1B;
48
	int CLASS_LITERAL = 0x1E;
49
	int CLASS_LITERAL_GENERIC_OR_ARRAY = 0x1F;
50
}
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java (-1 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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-36 Link Here
33
	final char[] VarargsName = "Varargs".toCharArray(); //$NON-NLS-1$
33
	final char[] VarargsName = "Varargs".toCharArray(); //$NON-NLS-1$
34
	final char[] StackMapName = "StackMap".toCharArray(); //$NON-NLS-1$
34
	final char[] StackMapName = "StackMap".toCharArray(); //$NON-NLS-1$
35
	final char[] MissingTypesName = "MissingTypes".toCharArray(); //$NON-NLS-1$
35
	final char[] MissingTypesName = "MissingTypes".toCharArray(); //$NON-NLS-1$
36
	// jsr308
37
	final char[] RuntimeVisibleTypeAnnotationsName = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
38
	final char[] RuntimeInvisibleTypeAnnotationsName = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
36
}
39
}
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-17 / +58 lines)
Lines 17-27 Link Here
17
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
17
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
18
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
18
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
19
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
19
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
20
import org.eclipse.jdt.internal.compiler.ast.Annotation;
20
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
21
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
21
import org.eclipse.jdt.internal.compiler.ast.Expression;
22
import org.eclipse.jdt.internal.compiler.ast.Expression;
22
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
23
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
23
import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
24
import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
24
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
25
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
26
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
25
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
27
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
26
import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo;
28
import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo;
27
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
29
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
Lines 631-638 Link Here
631
			writeUnsignedShort(this.constantPool.literalIndexForType(ConstantPool.JavaLangBooleanConstantPoolName));
633
			writeUnsignedShort(this.constantPool.literalIndexForType(ConstantPool.JavaLangBooleanConstantPoolName));
632
	}
634
	}
633
}
635
}
634
635
public void checkcast(TypeBinding typeBinding) {
636
public void checkcast(TypeBinding typeBinding) {
637
	this.checkcast(null, typeBinding);
638
}
639
public void checkcast(TypeReference typeReference, TypeBinding typeBinding) {
636
	this.countLabels = 0;
640
	this.countLabels = 0;
637
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
641
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
638
		resizeByteArray();
642
		resizeByteArray();
Lines 641-647 Link Here
641
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_checkcast;
645
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_checkcast;
642
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
646
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
643
}
647
}
644
645
public void d2f() {
648
public void d2f() {
646
	this.countLabels = 0;
649
	this.countLabels = 0;
647
	this.stackDepth--;
650
	this.stackDepth--;
Lines 1690-1700 Link Here
1690
            }
1693
            }
1691
    }
1694
    }
1692
}
1695
}
1693
1696
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1697
	this.generateClassLiteralAccessForType(null, accessedType, syntheticFieldBinding);
1698
}
1694
/**
1699
/**
1695
 * Macro for building a class descriptor object
1700
 * Macro for building a class descriptor object
1696
 */
1701
 */
1697
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1702
public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1698
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
1703
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
1699
		getTYPE(accessedType.id);
1704
		getTYPE(accessedType.id);
1700
		return;
1705
		return;
Lines 1847-1853 Link Here
1847
	invokeClassForName();
1852
	invokeClassForName();
1848
	int paramLength = methodBinding.parameters.length;
1853
	int paramLength = methodBinding.parameters.length;
1849
	this.generateInlinedValue(paramLength);
1854
	this.generateInlinedValue(paramLength);
1850
	newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1855
	newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1851
	if (paramLength > 0) {
1856
	if (paramLength > 0) {
1852
		dup();
1857
		dup();
1853
		for (int i = 0; i < paramLength; i++) {
1858
		for (int i = 0; i < paramLength; i++) {
Lines 1903-1909 Link Here
1903
	this.ldc(String.valueOf(methodBinding.selector));
1908
	this.ldc(String.valueOf(methodBinding.selector));
1904
	int paramLength = methodBinding.parameters.length;
1909
	int paramLength = methodBinding.parameters.length;
1905
	this.generateInlinedValue(paramLength);
1910
	this.generateInlinedValue(paramLength);
1906
	newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1911
	newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
1907
	if (paramLength > 0) {
1912
	if (paramLength > 0) {
1908
		dup();
1913
		dup();
1909
		for (int i = 0; i < paramLength; i++) {
1914
		for (int i = 0; i < paramLength; i++) {
Lines 2413-2419 Link Here
2413
public void generateSyntheticBodyForEnumValueOf(SyntheticMethodBinding methodBinding) {
2418
public void generateSyntheticBodyForEnumValueOf(SyntheticMethodBinding methodBinding) {
2414
	initializeMaxLocals(methodBinding);
2419
	initializeMaxLocals(methodBinding);
2415
	final ReferenceBinding declaringClass = methodBinding.declaringClass;
2420
	final ReferenceBinding declaringClass = methodBinding.declaringClass;
2416
	generateClassLiteralAccessForType(declaringClass, null);
2421
	generateClassLiteralAccessForType(null, declaringClass, null);
2417
	aload_0();
2422
	aload_0();
2418
	invokeJavaLangEnumvalueOf(declaringClass);
2423
	invokeJavaLangEnumvalueOf(declaringClass);
2419
	this.checkcast(declaringClass);
2424
	this.checkcast(declaringClass);
Lines 2439-2445 Link Here
2439
	arraylength();
2444
	arraylength();
2440
	dup();
2445
	dup();
2441
	istore_1();
2446
	istore_1();
2442
	newArray((ArrayBinding) enumArray);
2447
	newArray(null, (ArrayBinding) enumArray);
2443
	dup();
2448
	dup();
2444
	astore_2();
2449
	astore_2();
2445
	iconst_0();
2450
	iconst_0();
Lines 3810-3821 Link Here
3810
	}
3815
	}
3811
	return (chaining & (L_OPTIMIZABLE|L_CANNOT_OPTIMIZE)) == L_OPTIMIZABLE; // check was some standards, and no case/recursive
3816
	return (chaining & (L_OPTIMIZABLE|L_CANNOT_OPTIMIZE)) == L_OPTIMIZABLE; // check was some standards, and no case/recursive
3812
}
3817
}
3813
3818
public void instance_of(TypeBinding typeBinding) {
3819
	this.instance_of(null, typeBinding);
3820
}
3814
/**
3821
/**
3815
 * We didn't call it instanceof because there is a conflit with the
3822
 * We didn't call it instanceof because there is a conflit with the
3816
 * instanceof keyword
3823
 * instanceof keyword
3817
 */
3824
 */
3818
public void instance_of(TypeBinding typeBinding) {
3825
public void instance_of(TypeReference typeReference, TypeBinding typeBinding) {
3819
	this.countLabels = 0;
3826
	this.countLabels = 0;
3820
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
3827
	if (this.classFileOffset + 2 >= this.bCodeStream.length) {
3821
		resizeByteArray();
3828
		resizeByteArray();
Lines 3853-3860 Link Here
3853
		this.stackMax = this.stackDepth;
3860
		this.stackMax = this.stackDepth;
3854
	}
3861
	}
3855
}
3862
}
3856
3863
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass, TypeReference[] typeArguments) {
3857
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) {
3858
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3864
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3859
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
3865
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
3860
		Util.recordNestedType(this.classFile, declaringClass);
3866
		Util.recordNestedType(this.classFile, declaringClass);
Lines 3888-3894 Link Here
3888
								default: 
3894
								default: 
3889
									receiverAndArgsSize++;
3895
									receiverAndArgsSize++;
3890
									break;
3896
									break;
3891
							}    						
3897
							}
3892
						}
3898
						}
3893
					}
3899
					}
3894
				}
3900
				}
Lines 3935-3940 Link Here
3935
			methodBinding.selector, 
3941
			methodBinding.selector, 
3936
			methodBinding.signature(this.classFile));
3942
			methodBinding.signature(this.classFile));
3937
}
3943
}
3944
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) {
3945
	this.invoke(opcode, methodBinding, declaringClass, null);
3946
}
3938
3947
3939
protected void invokeAccessibleObjectSetAccessible() {
3948
protected void invokeAccessibleObjectSetAccessible() {
3940
	// invokevirtual: java.lang.reflect.AccessibleObject.setAccessible(Z)V;
3949
	// invokevirtual: java.lang.reflect.AccessibleObject.setAccessible(Z)V;
Lines 4488-4493 Link Here
4488
			ConstantPool.InternSignature);
4497
			ConstantPool.InternSignature);
4489
}
4498
}
4490
4499
4500
public void invokeStringHashCode() {
4501
	// invokevirtual: java.lang.String.hashCode()
4502
	invoke(
4503
			Opcodes.OPC_invokevirtual,
4504
			1, // receiverAndArgsSize
4505
			1, // return type size
4506
			ConstantPool.JavaLangStringConstantPoolName,
4507
			ConstantPool.HashCode,
4508
			ConstantPool.HashCodeSignature);
4509
}
4510
4511
public void invokeStringEquals() {
4512
	// invokevirtual: java.lang.String.equals()
4513
	invoke(
4514
			Opcodes.OPC_invokevirtual,
4515
			2, // receiverAndArgsSize
4516
			1, // return type size
4517
			ConstantPool.JavaLangStringConstantPoolName,
4518
			ConstantPool.Equals,
4519
			ConstantPool.EqualsSignature);
4520
}
4521
4491
public void invokeStringValueOf(int typeID) {
4522
public void invokeStringValueOf(int typeID) {
4492
	// invokestatic: java.lang.String.valueOf(argumentType)
4523
	// invokestatic: java.lang.String.valueOf(argumentType)
4493
	char[] signature;
4524
	char[] signature;
Lines 5523-5530 Link Here
5523
	this.position++;
5554
	this.position++;
5524
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit;
5555
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_monitorexit;
5525
}
5556
}
5526
5527
public void multianewarray(TypeBinding typeBinding, int dimensions) {
5557
public void multianewarray(TypeBinding typeBinding, int dimensions) {
5558
	this.multianewarray(null, typeBinding, dimensions, null);
5559
}
5560
public void multianewarray(
5561
		TypeReference typeReference,
5562
		TypeBinding typeBinding,
5563
		int dimensions,
5564
		Annotation [][] annotationsOnDimensions) {
5528
	this.countLabels = 0;
5565
	this.countLabels = 0;
5529
	this.stackDepth += (1 - dimensions);
5566
	this.stackDepth += (1 - dimensions);
5530
	if (this.classFileOffset + 3 >= this.bCodeStream.length) {
5567
	if (this.classFileOffset + 3 >= this.bCodeStream.length) {
Lines 5535-5543 Link Here
5535
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
5572
	writeUnsignedShort(this.constantPool.literalIndexForType(typeBinding));
5536
	this.bCodeStream[this.classFileOffset++] = (byte) dimensions;
5573
	this.bCodeStream[this.classFileOffset++] = (byte) dimensions;
5537
}
5574
}
5538
5539
// We didn't call it new, because there is a conflit with the new keyword
5540
public void new_(TypeBinding typeBinding) {
5575
public void new_(TypeBinding typeBinding) {
5576
	this.new_(null, typeBinding);
5577
}
5578
// We didn't call it new, because there is a conflit with the new keyword
5579
public void new_(TypeReference typeReference, TypeBinding typeBinding) {
5541
	this.countLabels = 0;
5580
	this.countLabels = 0;
5542
	this.stackDepth++;
5581
	this.stackDepth++;
5543
	if (this.stackDepth > this.stackMax)
5582
	if (this.stackDepth > this.stackMax)
Lines 5559-5566 Link Here
5559
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_newarray;
5598
	this.bCodeStream[this.classFileOffset++] = Opcodes.OPC_newarray;
5560
	this.bCodeStream[this.classFileOffset++] = (byte) array_Type;
5599
	this.bCodeStream[this.classFileOffset++] = (byte) array_Type;
5561
}
5600
}
5562
5563
public void newArray(ArrayBinding arrayBinding) {
5601
public void newArray(ArrayBinding arrayBinding) {
5602
	this.newArray(null, arrayBinding);
5603
}
5604
public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) {
5564
	TypeBinding component = arrayBinding.elementsType();
5605
	TypeBinding component = arrayBinding.elementsType();
5565
	switch (component.id) {
5606
	switch (component.id) {
5566
		case TypeIds.T_int :
5607
		case TypeIds.T_int :
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 126-131 Link Here
126
    public static final char[] ITERATOR_SIGNATURE = "()Ljava/util/Iterator;".toCharArray(); //$NON-NLS-1$
126
    public static final char[] ITERATOR_SIGNATURE = "()Ljava/util/Iterator;".toCharArray(); //$NON-NLS-1$
127
    public static final char[] Intern = "intern".toCharArray(); //$NON-NLS-1$
127
    public static final char[] Intern = "intern".toCharArray(); //$NON-NLS-1$
128
    public static final char[] InternSignature = GetMessageSignature;
128
    public static final char[] InternSignature = GetMessageSignature;
129
    public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$
130
    public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$; 
131
    public static final char[] Equals = "equals".toCharArray(); //$NON-NLS-1$
132
    public static final char[] EqualsSignature = "(Ljava/lang/Object;)Z".toCharArray(); //$NON-NLS-1$; 
129
    public static final char[] IntIntegerSignature = "(I)Ljava/lang/Integer;".toCharArray(); //$NON-NLS-1$
133
    public static final char[] IntIntegerSignature = "(I)Ljava/lang/Integer;".toCharArray(); //$NON-NLS-1$
130
    public static final char[] INTVALUE_INTEGER_METHOD_NAME = "intValue".toCharArray(); //$NON-NLS-1$
134
    public static final char[] INTVALUE_INTEGER_METHOD_NAME = "intValue".toCharArray(); //$NON-NLS-1$
131
    public static final char[] INTVALUE_INTEGER_METHOD_SIGNATURE = "()I".toCharArray(); //$NON-NLS-1$
135
    public static final char[] INTVALUE_INTEGER_METHOD_SIGNATURE = "()I".toCharArray(); //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java (-2 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
2
 * Copyright (c) 2006, 2011 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 19-24 Link Here
19
19
20
import org.eclipse.jdt.core.compiler.CharOperation;
20
import org.eclipse.jdt.core.compiler.CharOperation;
21
import org.eclipse.jdt.internal.compiler.ClassFile;
21
import org.eclipse.jdt.internal.compiler.ClassFile;
22
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
25
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
Lines 260-266 Link Here
260
/**
261
/**
261
 * Macro for building a class descriptor object
262
 * Macro for building a class descriptor object
262
 */
263
 */
263
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
264
public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
264
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
265
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
265
		getTYPE(accessedType.id);
266
		getTYPE(accessedType.id);
266
		return;
267
		return;
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java (+112 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.codegen;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
16
import org.eclipse.jdt.internal.compiler.ClassFile;
17
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
18
import org.eclipse.jdt.internal.compiler.ast.Annotation;
19
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
20
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
21
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
22
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
23
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
25
26
public class TypeAnnotationCodeStream extends StackMapFrameCodeStream {
27
	public List allTypeAnnotationContexts;
28
29
	public TypeAnnotationCodeStream(ClassFile givenClassFile) {
30
		super(givenClassFile);
31
		this.generateAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
32
		this.allTypeAnnotationContexts = new ArrayList();
33
	}
34
	private void addAnnotationContext(TypeReference typeReference, int info, int targetType, Annotation[][] annotationsOnDimensions) {
35
//		if (this.allTypeAnnotationContexts == null) {
36
//			this.allTypeAnnotationContexts = new ArrayList();
37
//		}
38
		typeReference.getAllAnnotationContexts(targetType, info, this.allTypeAnnotationContexts, annotationsOnDimensions);
39
	}
40
	private void addAnnotationContext(TypeReference typeReference, int info, int targetType) {
41
//		if (this.allTypeAnnotationContexts == null) {
42
//			this.allTypeAnnotationContexts = new ArrayList();
43
//		}
44
		typeReference.getAllAnnotationContexts(targetType, info, this.allTypeAnnotationContexts);
45
	}
46
	private void addAnnotationContext(TypeReference typeReference, int info, int typeIndex, int targetType) {
47
//		if (this.allTypeAnnotationContexts == null) {
48
//			this.allTypeAnnotationContexts = new ArrayList();
49
//		}
50
		typeReference.getAllAnnotationContexts(targetType, info, typeIndex, this.allTypeAnnotationContexts);
51
	}
52
	public void instance_of(TypeReference typeReference, TypeBinding typeBinding) {
53
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
54
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.TYPE_INSTANCEOF);
55
		}
56
		super.instance_of(typeReference, typeBinding);
57
	}
58
	public void multianewarray(
59
			TypeReference typeReference,
60
			TypeBinding typeBinding,
61
			int dimensions,
62
			Annotation [][] annotationsOnDimensions) {
63
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
64
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION, annotationsOnDimensions);
65
		}
66
		super.multianewarray(typeReference, typeBinding, dimensions, annotationsOnDimensions);
67
	}
68
	public void new_(TypeReference typeReference, TypeBinding typeBinding) {
69
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
70
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION);
71
		}
72
		super.new_(typeReference, typeBinding);
73
	}
74
	public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) {
75
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
76
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.OBJECT_CREATION);
77
		}
78
		super.newArray(typeReference, arrayBinding);
79
	}
80
	public void generateClassLiteralAccessForType(TypeReference typeReference, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
81
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
82
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.CLASS_LITERAL);
83
		}
84
		super.generateClassLiteralAccessForType(typeReference, accessedType, syntheticFieldBinding);
85
	}
86
	public void checkcast(TypeReference typeReference, TypeBinding typeBinding) {
87
		if (typeReference != null && (typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
88
			addAnnotationContext(typeReference, this.position, AnnotationTargetTypeConstants.TYPE_CAST);
89
		}
90
		super.checkcast(typeReference, typeBinding);
91
	}
92
	public void reset(ClassFile givenClassFile) {
93
		super.reset(givenClassFile);
94
		this.allTypeAnnotationContexts = new ArrayList();
95
	}
96
	public void init(ClassFile targetClassFile) {
97
		super.init(targetClassFile);
98
		this.allTypeAnnotationContexts = new ArrayList();
99
	}
100
	public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass, TypeReference[] typeArguments) {
101
		if (typeArguments != null) {
102
			int targetType = methodBinding.isConstructor()
103
					? AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL
104
					: AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL;
105
			for (int i = 0, max = typeArguments.length; i < max; i++) {
106
				TypeReference typeArgument = typeArguments[i];
107
				addAnnotationContext(typeArgument, this.position, i, targetType);
108
			}
109
		}
110
		super.invoke(opcode, methodBinding, declaringClass, typeArguments);
111
	}
112
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-2 / +2 lines)
Lines 178-184 Link Here
178
		// attempt to find the enclosing type if it exists in the cache (otherwise - resolve it when requested)
178
		// attempt to find the enclosing type if it exists in the cache (otherwise - resolve it when requested)
179
		this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1, true, null /* could not be missing */); // pretend parameterized to avoid raw
179
		this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1, true, null /* could not be missing */); // pretend parameterized to avoid raw
180
		this.tagBits |= TagBits.MemberTypeMask;   // must be a member type not a top-level or local type
180
		this.tagBits |= TagBits.MemberTypeMask;   // must be a member type not a top-level or local type
181
		this.tagBits |= 	TagBits.HasUnresolvedEnclosingType;
181
		this.tagBits |= TagBits.HasUnresolvedEnclosingType;
182
		if (enclosingType().isStrictfp())
182
		if (enclosingType().isStrictfp())
183
			this.modifiers |= ClassFileConstants.AccStrictfp;
183
			this.modifiers |= ClassFileConstants.AccStrictfp;
184
		if (enclosingType().isDeprecated())
184
		if (enclosingType().isDeprecated())
Lines 286-292 Link Here
286
				for (int i = 0; i < size; i++)
286
				for (int i = 0; i < size; i++)
287
					// attempt to find each member type if it exists in the cache (otherwise - resolve it when requested)
287
					// attempt to find each member type if it exists in the cache (otherwise - resolve it when requested)
288
					this.memberTypes[i] = this.environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false, null /* could not be missing */);
288
					this.memberTypes[i] = this.environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false, null /* could not be missing */);
289
				this.tagBits |= 	TagBits.HasUnresolvedMemberTypes;
289
				this.tagBits |= TagBits.HasUnresolvedMemberTypes;
290
			}
290
			}
291
		}
291
		}
292
292
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java (+2 lines)
Lines 30-35 Link Here
30
	public static final int GENERIC_TYPE = TYPE | ASTNode.Bit12;
30
	public static final int GENERIC_TYPE = TYPE | ASTNode.Bit12;
31
	public static final int TYPE_PARAMETER = TYPE | ASTNode.Bit13;
31
	public static final int TYPE_PARAMETER = TYPE | ASTNode.Bit13;
32
	public static final int INTERSECTION_TYPE = TYPE | ASTNode.Bit14;
32
	public static final int INTERSECTION_TYPE = TYPE | ASTNode.Bit14;
33
	// jsr 308
34
	public static final int TYPE_USE = TYPE | ASTNode.Bit15;
33
35
34
	// Shared binding collections
36
	// Shared binding collections
35
	public static final TypeBinding[] NO_TYPES = new TypeBinding[0];
37
	public static final TypeBinding[] NO_TYPES = new TypeBinding[0];
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 41-46 Link Here
41
	public LocalVariableBinding(char[] name, TypeBinding type, int modifiers, boolean isArgument) {
41
	public LocalVariableBinding(char[] name, TypeBinding type, int modifiers, boolean isArgument) {
42
		super(name, type, modifiers, isArgument ? Constant.NotAConstant : null);
42
		super(name, type, modifiers, isArgument ? Constant.NotAConstant : null);
43
		if (isArgument) this.tagBits |= TagBits.IsArgument;
43
		if (isArgument) this.tagBits |= TagBits.IsArgument;
44
		this.tagBits &= ~TagBits.ForcedToBeRawType;
44
	}
45
	}
45
46
46
	// regular local variable or argument
47
	// regular local variable or argument
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-3 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 719-724 Link Here
719
			parameterBinding.fPackage = unitPackage;
719
			parameterBinding.fPackage = unitPackage;
720
			typeParameter.binding = parameterBinding;
720
			typeParameter.binding = parameterBinding;
721
721
722
			if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
723
				switch(declaringElement.kind()) {
724
					case Binding.METHOD :
725
						MethodBinding methodBinding = (MethodBinding) declaringElement;
726
						AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod();
727
						if (sourceMethod != null) {
728
							sourceMethod.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
729
						}
730
						break;
731
					case Binding.TYPE :
732
						if (declaringElement instanceof SourceTypeBinding) {
733
							SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) declaringElement;
734
							TypeDeclaration typeDeclaration = sourceTypeBinding.scope.referenceContext;
735
							if (typeDeclaration != null) {
736
								typeDeclaration.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
737
							}
738
						}
739
				}
740
			}
722
			// detect duplicates, but keep each variable to reduce secondary errors with instantiating this generic type (assume number of variables is correct)
741
			// detect duplicates, but keep each variable to reduce secondary errors with instantiating this generic type (assume number of variables is correct)
723
			for (int j = 0; j < count; j++) {
742
			for (int j = 0; j < count; j++) {
724
				TypeVariableBinding knownVar = typeVariableBindings[j];
743
				TypeVariableBinding knownVar = typeVariableBindings[j];
Lines 947-954 Link Here
947
			isSuperAccess(); this is used to determine if the discovered field is visible.
966
			isSuperAccess(); this is used to determine if the discovered field is visible.
948
		Only fields defined by the receiverType or its supertypes are answered;
967
		Only fields defined by the receiverType or its supertypes are answered;
949
		a field of an enclosing type will not be found using this API.
968
		a field of an enclosing type will not be found using this API.
950
    	If no visible field is discovered, null is answered.
969
		If no visible field is discovered, null is answered.
951
	 */
970
	*/
952
	public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) {
971
	public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) {
953
		return findField(receiverType, fieldName, invocationSite, needResolve, false);
972
		return findField(receiverType, fieldName, invocationSite, needResolve, false);
954
	}
973
	}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-4 / +4 lines)
Lines 1329-1338 Link Here
1329
	if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
1329
	if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
1330
		return method;
1330
		return method;
1331
1331
1332
	if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
1333
		if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
1334
			method.modifiers |= ClassFileConstants.AccDeprecated;
1335
	}
1336
	if (isViewedAsDeprecated() && !method.isDeprecated())
1332
	if (isViewedAsDeprecated() && !method.isDeprecated())
1337
		method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
1333
		method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
1338
	if (hasRestrictedAccess())
1334
	if (hasRestrictedAccess())
Lines 1464-1469 Link Here
1464
			}
1460
			}
1465
		}
1461
		}
1466
	}
1462
	}
1463
	if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
1464
		if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
1465
			method.modifiers |= ClassFileConstants.AccDeprecated;
1466
	}
1467
	if (foundArgProblem) {
1467
	if (foundArgProblem) {
1468
		methodDecl.binding = null;
1468
		methodDecl.binding = null;
1469
		method.parameters = Binding.NO_PARAMETERS; // see 107004
1469
		method.parameters = Binding.NO_PARAMETERS; // see 107004
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (-2 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 103-113 Link Here
103
	long AnnotationForLocalVariable = ASTNode.Bit42L;
103
	long AnnotationForLocalVariable = ASTNode.Bit42L;
104
	long AnnotationForAnnotationType = ASTNode.Bit43L;
104
	long AnnotationForAnnotationType = ASTNode.Bit43L;
105
	long AnnotationForPackage = ASTNode.Bit44L;
105
	long AnnotationForPackage = ASTNode.Bit44L;
106
	long AnnotationForTypeUse = ASTNode.Bit54L;
107
	long AnnotationForTypeParameter = ASTNode.Bit55L;
106
	long AnnotationTargetMASK = AnnotationTarget
108
	long AnnotationTargetMASK = AnnotationTarget
107
				| AnnotationForType | AnnotationForField
109
				| AnnotationForType | AnnotationForField
108
				| AnnotationForMethod | AnnotationForParameter
110
				| AnnotationForMethod | AnnotationForParameter
109
				| AnnotationForConstructor | AnnotationForLocalVariable
111
				| AnnotationForConstructor | AnnotationForLocalVariable
110
				| AnnotationForAnnotationType | AnnotationForPackage;
112
				| AnnotationForAnnotationType | AnnotationForPackage
113
				| AnnotationForTypeUse | AnnotationForTypeParameter;
111
	// 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention
114
	// 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention
112
	long AnnotationSourceRetention = ASTNode.Bit45L;
115
	long AnnotationSourceRetention = ASTNode.Bit45L;
113
	long AnnotationClassRetention = ASTNode.Bit46L;
116
	long AnnotationClassRetention = ASTNode.Bit46L;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java (-25 / +28 lines)
Lines 40-53 Link Here
40
	char[] CharArray_JAVA_IO_OBJECTSTREAMFIELD = "java.io.ObjectStreamField".toCharArray(); //$NON-NLS-1$
40
	char[] CharArray_JAVA_IO_OBJECTSTREAMFIELD = "java.io.ObjectStreamField".toCharArray(); //$NON-NLS-1$
41
	char[] ANONYM_PREFIX = "new ".toCharArray(); //$NON-NLS-1$
41
	char[] ANONYM_PREFIX = "new ".toCharArray(); //$NON-NLS-1$
42
	char[] ANONYM_SUFFIX = "(){}".toCharArray(); //$NON-NLS-1$
42
	char[] ANONYM_SUFFIX = "(){}".toCharArray(); //$NON-NLS-1$
43
    char[] WILDCARD_NAME = { '?' };
43
	char[] WILDCARD_NAME = { '?' };
44
    char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$
44
	char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$
45
    char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$
45
	char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$
46
    char[] WILDCARD_MINUS = { '-' };
46
	char[] WILDCARD_MINUS = { '-' };
47
    char[] WILDCARD_STAR = { '*' };
47
	char[] WILDCARD_STAR = { '*' };
48
    char[] WILDCARD_PLUS = { '+' };
48
	char[] WILDCARD_PLUS = { '+' };
49
    char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture#".toCharArray(); //$NON-NLS-1$
49
	char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture#".toCharArray(); //$NON-NLS-1$
50
    char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$
50
	char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$
51
	char[] WILDCARD_CAPTURE = { '!' };
51
	char[] WILDCARD_CAPTURE = { '!' };
52
	char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
52
	char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
53
	char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
53
	char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
Lines 59-80 Link Here
59
	char[] BOOLEAN = "boolean".toCharArray(); //$NON-NLS-1$
59
	char[] BOOLEAN = "boolean".toCharArray(); //$NON-NLS-1$
60
	char[] NULL = "null".toCharArray(); //$NON-NLS-1$
60
	char[] NULL = "null".toCharArray(); //$NON-NLS-1$
61
	char[] VOID = "void".toCharArray(); //$NON-NLS-1$
61
	char[] VOID = "void".toCharArray(); //$NON-NLS-1$
62
    char[] VALUE = "value".toCharArray(); //$NON-NLS-1$
62
	char[] VALUE = "value".toCharArray(); //$NON-NLS-1$
63
    char[] VALUES = "values".toCharArray(); //$NON-NLS-1$
63
	char[] VALUES = "values".toCharArray(); //$NON-NLS-1$
64
    char[] VALUEOF = "valueOf".toCharArray(); //$NON-NLS-1$
64
	char[] VALUEOF = "valueOf".toCharArray(); //$NON-NLS-1$
65
    char[] UPPER_SOURCE = "SOURCE".toCharArray(); //$NON-NLS-1$
65
	char[] UPPER_SOURCE = "SOURCE".toCharArray(); //$NON-NLS-1$
66
    char[] UPPER_CLASS = "CLASS".toCharArray(); //$NON-NLS-1$
66
	char[] UPPER_CLASS = "CLASS".toCharArray(); //$NON-NLS-1$
67
    char[] UPPER_RUNTIME = "RUNTIME".toCharArray(); //$NON-NLS-1$
67
	char[] UPPER_RUNTIME = "RUNTIME".toCharArray(); //$NON-NLS-1$
68
	char[] ANNOTATION_PREFIX = "@".toCharArray(); //$NON-NLS-1$
68
	char[] ANNOTATION_PREFIX = "@".toCharArray(); //$NON-NLS-1$
69
	char[] ANNOTATION_SUFFIX = "()".toCharArray(); //$NON-NLS-1$
69
	char[] ANNOTATION_SUFFIX = "()".toCharArray(); //$NON-NLS-1$
70
    char[] TYPE = "TYPE".toCharArray(); //$NON-NLS-1$
70
	char[] TYPE = "TYPE".toCharArray(); //$NON-NLS-1$
71
    char[] UPPER_FIELD = "FIELD".toCharArray(); //$NON-NLS-1$
71
	char[] UPPER_FIELD = "FIELD".toCharArray(); //$NON-NLS-1$
72
    char[] UPPER_METHOD = "METHOD".toCharArray(); //$NON-NLS-1$
72
	char[] UPPER_METHOD = "METHOD".toCharArray(); //$NON-NLS-1$
73
    char[] UPPER_PARAMETER = "PARAMETER".toCharArray(); //$NON-NLS-1$
73
	char[] UPPER_PARAMETER = "PARAMETER".toCharArray(); //$NON-NLS-1$
74
    char[] UPPER_CONSTRUCTOR = "CONSTRUCTOR".toCharArray(); //$NON-NLS-1$
74
	char[] UPPER_CONSTRUCTOR = "CONSTRUCTOR".toCharArray(); //$NON-NLS-1$
75
    char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$
75
	char[] UPPER_LOCAL_VARIABLE = "LOCAL_VARIABLE".toCharArray(); //$NON-NLS-1$
76
    char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$
76
	char[] UPPER_ANNOTATION_TYPE = "ANNOTATION_TYPE".toCharArray(); //$NON-NLS-1$
77
    char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$
77
	char[] UPPER_PACKAGE = "PACKAGE".toCharArray(); //$NON-NLS-1$
78
	// jsr308
79
	char[] TYPE_USE_TARGET  = "TYPE_USE".toCharArray(); //$NON-NLS-1$
80
	char[] TYPE_PARAMETER_TARGET = "TYPE_PARAMETER".toCharArray(); //$NON-NLS-1$
78
81
79
	// Constant compound names
82
	// Constant compound names
80
	char[][] JAVA_LANG = {JAVA, LANG};
83
	char[][] JAVA_LANG = {JAVA, LANG};
Lines 136-144 Link Here
136
	};
139
	};
137
140
138
	// Constraints for generic type argument inference
141
	// Constraints for generic type argument inference
139
    int CONSTRAINT_EQUAL = 0;		// Actual = Formal
142
	int CONSTRAINT_EQUAL = 0;	// Actual = Formal
140
    int CONSTRAINT_EXTENDS = 1;	// Actual << Formal
143
	int CONSTRAINT_EXTENDS = 1;	// Actual << Formal
141
    int CONSTRAINT_SUPER = 2;		// Actual >> Formal
144
	int CONSTRAINT_SUPER = 2;	// Actual >> Formal
142
145
143
	// Constants used to perform bound checks
146
	// Constants used to perform bound checks
144
	int OK = 0;
147
	int OK = 0;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-489 / +1577 lines)
Lines 11-17 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.jdt.internal.compiler.parser;
12
package org.eclipse.jdt.internal.compiler.parser;
13
13
14
import java.io.*;
14
import java.io.BufferedInputStream;
15
import java.io.BufferedWriter;
16
import java.io.File;
17
import java.io.FileWriter;
18
import java.io.IOException;
19
import java.io.InputStream;
15
import java.util.ArrayList;
20
import java.util.ArrayList;
16
import java.util.Collections;
21
import java.util.Collections;
17
import java.util.Iterator;
22
import java.util.Iterator;
Lines 24-37 Link Here
24
import org.eclipse.jdt.core.compiler.InvalidInputException;
29
import org.eclipse.jdt.core.compiler.InvalidInputException;
25
import org.eclipse.jdt.internal.compiler.ASTVisitor;
30
import org.eclipse.jdt.internal.compiler.ASTVisitor;
26
import org.eclipse.jdt.internal.compiler.CompilationResult;
31
import org.eclipse.jdt.internal.compiler.CompilationResult;
27
import org.eclipse.jdt.internal.compiler.ast.*;
32
import org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression;
33
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
34
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
35
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
36
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
37
import org.eclipse.jdt.internal.compiler.ast.Annotation;
38
import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration;
39
import org.eclipse.jdt.internal.compiler.ast.Argument;
40
import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression;
41
import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
42
import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
43
import org.eclipse.jdt.internal.compiler.ast.ArrayReference;
44
import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
45
import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
46
import org.eclipse.jdt.internal.compiler.ast.Assignment;
47
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression;
48
import org.eclipse.jdt.internal.compiler.ast.Block;
49
import org.eclipse.jdt.internal.compiler.ast.BreakStatement;
50
import org.eclipse.jdt.internal.compiler.ast.CaseStatement;
51
import org.eclipse.jdt.internal.compiler.ast.CastExpression;
52
import org.eclipse.jdt.internal.compiler.ast.CharLiteral;
53
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
54
import org.eclipse.jdt.internal.compiler.ast.CombinedBinaryExpression;
55
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
56
import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment;
57
import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
58
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
59
import org.eclipse.jdt.internal.compiler.ast.ContinueStatement;
60
import org.eclipse.jdt.internal.compiler.ast.DoStatement;
61
import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral;
62
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement;
63
import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
64
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
65
import org.eclipse.jdt.internal.compiler.ast.Expression;
66
import org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
67
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
68
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
69
import org.eclipse.jdt.internal.compiler.ast.FloatLiteral;
70
import org.eclipse.jdt.internal.compiler.ast.ForStatement;
71
import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
72
import org.eclipse.jdt.internal.compiler.ast.IfStatement;
73
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
74
import org.eclipse.jdt.internal.compiler.ast.Initializer;
75
import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression;
76
import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
77
import org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue;
78
import org.eclipse.jdt.internal.compiler.ast.Javadoc;
79
import org.eclipse.jdt.internal.compiler.ast.LabeledStatement;
80
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
81
import org.eclipse.jdt.internal.compiler.ast.LongLiteral;
82
import org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue;
83
import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
84
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
85
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
86
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
87
import org.eclipse.jdt.internal.compiler.ast.NameReference;
88
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
89
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
90
import org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression;
91
import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
92
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
93
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
94
import org.eclipse.jdt.internal.compiler.ast.PostfixExpression;
95
import org.eclipse.jdt.internal.compiler.ast.PrefixExpression;
96
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
97
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
98
import org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference;
99
import org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference;
100
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
101
import org.eclipse.jdt.internal.compiler.ast.Reference;
102
import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
103
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
104
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
105
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
106
import org.eclipse.jdt.internal.compiler.ast.Statement;
107
import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
108
import org.eclipse.jdt.internal.compiler.ast.SuperReference;
109
import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
110
import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement;
111
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
112
import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
113
import org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
114
import org.eclipse.jdt.internal.compiler.ast.TryStatement;
115
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
116
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
117
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
118
import org.eclipse.jdt.internal.compiler.ast.UnaryExpression;
119
import org.eclipse.jdt.internal.compiler.ast.WhileStatement;
120
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
28
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
121
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
29
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
122
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
30
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
123
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
31
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
124
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
125
import org.eclipse.jdt.internal.compiler.lookup.Binding;
32
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
126
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
33
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
127
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
34
import org.eclipse.jdt.internal.compiler.lookup.Binding;
35
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
128
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
36
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
129
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
37
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
130
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
Lines 64-74 Link Here
64
	private static final String ERROR_TOKEN = "$error" ; //$NON-NLS-1$
157
	private static final String ERROR_TOKEN = "$error" ; //$NON-NLS-1$
65
	//expression stack
158
	//expression stack
66
	protected final static int ExpressionStackIncrement = 100;
159
	protected final static int ExpressionStackIncrement = 100;
67
160
	
161
	// annotation stack
162
	protected final static int TypeAnnotationStackIncrement = 100;
163
	
68
	protected final static int GenericsStackIncrement = 10;
164
	protected final static int GenericsStackIncrement = 10;
69
165
70
	private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
166
	private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
71
    public static char in_symb[] = null;
167
	public static char in_symb[] = null;
72
	private static final String INVALID_CHARACTER = "Invalid Character" ; //$NON-NLS-1$
168
	private static final String INVALID_CHARACTER = "Invalid Character" ; //$NON-NLS-1$
73
	public static char lhs[] =  null;
169
	public static char lhs[] =  null;
74
170
Lines 786-792 Link Here
786
	protected int[] expressionLengthStack;
882
	protected int[] expressionLengthStack;
787
	protected int expressionPtr;
883
	protected int expressionPtr;
788
	protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
884
	protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
885
	protected int unattachedAnnotationPtr;  // used for figuring out whether some set of annotations are annotating a dimension or not.
789
	public int firstToken ; // handle for multiple parsing goals
886
	public int firstToken ; // handle for multiple parsing goals
887
	
888
	/* jsr308 -- Type annotation management, we now maintain type annotations in a separate stack
889
	   as otherwise they get interspersed with other expressions and some of the code is not prepared
890
	   to handle such interleaving and will look ugly if changed. 
891
	   
892
	   See consumeArrayCreationExpressionWithoutInitializer for example. 
893
	   
894
	   See that annotations gets pushed into expression stack the moment an annotation is discovered and
895
	   get moved to the new type annotations stack only later when the annotation is recognized to be a
896
	   type annotation. Where ambiguities exist (i.e 1.7 annotation occurs in a place sanctioned for an
897
	   1.5 type annotation, the annotation continues to stay in the expression stack, but in these case
898
	   interleaving is not an issue.
899
	*/  
900
	protected int typeAnnotationPtr;
901
	protected int typeAnnotationLengthPtr;
902
	protected Annotation [] typeAnnotationStack = new Annotation[TypeAnnotationStackIncrement];
903
	protected int [] typeAnnotationLengthStack;
790
	// generics management
904
	// generics management
791
	protected int genericsIdentifiersLengthPtr;
905
	protected int genericsIdentifiersLengthPtr;
792
	protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement];
906
	protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement];
Lines 877-882 Link Here
877
	initializeScanner();
991
	initializeScanner();
878
	this.astLengthStack = new int[50];
992
	this.astLengthStack = new int[50];
879
	this.expressionLengthStack = new int[30];
993
	this.expressionLengthStack = new int[30];
994
	this.typeAnnotationLengthStack = new int[30];
880
	this.intStack = new int[50];
995
	this.intStack = new int[50];
881
	this.identifierStack = new char[30][];
996
	this.identifierStack = new char[30][];
882
	this.identifierLengthStack = new int[30];
997
	this.identifierLengthStack = new int[30];
Lines 1194-1199 Link Here
1194
	}
1309
	}
1195
}
1310
}
1196
protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(TypeReference rightSide, int dim) {
1311
protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(TypeReference rightSide, int dim) {
1312
	Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
1197
	int nameSize = this.identifierLengthStack[this.identifierLengthPtr];
1313
	int nameSize = this.identifierLengthStack[this.identifierLengthPtr];
1198
	int tokensSize = nameSize;
1314
	int tokensSize = nameSize;
1199
	if (rightSide instanceof ParameterizedSingleTypeReference) {
1315
	if (rightSide instanceof ParameterizedSingleTypeReference) {
Lines 1249-1255 Link Here
1249
		typeArguments[nameSize - 1] = currentTypeArguments;
1365
		typeArguments[nameSize - 1] = currentTypeArguments;
1250
	}
1366
	}
1251
	this.identifierLengthPtr--;
1367
	this.identifierLengthPtr--;
1252
	return new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions);
1368
	ParameterizedQualifiedTypeReference typeRef = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, annotationsOnDimensions, positions);
1369
	int length;
1370
	if (this.typeAnnotationLengthPtr >= 0 && (length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
1371
		System.arraycopy(
1372
			this.typeAnnotationStack,
1373
			(this.typeAnnotationPtr -= length) + 1,
1374
			typeRef.annotations = new Annotation[length],
1375
			0,
1376
			length);
1377
		typeRef.sourceStart = typeRef.annotations[0].sourceStart;
1378
		typeRef.bits |= ASTNode.HasTypeAnnotations;
1379
	}
1380
	return typeRef;
1253
}
1381
}
1254
protected void concatExpressionLists() {
1382
protected void concatExpressionLists() {
1255
	this.expressionLengthStack[--this.expressionLengthPtr]++;
1383
	this.expressionLengthStack[--this.expressionLengthPtr]++;
Lines 1592-1599 Link Here
1592
	this.expressionLengthPtr -- ;
1720
	this.expressionLengthPtr -- ;
1593
	arrayAllocation.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--];
1721
	arrayAllocation.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--];
1594
1722
1595
	arrayAllocation.type = getTypeReference(0);
1596
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1597
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1723
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1598
	this.expressionPtr -= length ;
1724
	this.expressionPtr -= length ;
1599
	System.arraycopy(
1725
	System.arraycopy(
Lines 1602-1607 Link Here
1602
		arrayAllocation.dimensions = new Expression[length],
1728
		arrayAllocation.dimensions = new Expression[length],
1603
		0,
1729
		0,
1604
		length);
1730
		length);
1731
	Annotation[][] annotationsOnDimensions = getAnnotationsOnDimensions(length);
1732
	arrayAllocation.annotationsOnDimensions = annotationsOnDimensions;
1733
	if (annotationsOnDimensions != null) {
1734
		arrayAllocation.bits |= ASTNode.HasTypeAnnotations;
1735
	}
1736
	arrayAllocation.type = getTypeReference(0);
1737
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1738
1605
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1739
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1606
	if (arrayAllocation.initializer == null) {
1740
	if (arrayAllocation.initializer == null) {
1607
		arrayAllocation.sourceEnd = this.endStatementPosition;
1741
		arrayAllocation.sourceEnd = this.endStatementPosition;
Lines 1616-1623 Link Here
1616
1750
1617
	int length;
1751
	int length;
1618
	ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression();
1752
	ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression();
1619
	arrayAllocation.type = getTypeReference(0);
1620
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1621
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1753
	length = (this.expressionLengthStack[this.expressionLengthPtr--]);
1622
	this.expressionPtr -= length ;
1754
	this.expressionPtr -= length ;
1623
	System.arraycopy(
1755
	System.arraycopy(
Lines 1626-1631 Link Here
1626
		arrayAllocation.dimensions = new Expression[length],
1758
		arrayAllocation.dimensions = new Expression[length],
1627
		0,
1759
		0,
1628
		length);
1760
		length);
1761
	Annotation[][] annotationsOnDimensions = getAnnotationsOnDimensions(length);
1762
	arrayAllocation.annotationsOnDimensions = annotationsOnDimensions;
1763
	if (annotationsOnDimensions != null) {
1764
		arrayAllocation.bits |= ASTNode.HasTypeAnnotations;
1765
	}
1766
	arrayAllocation.type = getTypeReference(0);
1767
	arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
1629
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1768
	arrayAllocation.sourceStart = this.intStack[this.intPtr--];
1630
	if (arrayAllocation.initializer == null) {
1769
	if (arrayAllocation.initializer == null) {
1631
		arrayAllocation.sourceEnd = this.endStatementPosition;
1770
		arrayAllocation.sourceEnd = this.endStatementPosition;
Lines 2021-2027 Link Here
2021
	pushOnAstStack(caseStatement);
2160
	pushOnAstStack(caseStatement);
2022
}
2161
}
2023
protected void consumeCastExpressionLL1() {
2162
protected void consumeCastExpressionLL1() {
2024
	//CastExpression ::= '(' Expression ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
2163
	//CastExpression ::= '(' Name ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
2025
	// Expression is used in order to make the grammar LL1
2164
	// Expression is used in order to make the grammar LL1
2026
2165
2027
	//optimize push/pop
2166
	//optimize push/pop
Lines 2031-2071 Link Here
2031
	this.expressionStack[this.expressionPtr] =
2170
	this.expressionStack[this.expressionPtr] =
2032
		cast = new CastExpression(
2171
		cast = new CastExpression(
2033
			exp=this.expressionStack[this.expressionPtr+1] ,
2172
			exp=this.expressionStack[this.expressionPtr+1] ,
2034
			this.expressionStack[this.expressionPtr]);
2173
			(TypeReference) this.expressionStack[this.expressionPtr]);
2035
	this.expressionLengthPtr -- ;
2174
	this.expressionLengthPtr -- ;
2036
	updateSourcePosition(cast);
2175
	updateSourcePosition(cast);
2037
	cast.sourceEnd=exp.sourceEnd;
2176
	cast.sourceEnd=exp.sourceEnd;
2038
}
2177
}
2178
protected void consumeCastExpressionLL1WithTypeAnnotations() {
2179
	// CastExpression ::= '(' Modifiers Name ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
2180
	// Expression is used in order to make the grammar LL1
2181
2182
	//optimize push/pop
2183
2184
	// pop the expression
2185
	Expression expression = this.expressionStack[this.expressionPtr--];
2186
	this.expressionLengthPtr--;
2187
	// pop the type reference
2188
	TypeReference typeReference = (TypeReference) 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.sourceStart = typeReferenceSourceStart;
2204
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2205
	}
2206
	Expression cast;
2207
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2208
	// pop the two positions for left and right parenthesis 
2209
	updateSourcePosition(cast);
2210
	cast.sourceEnd = expression.sourceEnd;
2211
	if (this.modifiers != ClassFileConstants.AccDefault) {
2212
		problemReporter().invalidLocationForModifiers(typeReference);
2213
	}
2214
	resetModifiers();
2215
}
2039
protected void consumeCastExpressionWithGenericsArray() {
2216
protected void consumeCastExpressionWithGenericsArray() {
2040
	// CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2217
	// CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2041
2218
2042
	Expression exp, cast, castType;
2219
	Expression exp, cast;
2220
	TypeReference castType;
2043
	int end = this.intStack[this.intPtr--];
2221
	int end = this.intStack[this.intPtr--];
2044
2222
2045
	int dim = this.intStack[this.intPtr--];
2223
	int dim = this.intStack[this.intPtr--];
2046
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2224
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2047
2225
2048
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(dim));
2226
	this.expressionStack[this.expressionPtr] = cast =
2227
		new CastExpression(
2228
				exp = this.expressionStack[this.expressionPtr],
2229
				castType = getTypeReference(dim));
2049
	this.intPtr--;
2230
	this.intPtr--;
2050
	castType.sourceEnd = end - 1;
2231
	castType.sourceEnd = end - 1;
2051
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2232
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2052
	cast.sourceEnd = exp.sourceEnd;
2233
	cast.sourceEnd = exp.sourceEnd;
2053
}
2234
}
2235
protected void consumeCastExpressionWithGenericsArrayWithTypeAnnotations() {
2236
	// CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
2237
	int end = this.intStack[this.intPtr--];
2238
	int dim = this.intStack[this.intPtr--];
2239
2240
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2241
	TypeReference typeReference = getTypeReference(dim);
2242
	
2243
	// pop expression
2244
	Expression expression = this.expressionStack[this.expressionPtr--];
2245
	this.expressionLengthPtr--;
2246
2247
	int length;
2248
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2249
		System.arraycopy(
2250
				this.expressionStack,
2251
				(this.expressionPtr -= length) + 1,
2252
				typeReference.annotations = new Annotation[length],
2253
				0,
2254
				length);
2255
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2256
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2257
			typeReferenceSourceStart = this.modifiersSourceStart;
2258
		}
2259
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2260
		typeReference.sourceStart = typeReferenceSourceStart;
2261
	}
2262
	Expression cast;
2263
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2264
	this.intPtr--;
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
}
2054
protected void consumeCastExpressionWithNameArray() {
2273
protected void consumeCastExpressionWithNameArray() {
2055
	// CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2274
	// CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2056
2275
2057
	Expression exp, cast, castType;
2276
	Expression exp;
2277
	Expression cast;
2278
	TypeReference castType;
2058
	int end = this.intStack[this.intPtr--];
2279
	int end = this.intStack[this.intPtr--];
2059
2280
2060
	// handle type arguments
2281
	// handle type arguments
2061
	pushOnGenericsLengthStack(0);
2282
	pushOnGenericsLengthStack(0);
2062
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2283
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2063
2284
2064
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--]));
2285
	this.expressionStack[this.expressionPtr] = cast =
2286
		new CastExpression(
2287
				exp = this.expressionStack[this.expressionPtr],
2288
				castType = getTypeReference(this.intStack[this.intPtr--]));
2065
	castType.sourceEnd = end - 1;
2289
	castType.sourceEnd = end - 1;
2066
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2290
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2067
	cast.sourceEnd = exp.sourceEnd;
2291
	cast.sourceEnd = exp.sourceEnd;
2068
}
2292
}
2293
protected void consumeCastExpressionWithNameArrayWithTypeAnnotations() {
2294
	// CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
2295
2296
	int end = this.intStack[this.intPtr--];
2297
2298
	// handle type arguments
2299
	pushOnGenericsLengthStack(0);
2300
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
2301
2302
	// pop expression
2303
	Expression expression = this.expressionStack[this.expressionPtr--];
2304
	this.expressionLengthPtr--;
2305
	TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]);
2306
2307
	int length;
2308
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2309
		System.arraycopy(
2310
				this.expressionStack,
2311
				(this.expressionPtr -= length) + 1,
2312
				typeReference.annotations = new Annotation[length],
2313
				0,
2314
				length);
2315
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2316
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2317
			typeReferenceSourceStart = this.modifiersSourceStart;
2318
		}
2319
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2320
		typeReference.sourceStart = typeReferenceSourceStart;
2321
	}
2322
	Expression cast;
2323
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2324
	typeReference.sourceEnd = end - 1;
2325
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2326
	cast.sourceEnd = expression.sourceEnd;
2327
	if (this.modifiers != ClassFileConstants.AccDefault) {
2328
		problemReporter().invalidLocationForModifiers(typeReference);
2329
	}
2330
	resetModifiers();
2331
}
2069
protected void consumeCastExpressionWithPrimitiveType() {
2332
protected void consumeCastExpressionWithPrimitiveType() {
2070
	// CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
2333
	// CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
2071
2334
Lines 2073-2100 Link Here
2073
2336
2074
	//optimize the push/pop
2337
	//optimize the push/pop
2075
2338
2076
	Expression exp, cast, castType;
2339
	Expression exp;
2340
	Expression cast;
2341
	TypeReference castType;
2077
	int end = this.intStack[this.intPtr--];
2342
	int end = this.intStack[this.intPtr--];
2078
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--]));
2343
	this.expressionStack[this.expressionPtr] = cast =
2344
		new CastExpression(
2345
				exp = this.expressionStack[this.expressionPtr],
2346
				castType = getTypeReference(this.intStack[this.intPtr--]));
2079
	castType.sourceEnd = end - 1;
2347
	castType.sourceEnd = end - 1;
2080
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2348
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2081
	cast.sourceEnd = exp.sourceEnd;
2349
	cast.sourceEnd = exp.sourceEnd;
2082
}
2350
}
2351
protected void consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations() {
2352
	// CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression
2353
2354
	//this.intStack : posOfLeftParen dim posOfRightParen
2355
	int end = this.intStack[this.intPtr--];
2356
2357
	// pop expression
2358
	Expression expression = this.expressionStack[this.expressionPtr--];
2359
	this.expressionLengthPtr--;
2360
2361
	TypeReference typeReference = getTypeReference(this.intStack[this.intPtr--]);
2362
	int length;
2363
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2364
		System.arraycopy(
2365
				this.expressionStack,
2366
				(this.expressionPtr -= length) + 1,
2367
				typeReference.annotations = new Annotation[length],
2368
				0,
2369
				length);
2370
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2371
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2372
			typeReferenceSourceStart = this.modifiersSourceStart;
2373
		}
2374
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2375
		typeReference.sourceStart = typeReferenceSourceStart;
2376
	}
2377
	
2378
	Expression cast;
2379
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2380
	
2381
	typeReference.sourceEnd = end - 1;
2382
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2383
	cast.sourceEnd = expression.sourceEnd;
2384
	if (this.modifiers != ClassFileConstants.AccDefault) {
2385
		problemReporter().invalidLocationForModifiers(typeReference);
2386
	}
2387
	resetModifiers();
2388
}
2083
protected void consumeCastExpressionWithQualifiedGenericsArray() {
2389
protected void consumeCastExpressionWithQualifiedGenericsArray() {
2084
	// CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2390
	// CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2085
	Expression exp, cast, castType;
2391
	Expression exp;
2392
	Expression cast;
2393
	TypeReference castType;
2086
	int end = this.intStack[this.intPtr--];
2394
	int end = this.intStack[this.intPtr--];
2087
2395
2088
	int dim = this.intStack[this.intPtr--];
2396
	int dim = this.intStack[this.intPtr--];
2089
	TypeReference rightSide = getTypeReference(0);
2397
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2090
2398
2091
	ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
2399
	ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
2092
	this.intPtr--;
2400
	this.intPtr--;
2093
	this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = qualifiedParameterizedTypeReference);
2401
	this.expressionStack[this.expressionPtr] = cast =
2402
		new CastExpression(
2403
				exp = this.expressionStack[this.expressionPtr],
2404
				castType = qualifiedParameterizedTypeReference);
2094
	castType.sourceEnd = end - 1;
2405
	castType.sourceEnd = end - 1;
2095
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2406
	castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2096
	cast.sourceEnd = exp.sourceEnd;
2407
	cast.sourceEnd = exp.sourceEnd;
2097
}
2408
}
2409
protected void consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations() {
2410
	// CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
2411
	int end = this.intStack[this.intPtr--];
2412
2413
	int dim = this.intStack[this.intPtr--];
2414
	// pop expression
2415
	Expression expression = this.expressionStack[this.expressionPtr--];
2416
	this.expressionLengthPtr--;
2417
	
2418
	TypeReference rightSide = getUnannotatedTypeReference(0); // by design the type after . is not annotated.
2419
2420
	ParameterizedQualifiedTypeReference typeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
2421
	this.intPtr--;
2422
	int length;
2423
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
2424
		System.arraycopy(
2425
				this.expressionStack,
2426
				(this.expressionPtr -= length) + 1,
2427
				typeReference.annotations = new Annotation[length],
2428
				0,
2429
				length);
2430
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
2431
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
2432
			typeReferenceSourceStart = this.modifiersSourceStart;
2433
		}
2434
		typeReference.bits |= ASTNode.HasTypeAnnotations;
2435
		typeReference.sourceStart = typeReferenceSourceStart;
2436
	}
2437
	Expression cast;
2438
	pushOnExpressionStack(cast = new CastExpression(expression, typeReference));
2439
	typeReference.sourceEnd = end - 1;
2440
	typeReference.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
2441
	cast.sourceEnd = expression.sourceEnd;
2442
	if (this.modifiers != ClassFileConstants.AccDefault) {
2443
		problemReporter().invalidLocationForModifiers(typeReference);
2444
	}
2445
	resetModifiers();
2446
}
2098
protected void consumeCatches() {
2447
protected void consumeCatches() {
2099
	// Catches ::= Catches CatchClause
2448
	// Catches ::= Catches CatchClause
2100
	optimizedConcatNodeLists();
2449
	optimizedConcatNodeLists();
Lines 2228-2233 Link Here
2228
	TypeReference superClass = getTypeReference(0);
2577
	TypeReference superClass = getTypeReference(0);
2229
	// There is a class declaration on the top of stack
2578
	// There is a class declaration on the top of stack
2230
	TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
2579
	TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
2580
	typeDecl.bits |= (superClass.bits & ASTNode.HasTypeAnnotations);
2231
	typeDecl.superclass = superClass;
2581
	typeDecl.superclass = superClass;
2232
	superClass.bits |= ASTNode.IsSuperType;
2582
	superClass.bits |= ASTNode.IsSuperType;
2233
	typeDecl.bodyStart = typeDecl.superclass.sourceEnd + 1;
2583
	typeDecl.bodyStart = typeDecl.superclass.sourceEnd + 1;
Lines 2249-2256 Link Here
2249
		typeDecl.superInterfaces = new TypeReference[length],
2599
		typeDecl.superInterfaces = new TypeReference[length],
2250
		0,
2600
		0,
2251
		length);
2601
		length);
2252
	for (int i = 0, max = typeDecl.superInterfaces.length; i < max; i++) {
2602
	TypeReference[] superinterfaces = typeDecl.superInterfaces;
2253
		typeDecl.superInterfaces[i].bits |= ASTNode.IsSuperType;
2603
	for (int i = 0, max = superinterfaces.length; i < max; i++) {
2604
		TypeReference typeReference = superinterfaces[i];
2605
		typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations);
2606
		typeReference.bits |= ASTNode.IsSuperType;
2254
	}
2607
	}
2255
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
2608
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
2256
	this.listLength = 0; // reset after having read super-interfaces
2609
	this.listLength = 0; // reset after having read super-interfaces
Lines 2581-2589 Link Here
2581
			}
2934
			}
2582
		}
2935
		}
2583
2936
2584
		if (!this.diet || insideFieldInitializer){
2937
		if (!this.options.ignoreMethodBodies) {
2585
			// add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere.
2938
			if (!this.diet || insideFieldInitializer){
2586
			constructorCall = SuperReference.implicitSuperConstructorCall();
2939
				// add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere.
2940
				constructorCall = SuperReference.implicitSuperConstructorCall();
2941
			}
2587
		}
2942
		}
2588
	}
2943
	}
2589
2944
Lines 2616-2621 Link Here
2616
2971
2617
	AbstractMethodDeclaration method = (AbstractMethodDeclaration)this.astStack[this.astPtr];
2972
	AbstractMethodDeclaration method = (AbstractMethodDeclaration)this.astStack[this.astPtr];
2618
2973
2974
	// jsr308 -- consume receiver annotations
2975
	method.receiverAnnotations = null;
2976
	int length;
2977
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
2978
		System.arraycopy(
2979
				this.typeAnnotationStack,
2980
				(this.typeAnnotationPtr -= length) + 1,
2981
				method.receiverAnnotations = new Annotation[length],
2982
				0,
2983
				length);
2984
		method.bits |= ASTNode.HasTypeAnnotations;
2985
	}
2986
2619
	if (this.currentToken == TokenNameLBRACE){
2987
	if (this.currentToken == TokenNameLBRACE){
2620
		method.bodyStart = this.scanner.currentPosition;
2988
		method.bodyStart = this.scanner.currentPosition;
2621
	}
2989
	}
Lines 2774-2781 Link Here
2774
	pushOnIntStack(this.dimensions);
3142
	pushOnIntStack(this.dimensions);
2775
	this.dimensions = 0;
3143
	this.dimensions = 0;
2776
}
3144
}
3145
2777
protected void consumeDimWithOrWithOutExpr() {
3146
protected void consumeDimWithOrWithOutExpr() {
2778
	// DimWithOrWithOutExpr ::= '[' ']'
3147
	// DimWithOrWithOutExpr ::= '[' ']'   
3148
	// DimWithOrWithOutExpr ::= OneOrMoreAnnotations '[' ']' 
2779
	pushOnExpressionStack(null);
3149
	pushOnExpressionStack(null);
2780
3150
2781
	if(this.currentElement != null && this.currentToken == TokenNameLBRACE) {
3151
	if(this.currentElement != null && this.currentToken == TokenNameLBRACE) {
Lines 2976-2981 Link Here
2976
			localDeclaration.annotations = new Annotation[length],
3346
			localDeclaration.annotations = new Annotation[length],
2977
			0,
3347
			0,
2978
			length);
3348
			length);
3349
		localDeclaration.bits |= ASTNode.HasTypeAnnotations;
2979
	}
3350
	}
2980
	if (hasModifiers) {
3351
	if (hasModifiers) {
2981
		localDeclaration.declarationSourceStart = declarationSourceStart;
3352
		localDeclaration.declarationSourceStart = declarationSourceStart;
Lines 2984-2989 Link Here
2984
		localDeclaration.declarationSourceStart = type.sourceStart;
3355
		localDeclaration.declarationSourceStart = type.sourceStart;
2985
	}
3356
	}
2986
	localDeclaration.type = type;
3357
	localDeclaration.type = type;
3358
	localDeclaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
2987
3359
2988
	ForeachStatement iteratorForStatement =
3360
	ForeachStatement iteratorForStatement =
2989
		new ForeachStatement(
3361
		new ForeachStatement(
Lines 3073-3078 Link Here
3073
	char[] identifierName = this.identifierStack[this.identifierPtr];
3445
	char[] identifierName = this.identifierStack[this.identifierPtr];
3074
	long namePosition = this.identifierPositionStack[this.identifierPtr];
3446
	long namePosition = this.identifierPositionStack[this.identifierPtr];
3075
	int extendedDimension = this.intStack[this.intPtr--];
3447
	int extendedDimension = this.intStack[this.intPtr--];
3448
	// pop any annotations on extended dimensions now, so they don't pollute the base dimensions.
3449
	Annotation [][] annotationsOnExtendedDimensions = extendedDimension == 0 ? null : getAnnotationsOnDimensions(extendedDimension);
3076
	AbstractVariableDeclaration declaration;
3450
	AbstractVariableDeclaration declaration;
3077
	// create the ast node
3451
	// create the ast node
3078
	boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0;
3452
	boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0;
Lines 3105-3110 Link Here
3105
					declaration.annotations = new Annotation[length],
3479
					declaration.annotations = new Annotation[length],
3106
					0,
3480
					0,
3107
					length);
3481
					length);
3482
				declaration.bits |= ASTNode.HasTypeAnnotations;
3108
			}
3483
			}
3109
			type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension
3484
			type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension
3110
			if (declaration.declarationSourceStart == -1) {
3485
			if (declaration.declarationSourceStart == -1) {
Lines 3126-3131 Link Here
3126
					declaration.annotations = new Annotation[length],
3501
					declaration.annotations = new Annotation[length],
3127
					0,
3502
					0,
3128
					length);
3503
					length);
3504
				declaration.bits |= ASTNode.HasTypeAnnotations;
3129
			}
3505
			}
3130
			// Store javadoc only on first declaration as it is the same for all ones
3506
			// Store javadoc only on first declaration as it is the same for all ones
3131
			FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
3507
			FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
Lines 3143-3156 Link Here
3143
		if (annotations != null) {
3519
		if (annotations != null) {
3144
			final int annotationsLength = annotations.length;
3520
			final int annotationsLength = annotations.length;
3145
			System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength);
3521
			System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength);
3522
			declaration.bits |= ASTNode.HasTypeAnnotations;
3146
		}
3523
		}
3147
	}
3524
	}
3148
3525
3149
	if (extendedDimension == 0) {
3526
	if (extendedDimension == 0) {
3150
		declaration.type = type;
3527
		declaration.type = type;
3528
		declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3151
	} else {
3529
	} else {
3152
		int dimension = typeDim + extendedDimension;
3530
		int dimension = typeDim + extendedDimension;
3153
		declaration.type = copyDims(type, dimension);
3531
		Annotation [][] annotationsOnAllDimensions = null;
3532
		Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions();
3533
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
3534
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedDimension, annotationsOnExtendedDimensions); 
3535
			declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3536
		}
3537
		declaration.type = copyDims(type, dimension, annotationsOnAllDimensions);
3154
	}
3538
	}
3155
	this.variablesCounter[this.nestedType]++;
3539
	this.variablesCounter[this.nestedType]++;
3156
	pushOnAstStack(declaration);
3540
	pushOnAstStack(declaration);
Lines 3177-3182 Link Here
3177
		this.lastIgnoredToken = -1;
3561
		this.lastIgnoredToken = -1;
3178
	}
3562
	}
3179
}
3563
}
3564
protected Annotation[][] getMergedAnnotationsOnDimensions(int dims, Annotation[][] annotationsOnDimensions,
3565
														int extendedDims, Annotation[][] annotationsOnExtendedDimensions) {
3566
	
3567
	if (annotationsOnDimensions == null && annotationsOnExtendedDimensions == null)
3568
		return null;
3569
	
3570
	Annotation [][] mergedAnnotations = new Annotation[dims + extendedDims][];
3571
	for (int i = 0; i < dims; i++) {
3572
		if (annotationsOnDimensions != null) {
3573
			mergedAnnotations[i] = annotationsOnDimensions[i];
3574
		} else {
3575
			mergedAnnotations[i] = null;
3576
		}
3577
	}
3578
	for (int i = dims, j = 0; i < dims + extendedDims; i++, j++) {
3579
		if (annotationsOnExtendedDimensions != null) {
3580
			mergedAnnotations[i] = annotationsOnExtendedDimensions[j];
3581
		} else {
3582
			mergedAnnotations[i] = null;
3583
		}
3584
	}
3585
3586
	return mergedAnnotations;
3587
}
3180
protected void consumeEnumBodyNoConstants() {
3588
protected void consumeEnumBodyNoConstants() {
3181
	// nothing to do
3589
	// nothing to do
3182
	// The 0 on the astLengthStack has been pushed by EnumBodyDeclarationsopt
3590
	// The 0 on the astLengthStack has been pushed by EnumBodyDeclarationsopt
Lines 3277-3292 Link Here
3277
   enumConstant.declarationSourceStart = enumConstant.modifiersSourceStart;
3685
   enumConstant.declarationSourceStart = enumConstant.modifiersSourceStart;
3278
3686
3279
	// consume annotations
3687
	// consume annotations
3280
   int length;
3688
	int length;
3281
   if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
3689
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
3282
      System.arraycopy(
3690
		System.arraycopy(
3283
         this.expressionStack,
3691
				this.expressionStack,
3284
         (this.expressionPtr -= length) + 1,
3692
				(this.expressionPtr -= length) + 1,
3285
         enumConstant.annotations = new Annotation[length],
3693
				enumConstant.annotations = new Annotation[length],
3286
         0,
3694
				0,
3287
         length);
3695
				length);
3288
   }
3696
		enumConstant.bits |= ASTNode.HasTypeAnnotations;
3289
   pushOnAstStack(enumConstant);
3697
	}
3698
	pushOnAstStack(enumConstant);
3290
	if (this.currentElement != null){
3699
	if (this.currentElement != null){
3291
		this.lastCheckPoint = enumConstant.sourceEnd + 1;
3700
		this.lastCheckPoint = enumConstant.sourceEnd + 1;
3292
		this.currentElement = this.currentElement.add(enumConstant, 0);
3701
		this.currentElement = this.currentElement.add(enumConstant, 0);
Lines 3793-3802 Link Here
3793
		endOfEllipsis = this.intStack[this.intPtr--];
4202
		endOfEllipsis = this.intStack[this.intPtr--];
3794
	}
4203
	}
3795
	int firstDimensions = this.intStack[this.intPtr--];
4204
	int firstDimensions = this.intStack[this.intPtr--];
3796
	final int typeDimensions = firstDimensions + extendedDimensions;
4205
	TypeReference type = getUnannotatedTypeReference(extendedDimensions);
3797
	TypeReference type = getTypeReference(typeDimensions);
4206
	Annotation [] varArgsAnnotations = null;
4207
	int length;
4208
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
4209
		System.arraycopy(
4210
			this.typeAnnotationStack,
4211
			(this.typeAnnotationPtr -= length) + 1,
4212
			varArgsAnnotations = new Annotation[length],
4213
			0,
4214
			length);
4215
	} 
4216
	final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
4217
4218
	if (typeDimensions != extendedDimensions) {
4219
		// jsr308 type annotations management
4220
		Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
4221
		Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
4222
		Annotation [][] annotationsOnAllDimensions = null;
4223
		if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
4224
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
4225
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
4226
		}
4227
		type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
4228
		type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
4229
	}
3798
	if (isVarArgs) {
4230
	if (isVarArgs) {
3799
		type = copyDims(type, typeDimensions + 1);
3800
		if (extendedDimensions == 0) {
4231
		if (extendedDimensions == 0) {
3801
			type.sourceEnd = endOfEllipsis;
4232
			type.sourceEnd = endOfEllipsis;
3802
		}
4233
		}
Lines 3811-3818 Link Here
3811
			type,
4242
			type,
3812
			this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
4243
			this.intStack[this.intPtr + 1] & ~ClassFileConstants.AccDeprecated); // modifiers
3813
	arg.declarationSourceStart = modifierPositions;
4244
	arg.declarationSourceStart = modifierPositions;
4245
	arg.bits |= (type.bits & ASTNode.HasTypeAnnotations);
3814
	// consume annotations
4246
	// consume annotations
3815
	int length;
4247
	
3816
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
4248
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
3817
		System.arraycopy(
4249
		System.arraycopy(
3818
			this.expressionStack,
4250
			this.expressionStack,
Lines 3820-3825 Link Here
3820
			arg.annotations = new Annotation[length],
4252
			arg.annotations = new Annotation[length],
3821
			0,
4253
			0,
3822
			length);
4254
			length);
4255
		arg.bits |= ASTNode.HasTypeAnnotations;
3823
	}
4256
	}
3824
	pushOnAstStack(arg);
4257
	pushOnAstStack(arg);
3825
4258
Lines 3836-3843 Link Here
3836
				extendedDimensions > 0) {
4269
				extendedDimensions > 0) {
3837
			problemReporter().illegalExtendedDimensions(arg);
4270
			problemReporter().illegalExtendedDimensions(arg);
3838
		}
4271
		}
4272
	} else {
4273
		// The grammar allows trailing annotations in FormalParameter as in 
4274
		// "int @NonNull[] @Misplaced parameter" in order to allow for constructs such as
4275
		// "Object @NonNull[] @Correct ... objects" -- we prune these here.
4276
		if (varArgsAnnotations != null) {
4277
			problemReporter().misplacedTypeAnnotations(varArgsAnnotations[0],
4278
					varArgsAnnotations[varArgsAnnotations.length-1]);
4279
		}
3839
	}
4280
	}
3840
}
4281
}
4282
protected Annotation[][] getAnnotationsOnDimensions(int dimensionsCount) {
4283
	Annotation [][] dimensionsAnnotations = null;
4284
	if (dimensionsCount > 0) {
4285
		for (int i = 0; i < dimensionsCount; i++) {
4286
			Annotation [] annotations = null;
4287
			int length;
4288
			if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
4289
				System.arraycopy(
4290
						this.typeAnnotationStack,
4291
						(this.typeAnnotationPtr -= length) + 1,
4292
						annotations = new Annotation[length],
4293
						0,
4294
						length);
4295
				if (dimensionsAnnotations == null) {
4296
					dimensionsAnnotations = new Annotation[dimensionsCount][];
4297
				}
4298
				dimensionsAnnotations[dimensionsCount - i - 1] = annotations;
4299
			}
4300
		}
4301
	}
4302
	return dimensionsAnnotations;
4303
}
3841
protected void consumeFormalParameterList() {
4304
protected void consumeFormalParameterList() {
3842
	// FormalParameterList ::= FormalParameterList ',' FormalParameter
4305
	// FormalParameterList ::= FormalParameterList ',' FormalParameter
3843
	optimizedConcatNodeLists();
4306
	optimizedConcatNodeLists();
Lines 3848-3862 Link Here
3848
}
4311
}
3849
protected void consumeGenericType() {
4312
protected void consumeGenericType() {
3850
	// nothing to do
4313
	// nothing to do
3851
	// Will be consume by a getTypeRefence call
4314
	// Will be consume by a getTypeReference call
3852
}
4315
}
3853
protected void consumeGenericTypeArrayType() {
4316
protected void consumeGenericTypeArrayType() {
3854
	// nothing to do
4317
	// nothing to do
3855
	// Will be consume by a getTypeRefence call
4318
	// Will be consume by a getTypeReference call
3856
}
4319
}
3857
protected void consumeGenericTypeNameArrayType() {
4320
protected void consumeGenericTypeNameArrayType() {
3858
	// nothing to do
4321
	// nothing to do
3859
	// Will be consume by a getTypeRefence call
4322
	// Will be consume by a getTypeReference call
3860
}
4323
}
3861
protected void consumeImportDeclaration() {
4324
protected void consumeImportDeclaration() {
3862
	// SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
4325
	// SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
Lines 3891-3896 Link Here
3891
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
4354
protected void consumeInsideCastExpressionWithQualifiedGenerics() {
3892
	// InsideCastExpressionWithQualifiedGenerics ::= $empty
4355
	// InsideCastExpressionWithQualifiedGenerics ::= $empty
3893
}
4356
}
4357
protected void consumeInsideCastExpressionWithAnnotatedQualifiedGenerics() {
4358
	// InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty
4359
}
3894
protected void consumeInstanceOfExpression() {
4360
protected void consumeInstanceOfExpression() {
3895
	// RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
4361
	// RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
3896
	//optimize the push/pop
4362
	//optimize the push/pop
Lines 3987-3994 Link Here
3987
		typeDecl.superInterfaces = new TypeReference[length],
4453
		typeDecl.superInterfaces = new TypeReference[length],
3988
		0,
4454
		0,
3989
		length);
4455
		length);
3990
	for (int i = 0, max = typeDecl.superInterfaces.length; i < max; i++) {
4456
	TypeReference[] superinterfaces = typeDecl.superInterfaces;
3991
		typeDecl.superInterfaces[i].bits |= ASTNode.IsSuperType;
4457
	for (int i = 0, max = superinterfaces.length; i < max; i++) {
4458
		TypeReference typeReference = superinterfaces[i];
4459
		typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations);
4460
		typeReference.bits |= ASTNode.IsSuperType;
3992
	}
4461
	}
3993
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
4462
	typeDecl.bodyStart = typeDecl.superInterfaces[length-1].sourceEnd + 1;
3994
	this.listLength = 0; // reset after having read super-interfaces
4463
	this.listLength = 0; // reset after having read super-interfaces
Lines 4348-4355 Link Here
4348
	if (isNotAbstract) {
4817
	if (isNotAbstract) {
4349
		//statements
4818
		//statements
4350
		explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
4819
		explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
4351
		if (!this.options.ignoreMethodBodies) {
4820
		if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
4352
			if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
4821
			if (this.options.ignoreMethodBodies) {
4822
				this.astPtr -= length;
4823
			} else {
4353
				System.arraycopy(
4824
				System.arraycopy(
4354
					this.astStack,
4825
					this.astStack,
4355
					(this.astPtr -= length) + 1,
4826
					(this.astPtr -= length) + 1,
Lines 4357-4365 Link Here
4357
					0,
4828
					0,
4358
					length);
4829
					length);
4359
			}
4830
			}
4360
		} else {
4361
			length = this.astLengthStack[this.astLengthPtr--];
4362
			this.astPtr -= length;
4363
		}
4831
		}
4364
	}
4832
	}
4365
4833
Lines 4444-4449 Link Here
4444
	// MethodHeaderExtendedDims ::= Dimsopt
4912
	// MethodHeaderExtendedDims ::= Dimsopt
4445
	// now we update the returnType of the method
4913
	// now we update the returnType of the method
4446
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
4914
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
4915
	// jsr308 -- consume receiver annotations
4916
	md.receiverAnnotations = null;
4917
	int length;
4918
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
4919
		System.arraycopy(
4920
			this.typeAnnotationStack,
4921
			(this.typeAnnotationPtr -= length) + 1,
4922
			md.receiverAnnotations = new Annotation[length],
4923
			0,
4924
			length);
4925
		md.bits |= ASTNode.HasTypeAnnotations;
4926
	}
4447
	int extendedDims = this.intStack[this.intPtr--];
4927
	int extendedDims = this.intStack[this.intPtr--];
4448
	if(md.isAnnotationMethod()) {
4928
	if(md.isAnnotationMethod()) {
4449
		((AnnotationMethodDeclaration)md).extendedDimensions = extendedDims;
4929
		((AnnotationMethodDeclaration)md).extendedDimensions = extendedDims;
Lines 4452-4458 Link Here
4452
		TypeReference returnType = md.returnType;
4932
		TypeReference returnType = md.returnType;
4453
		md.sourceEnd = this.endPosition;
4933
		md.sourceEnd = this.endPosition;
4454
		int dims = returnType.dimensions() + extendedDims;
4934
		int dims = returnType.dimensions() + extendedDims;
4455
		md.returnType = copyDims(returnType, dims);
4935
		Annotation [][] annotationsOnDimensions = returnType.getAnnotationsOnDimensions();
4936
		Annotation [][] annotationsOnExtendedDimensions = getAnnotationsOnDimensions(extendedDims);
4937
		Annotation [][] annotationsOnAllDimensions = null;
4938
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
4939
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(returnType.dimensions(), annotationsOnDimensions, extendedDims, annotationsOnExtendedDimensions);
4940
		}
4941
		md.returnType = copyDims(returnType, dims, annotationsOnAllDimensions);
4456
		if (this.currentToken == TokenNameLBRACE){
4942
		if (this.currentToken == TokenNameLBRACE){
4457
			md.bodyStart = this.endPosition + 1;
4943
			md.bodyStart = this.endPosition + 1;
4458
		}
4944
		}
Lines 4536-4542 Link Here
4536
	long selectorSource = this.identifierPositionStack[this.identifierPtr--];
5022
	long selectorSource = this.identifierPositionStack[this.identifierPtr--];
4537
	this.identifierLengthPtr--;
5023
	this.identifierLengthPtr--;
4538
	//type
5024
	//type
4539
	md.returnType = getTypeReference(this.intStack[this.intPtr--]);
5025
	TypeReference returnType = getTypeReference(this.intStack[this.intPtr--]);
5026
	md.returnType = returnType;
5027
	md.bits |= (returnType.bits & ASTNode.HasTypeAnnotations);
4540
5028
4541
	// consume type parameters
5029
	// consume type parameters
4542
	int length = this.genericsLengthStack[this.genericsLengthPtr--];
5030
	int length = this.genericsLengthStack[this.genericsLengthPtr--];
Lines 4758-4763 Link Here
4758
protected void consumeModifiers2() {
5246
protected void consumeModifiers2() {
4759
	this.expressionLengthStack[this.expressionLengthPtr - 1] += this.expressionLengthStack[this.expressionLengthPtr--];
5247
	this.expressionLengthStack[this.expressionLengthPtr - 1] += this.expressionLengthStack[this.expressionLengthPtr--];
4760
}
5248
}
5249
5250
protected void consumeOneMoreTypeAnnotation() {
5251
	// OneOrMoreAnnotations ::= OneOrMoreAnnotations Annotation
5252
	this.expressionLengthPtr --;
5253
	Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--];
5254
	pushOnTypeAnnotationStack(annotation);
5255
	this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++;
5256
	if(!this.statementRecoveryActivated &&
5257
			this.options.sourceLevel < ClassFileConstants.JDK1_7 &&
5258
			this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
5259
		problemReporter().invalidUsageOfTypeAnnotations(annotation);
5260
	}
5261
}
5262
protected void consumePotentialNameArrayType () {
5263
	
5264
	// FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId
5265
	// FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId
5266
	// PotentialNameArray -> $empty
5267
	// Dimensions including lack of have been pushed appropriately by action attached to DimsoptAnnotsopt
5268
	pushOnGenericsLengthStack(0); // handle type arguments
5269
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5270
}
5271
4761
protected void consumeNameArrayType() {
5272
protected void consumeNameArrayType() {
4762
	pushOnGenericsLengthStack(0); // handle type arguments
5273
	pushOnGenericsLengthStack(0); // handle type arguments
4763
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5274
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
Lines 4821-4829 Link Here
4821
	}
5332
	}
4822
	this.recordStringLiterals = true;
5333
	this.recordStringLiterals = true;
4823
}
5334
}
4824
protected void consumeOneDimLoop() {
5335
protected void consumeOneDimLoop(boolean expressionStackMayHaveAnnotations) {
4825
	// OneDimLoop ::= '[' ']'
5336
	// OneDimLoop ::= '[' ']'
5337
	// OneDimOrAnnot -> '[' ']'
4826
	this.dimensions++;
5338
	this.dimensions++;
5339
	if (!expressionStackMayHaveAnnotations || this.unattachedAnnotationPtr == -1 ) {
5340
		pushOnTypeAnnotationLengthStack(0); // no annotations for the current dimension.
5341
	} else { 
5342
		this.unattachedAnnotationPtr = -1;	// Leave type annotation stacks they are. 
5343
	}
5344
}
5345
protected void consumeOneDimLoopWithAnnotations() {
5346
	// OneDimLoop ::= OneOrMoreAnnotations '[' ']'
5347
	this.dimensions++;
5348
	// Top of expression stack contains annotations of length specified
5349
	// by top of expression length stack that apply to this dimension.
4827
}
5350
}
4828
protected void consumeOnlySynchronized() {
5351
protected void consumeOnlySynchronized() {
4829
	// OnlySynchronized ::= 'synchronized'
5352
	// OnlySynchronized ::= 'synchronized'
Lines 4993-4999 Link Here
4993
	pushOnGenericsLengthStack(0);
5516
	pushOnGenericsLengthStack(0);
4994
5517
4995
	pushOnExpressionStack(
5518
	pushOnExpressionStack(
4996
		new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
5519
		new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(this.intStack[this.intPtr--])));
5520
}
5521
protected void consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations() {
5522
	// PrimaryNoNewArray ::= Modifiers Name Dims '.' 'class'
5523
	this.intPtr--; // remove the class start position
5524
5525
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5526
	pushOnGenericsLengthStack(0);
5527
5528
	int classTokenSourceEnd = this.intStack[this.intPtr--];
5529
	TypeReference typeReference = getUnannotatedTypeReference(this.intStack[this.intPtr--]);
5530
	int length;
5531
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5532
		System.arraycopy(
5533
				this.expressionStack,
5534
				(this.expressionPtr -= length) + 1,
5535
				typeReference.annotations = new Annotation[length],
5536
				0,
5537
				length);
5538
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5539
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5540
			typeReferenceSourceStart = this.modifiersSourceStart;
5541
		}
5542
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5543
		typeReference.sourceStart = typeReferenceSourceStart;
5544
	}
5545
	pushOnExpressionStack(new ClassLiteralAccess(classTokenSourceEnd, typeReference));
5546
	if (this.modifiers != ClassFileConstants.AccDefault) {
5547
		problemReporter().invalidLocationForModifiers(typeReference);
5548
	}
5549
	resetModifiers();
4997
}
5550
}
4998
protected void consumePrimaryNoNewArrayName() {
5551
protected void consumePrimaryNoNewArrayName() {
4999
	// PrimaryNoNewArray ::= Name '.' 'class'
5552
	// PrimaryNoNewArray ::= Name '.' 'class'
Lines 5002-5017 Link Here
5002
	// handle type arguments
5555
	// handle type arguments
5003
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5556
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5004
	pushOnGenericsLengthStack(0);
5557
	pushOnGenericsLengthStack(0);
5005
	TypeReference typeReference = getTypeReference(0);
5558
	TypeReference typeReference = getUnannotatedTypeReference(0); // TODO (Srikanth) needs fix
5006
5559
5007
	pushOnExpressionStack(
5560
	pushOnExpressionStack(
5008
		new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
5561
		new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
5009
}
5562
}
5563
protected void consumePrimaryNoNewArrayNameWithTypeAnnotations() {
5564
	// PrimaryNoNewArray ::= Modifiers Name '.' 'class'
5565
	this.intPtr--; // remove the class start position
5566
5567
	// handle type arguments
5568
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5569
	pushOnGenericsLengthStack(0);
5570
	TypeReference typeReference = getUnannotatedTypeReference(0); // TODO (Srikanth) needs fix
5571
	int length;
5572
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5573
		System.arraycopy(
5574
				this.expressionStack,
5575
				(this.expressionPtr -= length) + 1,
5576
				typeReference.annotations = new Annotation[length],
5577
				0,
5578
				length);
5579
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5580
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5581
			typeReferenceSourceStart = this.modifiersSourceStart;
5582
		}
5583
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5584
		typeReference.sourceStart = typeReferenceSourceStart;
5585
	}
5586
5587
	pushOnExpressionStack(new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
5588
	if (this.modifiers != ClassFileConstants.AccDefault) {
5589
		problemReporter().invalidLocationForModifiers(typeReference);
5590
	}
5591
	resetModifiers();
5592
}
5010
protected void consumePrimaryNoNewArrayNameSuper() {
5593
protected void consumePrimaryNoNewArrayNameSuper() {
5011
	// PrimaryNoNewArray ::= Name '.' 'super'
5594
	// PrimaryNoNewArray ::= Name '.' 'super'
5012
	// handle type arguments
5595
	// handle type arguments
5013
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5596
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5014
	pushOnGenericsLengthStack(0);
5597
	pushOnGenericsLengthStack(0);
5598
	pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here.
5015
	TypeReference typeReference = getTypeReference(0);
5599
	TypeReference typeReference = getTypeReference(0);
5016
5600
5017
	pushOnExpressionStack(
5601
	pushOnExpressionStack(
Lines 5025-5031 Link Here
5025
	// handle type arguments
5609
	// handle type arguments
5026
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5610
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
5027
	pushOnGenericsLengthStack(0); // handle type arguments
5611
	pushOnGenericsLengthStack(0); // handle type arguments
5028
5612
	pushOnTypeAnnotationLengthStack(0); // javac complains on annotations here.
5029
	TypeReference typeReference = getTypeReference(0);
5613
	TypeReference typeReference = getTypeReference(0);
5030
5614
5031
	pushOnExpressionStack(
5615
	pushOnExpressionStack(
Lines 5038-5050 Link Here
5038
	// PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
5622
	// PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
5039
	this.intPtr--; // remove the class start position
5623
	this.intPtr--; // remove the class start position
5040
	pushOnExpressionStack(
5624
	pushOnExpressionStack(
5041
		new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
5625
		new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(this.intStack[this.intPtr--])));
5626
}
5627
protected void consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations() {
5628
	// PrimaryNoNewArray ::= Modifiers PrimitiveType Dims '.' 'class'
5629
	this.intPtr--; // remove the class start position
5630
	int classTokeSourceEnd = this.intStack[this.intPtr--];
5631
	TypeReference typeReference = getUnannotatedTypeReference(this.intStack[this.intPtr--]);
5632
	int length;
5633
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5634
		System.arraycopy(
5635
				this.expressionStack,
5636
				(this.expressionPtr -= length) + 1,
5637
				typeReference.annotations = new Annotation[length],
5638
				0,
5639
				length);
5640
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5641
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5642
			typeReferenceSourceStart = this.modifiersSourceStart;
5643
		}
5644
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5645
		typeReference.sourceStart = typeReferenceSourceStart;
5646
	}
5647
	pushOnExpressionStack(new ClassLiteralAccess(classTokeSourceEnd, typeReference));
5648
	if (this.modifiers != ClassFileConstants.AccDefault) {
5649
		problemReporter().invalidLocationForModifiers(typeReference);
5650
	}
5651
	resetModifiers();
5042
}
5652
}
5043
protected void consumePrimaryNoNewArrayPrimitiveType() {
5653
protected void consumePrimaryNoNewArrayPrimitiveType() {
5044
	// PrimaryNoNewArray ::= PrimitiveType '.' 'class'
5654
	// PrimaryNoNewArray ::= PrimitiveType '.' 'class'
5045
	this.intPtr--; // remove the class start position
5655
	this.intPtr--; // remove the class start position
5046
	pushOnExpressionStack(
5656
	pushOnExpressionStack(
5047
		new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(0)));
5657
		new ClassLiteralAccess(this.intStack[this.intPtr--], getUnannotatedTypeReference(0)));
5658
}
5659
protected void consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations() {
5660
	// PrimaryNoNewArray ::= Modifiers PrimitiveType '.' 'class'
5661
	this.intPtr--; // remove the class start position
5662
	int classTokenSourceEnd = this.intStack[this.intPtr--];
5663
	TypeReference typeReference = getUnannotatedTypeReference(0);
5664
	int length;
5665
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
5666
		System.arraycopy(
5667
				this.expressionStack,
5668
				(this.expressionPtr -= length) + 1,
5669
				typeReference.annotations = new Annotation[length],
5670
				0,
5671
				length);
5672
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
5673
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
5674
			typeReferenceSourceStart = this.modifiersSourceStart;
5675
		}
5676
		typeReference.bits |= ASTNode.HasTypeAnnotations;
5677
		typeReference.sourceStart = typeReferenceSourceStart;
5678
	}
5679
	pushOnExpressionStack(new ClassLiteralAccess(classTokenSourceEnd, typeReference));
5680
	if (this.modifiers != ClassFileConstants.AccDefault) {
5681
		problemReporter().invalidLocationForModifiers(typeReference);
5682
	}
5683
	resetModifiers();
5048
}
5684
}
5049
protected void consumePrimaryNoNewArrayThis() {
5685
protected void consumePrimaryNoNewArrayThis() {
5050
	// PrimaryNoNewArray ::= 'this'
5686
	// PrimaryNoNewArray ::= 'this'
Lines 5160-6843 Link Here
5160
	// PushRPAREN ::= ')'
5796
	// PushRPAREN ::= ')'
5161
	pushOnIntStack(this.rParenPos);
5797
	pushOnIntStack(this.rParenPos);
5162
}
5798
}
5799
protected void consumeUnannotatedType() {
5800
	/* We go through some song & dance here to get the type annotations stacks
5801
	   to reflect the fact that this type was unannotated. Using a dummy non-terminal
5802
	   with an empty rhs leads to conflicts in many places :-(
5803
	*/
5804
	pushOnTypeAnnotationLengthStack(0); // either done or else made room.
5805
	int dims = this.intStack[this.intPtr];
5806
	if (dims != 0) {
5807
		System.arraycopy(
5808
				this.typeAnnotationLengthStack,
5809
				this.typeAnnotationLengthPtr - dims,
5810
				this.typeAnnotationLengthStack,
5811
				this.typeAnnotationLengthPtr - dims + 1,
5812
				dims);
5813
		this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims] = 0; // tag type as unannotated
5814
	}
5815
}
5816
protected void consumeAnnotatedType() {
5817
	/* We go through some song & dance here to get the type annotations stacks
5818
	   to reflect the fact that this type was unannotated. Using a dummy non-terminal
5819
	   with an empty rhs leads to conflicts in many places :-(
5820
	*/
5821
	int dims = this.intStack[this.intPtr];
5822
	if (dims != 0) {
5823
		int counter = 0;
5824
		for (int i = 0; i < dims; i++) {
5825
			// we count existing dimensions with annotations
5826
			counter += this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1 + i];
5827
		}
5828
		System.arraycopy(
5829
				this.typeAnnotationLengthStack,
5830
				this.typeAnnotationLengthPtr - dims + 1,
5831
				this.typeAnnotationLengthStack,
5832
				this.typeAnnotationLengthPtr - dims + 2,
5833
				dims);
5834
		int length = this.expressionLengthStack[this.expressionLengthPtr--];
5835
		this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr - dims + 1] = length;
5836
		int typeAnnotationStackLength = this.typeAnnotationStack.length;
5837
		if (this.typeAnnotationPtr + counter + length >= typeAnnotationStackLength) {
5838
			System.arraycopy(
5839
					this.typeAnnotationStack,
5840
					0,
5841
					this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement],
5842
					0,
5843
					typeAnnotationStackLength);
5844
		}
5845
		System.arraycopy(
5846
				this.typeAnnotationStack,
5847
				this.typeAnnotationPtr - counter + 1,
5848
				this.typeAnnotationStack,
5849
				this.typeAnnotationPtr - counter + 1 + length,
5850
				counter);
5851
		System.arraycopy(
5852
				this.expressionStack,
5853
				(this.expressionPtr -= length) + 1,
5854
				this.typeAnnotationStack,
5855
				this.typeAnnotationPtr - counter + 1,
5856
				length);
5857
		this.typeAnnotationPtr += length;
5858
		this.typeAnnotationLengthPtr++;
5859
	} else {
5860
		int length = this.expressionLengthStack[this.expressionLengthPtr--];
5861
		int typeAnnotationStackLength = this.typeAnnotationStack.length;
5862
		if (this.typeAnnotationPtr + length >= typeAnnotationStackLength) {
5863
			System.arraycopy(
5864
					this.typeAnnotationStack,
5865
					0,
5866
					this.typeAnnotationStack = new Annotation[typeAnnotationStackLength + TypeAnnotationStackIncrement],
5867
					0,
5868
					typeAnnotationStackLength);
5869
		}
5870
		System.arraycopy(
5871
				this.expressionStack,
5872
				(this.expressionPtr -= length) + 1,
5873
				this.typeAnnotationStack,
5874
				this.typeAnnotationPtr + 1,
5875
				length);
5876
		this.typeAnnotationPtr += length;
5877
		pushOnTypeAnnotationLengthStack(length);
5878
	}
5879
//	if (this.modifiers != ClassFileConstants.AccDefault) {
5880
//		problemReporter().invalidLocationForModifiers(typeReference);
5881
//	}
5882
//	resetModifiers();
5883
}
5884
protected void consumeTypeAnnotation (boolean markAsUnattached) {
5885
	if(!this.statementRecoveryActivated &&
5886
			this.options.sourceLevel < ClassFileConstants.JDK1_7 &&
5887
			this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
5888
		problemReporter().invalidUsageOfTypeAnnotations((Annotation) this.expressionStack[this.expressionPtr]);
5889
	}
5890
	this.expressionLengthPtr --;
5891
	Annotation annotation = (Annotation) this.expressionStack[this.expressionPtr--];
5892
	pushOnTypeAnnotationStack(annotation);
5893
	if (markAsUnattached) {
5894
		if (this.unattachedAnnotationPtr == -1) {
5895
			this.unattachedAnnotationPtr = this.typeAnnotationPtr;
5896
		} else {
5897
			this.typeAnnotationLengthStack[--this.typeAnnotationLengthPtr]++;
5898
		}
5899
	} 
5900
}
5901
protected void consumeDimsWithTrailingAnnotsopt() {
5902
	// DimsoptAnnotsopt -> DimsAnnotLoop
5903
	pushOnIntStack(this.dimensions);
5904
	this.dimensions = 0;
5905
	if (this.unattachedAnnotationPtr == -1) {
5906
		pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg)
5907
	} else {
5908
		this.unattachedAnnotationPtr = -1;  // reset this and leave the annotation stacks as they are.
5909
	}
5910
}
5911
protected void consumeZeroTypeAnnotations(boolean shouldPush) {
5912
	if (shouldPush) {
5913
		pushOnTypeAnnotationLengthStack(0);
5914
	} else {
5915
		this.typeAnnotationLengthPtr --; // pop the 0 from the length stack
5916
	}
5917
}
5918
protected void consumeEmptyDimsoptAnnotsopt() {
5919
	// DimsoptAnnotsopt ::= $empty
5920
	pushOnIntStack(0);  // signal a non array
5921
	pushOnTypeAnnotationLengthStack(0); // no trailing annotations (receiver/vararg)
5922
}
5923
protected void consumeRightParenForUnannotatedTypeCast() {
5924
	consumeUnannotatedType();
5925
	// PushRPAREN ::= ')'
5926
	pushOnIntStack(this.rParenPos);
5927
}
5928
protected void consumeRightParenForNameUnannotatedTypeCast() {
5929
	pushOnIntStack(0);  // signal a non array
5930
	consumeUnannotatedType();
5931
	// remove the fake dimension
5932
	this.intPtr--;
5933
	// PushRPAREN ::= ')'
5934
	pushOnIntStack(this.rParenPos);
5935
}
5936
protected void consumeRightParenForAnnotatedTypeCast() {
5937
	consumeUnannotatedType();
5938
	// PushRPAREN ::= ')'
5939
	pushOnIntStack(this.rParenPos);
5940
}
5941
protected void consumeRightParenForNameAndAnnotatedTypeCast() {
5942
	// push a zero for dimensions
5943
	pushOnIntStack(0);
5944
	consumeUnannotatedType();
5945
	// remove the fake dimension
5946
	this.intPtr--;
5947
	// PushRPAREN ::= ')'
5948
	pushOnIntStack(this.rParenPos);
5949
}
5163
// This method is part of an automatic generation : do NOT edit-modify  
5950
// This method is part of an automatic generation : do NOT edit-modify  
5164
protected void consumeRule(int act) {
5951
protected void consumeRule(int act) {
5165
  switch ( act ) {
5952
  switch ( act ) {
5166
    case 30 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); }  //$NON-NLS-1$
5953
    case 32 : if (DEBUG) { System.out.println("Type ::= TypeInternal"); }  //$NON-NLS-1$
5954
		    consumeUnannotatedType();   
5955
			break;
5956
 
5957
    case 34 : if (DEBUG) { System.out.println("Type0 ::= TypeInternal"); }  //$NON-NLS-1$
5958
		    consumeUnannotatedType();   
5959
			break;
5960
 
5961
    case 35 : if (DEBUG) { System.out.println("TypeInternal ::= PrimitiveType"); }  //$NON-NLS-1$
5167
		    consumePrimitiveType();  
5962
		    consumePrimitiveType();  
5168
			break;
5963
			break;
5169
 
5964
 
5170
    case 44 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); }  //$NON-NLS-1$
5965
    case 49 : if (DEBUG) { System.out.println("ReferenceType ::= ReferenceType0"); }  //$NON-NLS-1$
5966
		    consumeUnannotatedType();   
5967
			break;
5968
 
5969
    case 50 : if (DEBUG) { System.out.println("ReferenceType ::= Modifiers ReferenceType0"); }  //$NON-NLS-1$
5970
		    consumeAnnotatedType();   
5971
			break;
5972
 
5973
    case 51 : if (DEBUG) { System.out.println("ReferenceType0 ::= ClassOrInterfaceType0"); }  //$NON-NLS-1$
5171
		    consumeReferenceType();   
5974
		    consumeReferenceType();   
5172
			break;
5975
			break;
5173
 
5976
 
5174
    case 48 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); }  //$NON-NLS-1$
5977
    case 53 : if (DEBUG) { System.out.println("Annotationsopt ::="); }  //$NON-NLS-1$
5978
		    consumeZeroTypeAnnotations(true);  
5979
			break;
5980
 
5981
    case 58 : if (DEBUG) { System.out.println("ClassOrInterface ::= ClassOrInterface0"); }  //$NON-NLS-1$
5982
		    consumeZeroTypeAnnotations(true);  
5983
			break;
5984
 
5985
    case 59 : if (DEBUG) { System.out.println("ClassOrInterface0 ::= Name"); }  //$NON-NLS-1$
5175
		    consumeClassOrInterfaceName();   
5986
		    consumeClassOrInterfaceName();   
5176
			break;
5987
			break;
5177
 
5988
 
5178
    case 49 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); }  //$NON-NLS-1$
5989
    case 61 : if (DEBUG) { System.out.println("PopZeroTypeAnnotations ::="); }  //$NON-NLS-1$
5179
		    consumeClassOrInterface();   
5990
		    consumeZeroTypeAnnotations(false);  
5180
			break;
5991
			break;
5181
 
5992
 
5182
    case 50 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); }  //$NON-NLS-1$
5993
    case 62 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments..."); }  //$NON-NLS-1$
5183
		    consumeGenericType();   
5994
		    consumeGenericType();   
5184
			break;
5995
			break;
5185
 
5996
 
5186
    case 51 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); }  //$NON-NLS-1$
5997
    case 63 : if (DEBUG) { System.out.println("GenericTypeDotName ::= GenericType DOT Name"); }  //$NON-NLS-1$
5187
		    consumeArrayTypeWithTypeArgumentsName();   
5998
		    consumeClassOrInterface();   
5188
			break;
5999
			break;
5189
 
6000
 
5190
    case 52 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); }  //$NON-NLS-1$
6001
    case 65 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); }  //$NON-NLS-1$
5191
		    consumePrimitiveArrayType();   
6002
		    consumePrimitiveArrayType();   
5192
			break;
6003
			break;
5193
 
6004
 
5194
    case 53 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); }  //$NON-NLS-1$
6005
    case 66 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); }  //$NON-NLS-1$
5195
		    consumeNameArrayType();   
6006
		    consumeNameArrayType();   
5196
			break;
6007
			break;
5197
 
6008
 
5198
    case 54 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); }  //$NON-NLS-1$
6009
    case 67 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); }  //$NON-NLS-1$
5199
		    consumeGenericTypeNameArrayType();   
6010
		    consumeGenericTypeNameArrayType();   
5200
			break;
6011
			break;
5201
 
6012
 
5202
    case 55 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); }  //$NON-NLS-1$
6013
    case 68 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); }  //$NON-NLS-1$
5203
		    consumeGenericTypeArrayType();   
6014
		    consumeGenericTypeArrayType();   
5204
			break;
6015
			break;
5205
 
6016
 
5206
    case 60 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); }  //$NON-NLS-1$
6017
    case 73 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); }  //$NON-NLS-1$
5207
		    consumeQualifiedName();  
6018
		    consumeQualifiedName();  
5208
			break;
6019
			break;
5209
 
6020
 
5210
    case 61 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); }  //$NON-NLS-1$
6021
    case 74 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); }  //$NON-NLS-1$
5211
		    consumeCompilationUnit();  
6022
		    consumeCompilationUnit();  
5212
			break;
6023
			break;
5213
 
6024
 
5214
    case 62 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); }  //$NON-NLS-1$
6025
    case 75 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); }  //$NON-NLS-1$
5215
		    consumeInternalCompilationUnit();  
6026
		    consumeInternalCompilationUnit();  
5216
			break;
6027
			break;
5217
 
6028
 
5218
    case 63 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
6029
    case 76 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
5219
		    consumeInternalCompilationUnit();  
6030
		    consumeInternalCompilationUnit();  
5220
			break;
6031
			break;
5221
 
6032
 
5222
    case 64 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
6033
    case 77 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
5223
		    consumeInternalCompilationUnitWithTypes();  
6034
		    consumeInternalCompilationUnitWithTypes();  
5224
			break;
6035
			break;
5225
 
6036
 
5226
    case 65 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
6037
    case 78 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); }  //$NON-NLS-1$
5227
		    consumeInternalCompilationUnitWithTypes();  
6038
		    consumeInternalCompilationUnitWithTypes();  
5228
			break;
6039
			break;
5229
 
6040
 
5230
    case 66 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
6041
    case 79 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
5231
		    consumeInternalCompilationUnit();  
6042
		    consumeInternalCompilationUnit();  
5232
			break;
6043
			break;
5233
 
6044
 
5234
    case 67 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); }  //$NON-NLS-1$
6045
    case 80 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); }  //$NON-NLS-1$
5235
		    consumeInternalCompilationUnitWithTypes();  
6046
		    consumeInternalCompilationUnitWithTypes();  
5236
			break;
6047
			break;
5237
 
6048
 
5238
    case 68 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
6049
    case 81 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); }  //$NON-NLS-1$
5239
		    consumeInternalCompilationUnitWithTypes();  
6050
		    consumeInternalCompilationUnitWithTypes();  
5240
			break;
6051
			break;
5241
 
6052
 
5242
    case 69 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); }  //$NON-NLS-1$
6053
    case 82 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); }  //$NON-NLS-1$
5243
		    consumeEmptyInternalCompilationUnit();  
6054
		    consumeEmptyInternalCompilationUnit();  
5244
			break;
6055
			break;
5245
 
6056
 
5246
    case 70 : if (DEBUG) { System.out.println("ReduceImports ::="); }  //$NON-NLS-1$
6057
    case 83 : if (DEBUG) { System.out.println("ReduceImports ::="); }  //$NON-NLS-1$
5247
		    consumeReduceImports();  
6058
		    consumeReduceImports();  
5248
			break;
6059
			break;
5249
 
6060
 
5250
    case 71 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); }  //$NON-NLS-1$
6061
    case 84 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); }  //$NON-NLS-1$
5251
		    consumeEnterCompilationUnit();  
6062
		    consumeEnterCompilationUnit();  
5252
			break;
6063
			break;
5253
 
6064
 
5254
    case 87 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN..."); }  //$NON-NLS-1$
6065
    case 103 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN..."); }  //$NON-NLS-1$
5255
		    consumeCatchHeader();  
6066
		    consumeCatchHeader();  
5256
			break;
6067
			break;
5257
 
6068
 
5258
    case 89 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); }  //$NON-NLS-1$
6069
    case 105 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); }  //$NON-NLS-1$
5259
		    consumeImportDeclarations();  
6070
		    consumeImportDeclarations();  
5260
			break;
6071
			break;
5261
 
6072
 
5262
    case 91 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); }  //$NON-NLS-1$
6073
    case 107 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); }  //$NON-NLS-1$
5263
		    consumeTypeDeclarations();  
6074
		    consumeTypeDeclarations();  
5264
			break;
6075
			break;
5265
 
6076
 
5266
    case 92 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); }  //$NON-NLS-1$
6077
    case 108 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); }  //$NON-NLS-1$
5267
		     consumePackageDeclaration();  
6078
		     consumePackageDeclaration();  
5268
			break;
6079
			break;
5269
 
6080
 
5270
    case 93 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); }  //$NON-NLS-1$
6081
    case 109 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); }  //$NON-NLS-1$
5271
		     consumePackageDeclarationNameWithModifiers();  
6082
		     consumePackageDeclarationNameWithModifiers();  
5272
			break;
6083
			break;
5273
 
6084
 
5274
    case 94 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); }  //$NON-NLS-1$
6085
    case 110 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); }  //$NON-NLS-1$
5275
		     consumePackageDeclarationName();  
6086
		     consumePackageDeclarationName();  
5276
			break;
6087
			break;
5277
 
6088
 
5278
    case 95 : if (DEBUG) { System.out.println("PackageComment ::="); }  //$NON-NLS-1$
6089
    case 111 : if (DEBUG) { System.out.println("PackageComment ::="); }  //$NON-NLS-1$
5279
		     consumePackageComment();  
6090
		     consumePackageComment();  
5280
			break;
6091
			break;
5281
 
6092
 
5282
    case 100 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); }  //$NON-NLS-1$
6093
    case 116 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); }  //$NON-NLS-1$
5283
		    consumeImportDeclaration();  
6094
		    consumeImportDeclaration();  
5284
			break;
6095
			break;
5285
 
6096
 
5286
    case 101 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); }  //$NON-NLS-1$
6097
    case 117 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); }  //$NON-NLS-1$
5287
		    consumeSingleTypeImportDeclarationName();  
6098
		    consumeSingleTypeImportDeclarationName();  
5288
			break;
6099
			break;
5289
 
6100
 
5290
    case 102 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
6101
    case 118 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
5291
		    consumeImportDeclaration();  
6102
		    consumeImportDeclaration();  
5292
			break;
6103
			break;
5293
 
6104
 
5294
    case 103 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); }  //$NON-NLS-1$
6105
    case 119 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); }  //$NON-NLS-1$
5295
		    consumeTypeImportOnDemandDeclarationName();  
6106
		    consumeTypeImportOnDemandDeclarationName();  
5296
			break;
6107
			break;
5297
 
6108
 
5298
     case 106 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
6109
     case 122 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
5299
		    consumeEmptyTypeDeclaration();  
6110
		    consumeEmptyTypeDeclaration();  
5300
			break;
6111
			break;
5301
 
6112
 
5302
    case 110 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); }  //$NON-NLS-1$
6113
    case 126 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); }  //$NON-NLS-1$
5303
		    consumeModifiers2();  
6114
		    consumeModifiers2();  
5304
			break;
6115
			break;
5305
 
6116
 
5306
    case 122 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); }  //$NON-NLS-1$
6117
    case 138 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); }  //$NON-NLS-1$
5307
		    consumeAnnotationAsModifier();  
6118
		    consumeAnnotationAsModifier();  
5308
			break;
6119
			break;
5309
 
6120
 
5310
    case 123 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); }  //$NON-NLS-1$
6121
    case 139 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); }  //$NON-NLS-1$
5311
		    consumeClassDeclaration();  
6122
		    consumeClassDeclaration();  
5312
			break;
6123
			break;
5313
 
6124
 
5314
    case 124 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); }  //$NON-NLS-1$
6125
    case 140 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); }  //$NON-NLS-1$
5315
		    consumeClassHeader();  
6126
		    consumeClassHeader();  
5316
			break;
6127
			break;
5317
 
6128
 
5318
    case 125 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); }  //$NON-NLS-1$
6129
    case 141 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); }  //$NON-NLS-1$
5319
		    consumeTypeHeaderNameWithTypeParameters();  
6130
		    consumeTypeHeaderNameWithTypeParameters();  
5320
			break;
6131
			break;
5321
 
6132
 
5322
    case 127 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); }  //$NON-NLS-1$
6133
    case 143 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); }  //$NON-NLS-1$
5323
		    consumeClassHeaderName1();  
6134
		    consumeClassHeaderName1();  
5324
			break;
6135
			break;
5325
 
6136
 
5326
    case 128 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); }  //$NON-NLS-1$
6137
    case 144 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); }  //$NON-NLS-1$
5327
		    consumeClassHeaderExtends();  
6138
		    consumeClassHeaderExtends();  
5328
			break;
6139
			break;
5329
 
6140
 
5330
    case 129 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); }  //$NON-NLS-1$
6141
    case 145 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); }  //$NON-NLS-1$
5331
		    consumeClassHeaderImplements();  
6142
		    consumeClassHeaderImplements();  
5332
			break;
6143
			break;
5333
 
6144
 
5334
    case 131 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); }  //$NON-NLS-1$
6145
    case 147 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); }  //$NON-NLS-1$
5335
		    consumeInterfaceTypeList();  
6146
		    consumeInterfaceTypeList();  
5336
			break;
6147
			break;
5337
 
6148
 
5338
    case 132 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); }  //$NON-NLS-1$
6149
    case 148 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); }  //$NON-NLS-1$
5339
		    consumeInterfaceType();  
6150
		    consumeInterfaceType();  
5340
			break;
6151
			break;
5341
 
6152
 
5342
    case 135 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); }  //$NON-NLS-1$
6153
    case 151 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); }  //$NON-NLS-1$
5343
		    consumeClassBodyDeclarations();  
6154
		    consumeClassBodyDeclarations();  
5344
			break;
6155
			break;
5345
 
6156
 
5346
    case 139 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); }  //$NON-NLS-1$
6157
    case 155 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); }  //$NON-NLS-1$
5347
		    consumeClassBodyDeclaration();  
6158
		    consumeClassBodyDeclaration();  
5348
			break;
6159
			break;
5349
 
6160
 
5350
    case 140 : if (DEBUG) { System.out.println("Diet ::="); }  //$NON-NLS-1$
6161
    case 156 : if (DEBUG) { System.out.println("Diet ::="); }  //$NON-NLS-1$
5351
		    consumeDiet();  
6162
		    consumeDiet();  
5352
			break;
6163
			break;
5353
6164
5354
    case 141 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); }  //$NON-NLS-1$
6165
    case 157 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); }  //$NON-NLS-1$
5355
		    consumeClassBodyDeclaration();  
6166
		    consumeClassBodyDeclaration();  
5356
			break;
6167
			break;
5357
 
6168
 
5358
    case 142 : if (DEBUG) { System.out.println("CreateInitializer ::="); }  //$NON-NLS-1$
6169
    case 158 : if (DEBUG) { System.out.println("CreateInitializer ::="); }  //$NON-NLS-1$
5359
		    consumeCreateInitializer();  
6170
		    consumeCreateInitializer();  
5360
			break;
6171
			break;
5361
6172
5362
    case 149 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
6173
    case 165 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
5363
		    consumeEmptyTypeDeclaration();  
6174
		    consumeEmptyTypeDeclaration();  
5364
			break;
6175
			break;
5365
6176
5366
    case 152 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); }  //$NON-NLS-1$
6177
    case 168 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type0..."); }  //$NON-NLS-1$
5367
		    consumeFieldDeclaration();  
6178
		    consumeFieldDeclaration();  
5368
			break;
6179
			break;
5369
 
6180
 
5370
    case 154 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); }  //$NON-NLS-1$
6181
    case 170 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); }  //$NON-NLS-1$
5371
		    consumeVariableDeclarators();  
6182
		    consumeVariableDeclarators();  
5372
			break;
6183
			break;
5373
 
6184
 
5374
    case 157 : if (DEBUG) { System.out.println("EnterVariable ::="); }  //$NON-NLS-1$
6185
    case 173 : if (DEBUG) { System.out.println("EnterVariable ::="); }  //$NON-NLS-1$
5375
		    consumeEnterVariable();  
6186
		    consumeEnterVariable();  
5376
			break;
6187
			break;
5377
 
6188
 
5378
    case 158 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); }  //$NON-NLS-1$
6189
    case 174 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); }  //$NON-NLS-1$
5379
		    consumeExitVariableWithInitialization();  
6190
		    consumeExitVariableWithInitialization();  
5380
			break;
6191
			break;
5381
 
6192
 
5382
    case 159 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); }  //$NON-NLS-1$
6193
    case 175 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); }  //$NON-NLS-1$
5383
		    consumeExitVariableWithoutInitialization();  
6194
		    consumeExitVariableWithoutInitialization();  
5384
			break;
6195
			break;
5385
 
6196
 
5386
    case 160 : if (DEBUG) { System.out.println("ForceNoDiet ::="); }  //$NON-NLS-1$
6197
    case 176 : if (DEBUG) { System.out.println("ForceNoDiet ::="); }  //$NON-NLS-1$
5387
		    consumeForceNoDiet();  
6198
		    consumeForceNoDiet();  
5388
			break;
6199
			break;
5389
 
6200
 
5390
    case 161 : if (DEBUG) { System.out.println("RestoreDiet ::="); }  //$NON-NLS-1$
6201
    case 177 : if (DEBUG) { System.out.println("RestoreDiet ::="); }  //$NON-NLS-1$
5391
		    consumeRestoreDiet();  
6202
		    consumeRestoreDiet();  
5392
			break;
6203
			break;
5393
 
6204
 
5394
    case 166 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
6205
    case 182 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
5395
		    // set to true to consume a method with a body
6206
		    // set to true to consume a method with a body
5396
  consumeMethodDeclaration(true);   
6207
  consumeMethodDeclaration(true);   
5397
			break;
6208
			break;
5398
 
6209
 
5399
    case 167 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); }  //$NON-NLS-1$
6210
    case 183 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); }  //$NON-NLS-1$
5400
		    // set to false to consume a method without body
6211
		    // set to false to consume a method without body
5401
  consumeMethodDeclaration(false);  
6212
  consumeMethodDeclaration(false);  
5402
			break;
6213
			break;
5403
 
6214
 
5404
    case 168 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); }  //$NON-NLS-1$
6215
    case 184 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); }  //$NON-NLS-1$
5405
		    consumeMethodHeader();  
6216
		    consumeMethodHeader();  
5406
			break;
6217
			break;
5407
 
6218
 
5408
    case 169 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); }  //$NON-NLS-1$
6219
    case 185 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); }  //$NON-NLS-1$
5409
		    consumeMethodHeaderNameWithTypeParameters(false);  
6220
		    consumeMethodHeaderNameWithTypeParameters(false);  
5410
			break;
6221
			break;
5411
 
6222
 
5412
    case 170 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); }  //$NON-NLS-1$
6223
    case 186 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type0 Identifier..."); }  //$NON-NLS-1$
5413
		    consumeMethodHeaderName(false);  
6224
		    consumeMethodHeaderName(false);  
5414
			break;
6225
			break;
5415
 
6226
 
5416
    case 171 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); }  //$NON-NLS-1$
6227
    case 187 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); }  //$NON-NLS-1$
5417
		    consumeMethodHeaderRightParen();  
6228
		    consumeMethodHeaderRightParen();  
5418
			break;
6229
			break;
5419
 
6230
 
5420
    case 172 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); }  //$NON-NLS-1$
6231
    case 188 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= DimsoptAnnotsopt"); }  //$NON-NLS-1$
5421
		    consumeMethodHeaderExtendedDims();  
6232
		    consumeMethodHeaderExtendedDims();  
5422
			break;
6233
			break;
5423
 
6234
 
5424
    case 173 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); }  //$NON-NLS-1$
6235
    case 189 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); }  //$NON-NLS-1$
5425
		    consumeMethodHeaderThrowsClause();  
6236
		    consumeMethodHeaderThrowsClause();  
5426
			break;
6237
			break;
5427
 
6238
 
5428
    case 174 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); }  //$NON-NLS-1$
6239
    case 190 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); }  //$NON-NLS-1$
5429
		    consumeConstructorHeader();  
6240
		    consumeConstructorHeader();  
5430
			break;
6241
			break;
5431
 
6242
 
5432
    case 175 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); }  //$NON-NLS-1$
6243
    case 191 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); }  //$NON-NLS-1$
5433
		    consumeConstructorHeaderNameWithTypeParameters();  
6244
		    consumeConstructorHeaderNameWithTypeParameters();  
5434
			break;
6245
			break;
5435
 
6246
 
5436
    case 176 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); }  //$NON-NLS-1$
6247
    case 192 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); }  //$NON-NLS-1$
5437
		    consumeConstructorHeaderName();  
6248
		    consumeConstructorHeaderName();  
5438
			break;
6249
			break;
5439
 
6250
 
5440
    case 178 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); }  //$NON-NLS-1$
6251
    case 194 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); }  //$NON-NLS-1$
5441
		    consumeFormalParameterList();  
6252
		    consumeFormalParameterList();  
5442
			break;
6253
			break;
5443
 
6254
 
5444
    case 179 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); }  //$NON-NLS-1$
6255
    case 195 : if (DEBUG) { System.out.println("PotentialNameArray ::="); }  //$NON-NLS-1$
6256
		    consumePotentialNameArrayType();  
6257
			break;
6258
 
6259
    case 196 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); }  //$NON-NLS-1$
6260
		    consumeFormalParameter(false);  
6261
			break;
6262
 
6263
    case 197 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt PrimitiveType..."); }  //$NON-NLS-1$
6264
		    consumeFormalParameter(true);  
6265
			break;
6266
 
6267
    case 198 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); }  //$NON-NLS-1$
6268
		    consumeFormalParameter(false);  
6269
			break;
6270
 
6271
    case 199 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt"); }  //$NON-NLS-1$
6272
		    consumeFormalParameter(true);  
6273
			break;
6274
 
6275
    case 200 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); }  //$NON-NLS-1$
6276
		    consumeFormalParameter(false);  
6277
			break;
6278
 
6279
    case 201 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericType..."); }  //$NON-NLS-1$
6280
		    consumeFormalParameter(true);  
6281
			break;
6282
 
6283
    case 202 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); }  //$NON-NLS-1$
5445
		    consumeFormalParameter(false);  
6284
		    consumeFormalParameter(false);  
5446
			break;
6285
			break;
5447
 
6286
 
5448
    case 180 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type ELLIPSIS..."); }  //$NON-NLS-1$
6287
    case 203 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt GenericTypeDotName..."); }  //$NON-NLS-1$
5449
		    consumeFormalParameter(true);  
6288
		    consumeFormalParameter(true);  
5450
			break;
6289
			break;
5451
 
6290
 
5452
    case 182 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); }  //$NON-NLS-1$
6291
    case 205 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); }  //$NON-NLS-1$
5453
		    consumeClassTypeList();  
6292
		    consumeClassTypeList();  
5454
			break;
6293
			break;
5455
 
6294
 
5456
    case 183 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); }  //$NON-NLS-1$
6295
    case 206 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); }  //$NON-NLS-1$
5457
		    consumeClassTypeElt();  
6296
		    consumeClassTypeElt();  
5458
			break;
6297
			break;
5459
 
6298
 
5460
    case 184 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); }  //$NON-NLS-1$
6299
    case 207 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); }  //$NON-NLS-1$
5461
		    consumeMethodBody();  
6300
		    consumeMethodBody();  
5462
			break;
6301
			break;
5463
 
6302
 
5464
    case 185 : if (DEBUG) { System.out.println("NestedMethod ::="); }  //$NON-NLS-1$
6303
    case 208 : if (DEBUG) { System.out.println("NestedMethod ::="); }  //$NON-NLS-1$
5465
		    consumeNestedMethod();  
6304
		    consumeNestedMethod();  
5466
			break;
6305
			break;
5467
 
6306
 
5468
    case 186 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); }  //$NON-NLS-1$
6307
    case 209 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); }  //$NON-NLS-1$
5469
		    consumeStaticInitializer();  
6308
		    consumeStaticInitializer();  
5470
			break;
6309
			break;
5471
6310
5472
    case 187 : if (DEBUG) { System.out.println("StaticOnly ::= static"); }  //$NON-NLS-1$
6311
    case 210 : if (DEBUG) { System.out.println("StaticOnly ::= static"); }  //$NON-NLS-1$
5473
		    consumeStaticOnly();  
6312
		    consumeStaticOnly();  
5474
			break;
6313
			break;
5475
 
6314
 
5476
    case 188 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); }  //$NON-NLS-1$
6315
    case 211 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); }  //$NON-NLS-1$
5477
		    consumeConstructorDeclaration() ;  
6316
		    consumeConstructorDeclaration() ;  
5478
			break;
6317
			break;
5479
 
6318
 
5480
    case 189 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); }  //$NON-NLS-1$
6319
    case 212 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); }  //$NON-NLS-1$
5481
		    consumeInvalidConstructorDeclaration() ;  
6320
		    consumeInvalidConstructorDeclaration() ;  
5482
			break;
6321
			break;
5483
 
6322
 
5484
    case 190 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); }  //$NON-NLS-1$
6323
    case 213 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); }  //$NON-NLS-1$
5485
		    consumeExplicitConstructorInvocation(0, THIS_CALL);  
6324
		    consumeExplicitConstructorInvocation(0, THIS_CALL);  
5486
			break;
6325
			break;
5487
 
6326
 
5488
    case 191 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); }  //$NON-NLS-1$
6327
    case 214 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); }  //$NON-NLS-1$
5489
		    consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL);  
6328
		    consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL);  
5490
			break;
6329
			break;
5491
 
6330
 
5492
    case 192 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); }  //$NON-NLS-1$
6331
    case 215 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); }  //$NON-NLS-1$
5493
		    consumeExplicitConstructorInvocation(0,SUPER_CALL);  
6332
		    consumeExplicitConstructorInvocation(0,SUPER_CALL);  
5494
			break;
6333
			break;
5495
 
6334
 
5496
    case 193 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); }  //$NON-NLS-1$
6335
    case 216 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); }  //$NON-NLS-1$
5497
		    consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL);  
6336
		    consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL);  
5498
			break;
6337
			break;
5499
 
6338
 
5500
    case 194 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); }  //$NON-NLS-1$
6339
    case 217 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); }  //$NON-NLS-1$
5501
		    consumeExplicitConstructorInvocation(1, SUPER_CALL);  
6340
		    consumeExplicitConstructorInvocation(1, SUPER_CALL);  
5502
			break;
6341
			break;
5503
 
6342
 
5504
    case 195 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
6343
    case 218 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
5505
		    consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL);  
6344
		    consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL);  
5506
			break;
6345
			break;
5507
 
6346
 
5508
    case 196 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); }  //$NON-NLS-1$
6347
    case 219 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); }  //$NON-NLS-1$
5509
		    consumeExplicitConstructorInvocation(2, SUPER_CALL);  
6348
		    consumeExplicitConstructorInvocation(2, SUPER_CALL);  
5510
			break;
6349
			break;
5511
 
6350
 
5512
    case 197 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
6351
    case 220 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
5513
		    consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL);  
6352
		    consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL);  
5514
			break;
6353
			break;
5515
 
6354
 
5516
    case 198 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); }  //$NON-NLS-1$
6355
    case 221 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); }  //$NON-NLS-1$
5517
		    consumeExplicitConstructorInvocation(1, THIS_CALL);  
6356
		    consumeExplicitConstructorInvocation(1, THIS_CALL);  
5518
			break;
6357
			break;
5519
 
6358
 
5520
    case 199 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
6359
    case 222 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); }  //$NON-NLS-1$
5521
		    consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL);  
6360
		    consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL);  
5522
			break;
6361
			break;
5523
 
6362
 
5524
    case 200 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); }  //$NON-NLS-1$
6363
    case 223 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); }  //$NON-NLS-1$
5525
		    consumeExplicitConstructorInvocation(2, THIS_CALL);  
6364
		    consumeExplicitConstructorInvocation(2, THIS_CALL);  
5526
			break;
6365
			break;
5527
 
6366
 
5528
    case 201 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
6367
    case 224 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); }  //$NON-NLS-1$
5529
		    consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL);  
6368
		    consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL);  
5530
			break;
6369
			break;
5531
 
6370
 
5532
    case 202 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); }  //$NON-NLS-1$
6371
    case 225 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); }  //$NON-NLS-1$
5533
		    consumeInterfaceDeclaration();  
6372
		    consumeInterfaceDeclaration();  
5534
			break;
6373
			break;
5535
 
6374
 
5536
    case 203 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); }  //$NON-NLS-1$
6375
    case 226 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); }  //$NON-NLS-1$
5537
		    consumeInterfaceHeader();  
6376
		    consumeInterfaceHeader();  
5538
			break;
6377
			break;
5539
 
6378
 
5540
    case 204 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); }  //$NON-NLS-1$
6379
    case 227 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); }  //$NON-NLS-1$
5541
		    consumeTypeHeaderNameWithTypeParameters();  
6380
		    consumeTypeHeaderNameWithTypeParameters();  
5542
			break;
6381
			break;
5543
 
6382
 
5544
    case 206 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); }  //$NON-NLS-1$
6383
    case 229 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); }  //$NON-NLS-1$
5545
		    consumeInterfaceHeaderName1();  
6384
		    consumeInterfaceHeaderName1();  
5546
			break;
6385
			break;
5547
 
6386
 
5548
    case 207 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); }  //$NON-NLS-1$
6387
    case 230 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); }  //$NON-NLS-1$
5549
		    consumeInterfaceHeaderExtends();  
6388
		    consumeInterfaceHeaderExtends();  
5550
			break;
6389
			break;
5551
 
6390
 
5552
    case 210 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); }  //$NON-NLS-1$
6391
    case 233 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); }  //$NON-NLS-1$
5553
		    consumeInterfaceMemberDeclarations();  
6392
		    consumeInterfaceMemberDeclarations();  
5554
			break;
6393
			break;
5555
 
6394
 
5556
    case 211 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
6395
    case 234 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); }  //$NON-NLS-1$
5557
		    consumeEmptyTypeDeclaration();  
6396
		    consumeEmptyTypeDeclaration();  
5558
			break;
6397
			break;
5559
 
6398
 
5560
    case 213 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
6399
    case 236 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); }  //$NON-NLS-1$
5561
		    consumeInvalidMethodDeclaration();  
6400
		    consumeInvalidMethodDeclaration();  
5562
			break;
6401
			break;
5563
 
6402
 
5564
    case 214 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
6403
    case 237 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
5565
		    consumeInvalidConstructorDeclaration(true);   
6404
		    consumeInvalidConstructorDeclaration(true);   
5566
			break;
6405
			break;
5567
 
6406
 
5568
    case 215 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
6407
    case 238 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); }  //$NON-NLS-1$
5569
		    consumeInvalidConstructorDeclaration(false);   
6408
		    consumeInvalidConstructorDeclaration(false);   
5570
			break;
6409
			break;
5571
 
6410
 
5572
    case 226 : if (DEBUG) { System.out.println("PushLeftBrace ::="); }  //$NON-NLS-1$
6411
    case 249 : if (DEBUG) { System.out.println("PushLeftBrace ::="); }  //$NON-NLS-1$
5573
		    consumePushLeftBrace();  
6412
		    consumePushLeftBrace();  
5574
			break;
6413
			break;
5575
 
6414
 
5576
    case 227 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); }  //$NON-NLS-1$
6415
    case 250 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); }  //$NON-NLS-1$
5577
		    consumeEmptyArrayInitializer();  
6416
		    consumeEmptyArrayInitializer();  
5578
			break;
6417
			break;
5579
 
6418
 
5580
    case 228 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
6419
    case 251 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
5581
		    consumeArrayInitializer();  
6420
		    consumeArrayInitializer();  
5582
			break;
6421
			break;
5583
 
6422
 
5584
    case 229 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
6423
    case 252 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); }  //$NON-NLS-1$
5585
		    consumeArrayInitializer();  
6424
		    consumeArrayInitializer();  
5586
			break;
6425
			break;
5587
 
6426
 
5588
    case 231 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); }  //$NON-NLS-1$
6427
    case 254 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); }  //$NON-NLS-1$
5589
		    consumeVariableInitializers();  
6428
		    consumeVariableInitializers();  
5590
			break;
6429
			break;
5591
 
6430
 
5592
    case 232 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); }  //$NON-NLS-1$
6431
    case 255 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); }  //$NON-NLS-1$
5593
		    consumeBlock();  
6432
		    consumeBlock();  
5594
			break;
6433
			break;
5595
 
6434
 
5596
    case 233 : if (DEBUG) { System.out.println("OpenBlock ::="); }  //$NON-NLS-1$
6435
    case 256 : if (DEBUG) { System.out.println("OpenBlock ::="); }  //$NON-NLS-1$
5597
		    consumeOpenBlock() ;  
6436
		    consumeOpenBlock() ;  
5598
			break;
6437
			break;
5599
 
6438
 
5600
    case 235 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); }  //$NON-NLS-1$
6439
    case 258 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); }  //$NON-NLS-1$
5601
		    consumeBlockStatements() ;  
6440
		    consumeBlockStatements() ;  
5602
			break;
6441
			break;
5603
 
6442
 
5604
    case 239 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); }  //$NON-NLS-1$
6443
    case 262 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); }  //$NON-NLS-1$
5605
		    consumeInvalidInterfaceDeclaration();  
6444
		    consumeInvalidInterfaceDeclaration();  
5606
			break;
6445
			break;
5607
 
6446
 
5608
    case 240 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); }  //$NON-NLS-1$
6447
    case 263 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); }  //$NON-NLS-1$
5609
		    consumeInvalidAnnotationTypeDeclaration();  
6448
		    consumeInvalidAnnotationTypeDeclaration();  
5610
			break;
6449
			break;
5611
 
6450
 
5612
    case 241 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); }  //$NON-NLS-1$
6451
    case 264 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); }  //$NON-NLS-1$
5613
		    consumeInvalidEnumDeclaration();  
6452
		    consumeInvalidEnumDeclaration();  
5614
			break;
6453
			break;
5615
 
6454
 
5616
    case 242 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); }  //$NON-NLS-1$
6455
    case 265 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); }  //$NON-NLS-1$
5617
		    consumeLocalVariableDeclarationStatement();  
6456
		    consumeLocalVariableDeclarationStatement();  
5618
			break;
6457
			break;
5619
 
6458
 
5620
    case 243 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); }  //$NON-NLS-1$
6459
    case 266 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type0 PushModifiers..."); }  //$NON-NLS-1$
5621
		    consumeLocalVariableDeclaration();  
6460
		    consumeLocalVariableDeclaration();  
5622
			break;
6461
			break;
5623
 
6462
 
5624
    case 244 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); }  //$NON-NLS-1$
6463
    case 267 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type0..."); }  //$NON-NLS-1$
5625
		    consumeLocalVariableDeclaration();  
6464
		    consumeLocalVariableDeclaration();  
5626
			break;
6465
			break;
5627
 
6466
 
5628
    case 245 : if (DEBUG) { System.out.println("PushModifiers ::="); }  //$NON-NLS-1$
6467
    case 268 : if (DEBUG) { System.out.println("PushModifiers ::="); }  //$NON-NLS-1$
5629
		    consumePushModifiers();  
6468
		    consumePushModifiers();  
5630
			break;
6469
			break;
5631
 
6470
 
5632
    case 246 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); }  //$NON-NLS-1$
6471
    case 269 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); }  //$NON-NLS-1$
5633
		    consumePushModifiersForHeader();  
6472
		    consumePushModifiersForHeader();  
5634
			break;
6473
			break;
5635
 
6474
 
5636
    case 247 : if (DEBUG) { System.out.println("PushRealModifiers ::="); }  //$NON-NLS-1$
6475
    case 270 : if (DEBUG) { System.out.println("PushRealModifiers ::="); }  //$NON-NLS-1$
5637
		    consumePushRealModifiers();  
6476
		    consumePushRealModifiers();  
5638
			break;
6477
			break;
5639
 
6478
 
5640
    case 273 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); }  //$NON-NLS-1$
6479
    case 296 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); }  //$NON-NLS-1$
5641
		    consumeEmptyStatement();  
6480
		    consumeEmptyStatement();  
5642
			break;
6481
			break;
5643
 
6482
 
5644
    case 274 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); }  //$NON-NLS-1$
6483
    case 297 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); }  //$NON-NLS-1$
5645
		    consumeStatementLabel() ;  
6484
		    consumeStatementLabel() ;  
5646
			break;
6485
			break;
5647
 
6486
 
5648
    case 275 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); }  //$NON-NLS-1$
6487
    case 298 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); }  //$NON-NLS-1$
5649
		    consumeStatementLabel() ;  
6488
		    consumeStatementLabel() ;  
5650
			break;
6489
			break;
5651
 
6490
 
5652
    case 276 : if (DEBUG) { System.out.println("Label ::= Identifier"); }  //$NON-NLS-1$
6491
    case 299 : if (DEBUG) { System.out.println("Label ::= Identifier"); }  //$NON-NLS-1$
5653
		    consumeLabel() ;  
6492
		    consumeLabel() ;  
5654
			break;
6493
			break;
5655
 
6494
 
5656
     case 277 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); }  //$NON-NLS-1$
6495
     case 300 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); }  //$NON-NLS-1$
5657
		    consumeExpressionStatement();  
6496
		    consumeExpressionStatement();  
5658
			break;
6497
			break;
5659
 
6498
 
5660
    case 286 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6499
    case 309 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5661
		    consumeStatementIfNoElse();  
6500
		    consumeStatementIfNoElse();  
5662
			break;
6501
			break;
5663
 
6502
 
5664
    case 287 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6503
    case 310 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5665
		    consumeStatementIfWithElse();  
6504
		    consumeStatementIfWithElse();  
5666
			break;
6505
			break;
5667
 
6506
 
5668
    case 288 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); }  //$NON-NLS-1$
6507
    case 311 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); }  //$NON-NLS-1$
5669
		    consumeStatementIfWithElse();  
6508
		    consumeStatementIfWithElse();  
5670
			break;
6509
			break;
5671
 
6510
 
5672
    case 289 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6511
    case 312 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5673
		    consumeStatementSwitch() ;  
6512
		    consumeStatementSwitch() ;  
5674
			break;
6513
			break;
5675
 
6514
 
5676
    case 290 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); }  //$NON-NLS-1$
6515
    case 313 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); }  //$NON-NLS-1$
5677
		    consumeEmptySwitchBlock() ;  
6516
		    consumeEmptySwitchBlock() ;  
5678
			break;
6517
			break;
5679
 
6518
 
5680
    case 293 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); }  //$NON-NLS-1$
6519
    case 316 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); }  //$NON-NLS-1$
5681
		    consumeSwitchBlock() ;  
6520
		    consumeSwitchBlock() ;  
5682
			break;
6521
			break;
5683
 
6522
 
5684
    case 295 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); }  //$NON-NLS-1$
6523
    case 318 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); }  //$NON-NLS-1$
5685
		    consumeSwitchBlockStatements() ;  
6524
		    consumeSwitchBlockStatements() ;  
5686
			break;
6525
			break;
5687
 
6526
 
5688
    case 296 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); }  //$NON-NLS-1$
6527
    case 319 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); }  //$NON-NLS-1$
5689
		    consumeSwitchBlockStatement() ;  
6528
		    consumeSwitchBlockStatement() ;  
5690
			break;
6529
			break;
5691
 
6530
 
5692
    case 298 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); }  //$NON-NLS-1$
6531
    case 321 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); }  //$NON-NLS-1$
5693
		    consumeSwitchLabels() ;  
6532
		    consumeSwitchLabels() ;  
5694
			break;
6533
			break;
5695
 
6534
 
5696
     case 299 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); }  //$NON-NLS-1$
6535
     case 322 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); }  //$NON-NLS-1$
5697
		    consumeCaseLabel();  
6536
		    consumeCaseLabel();  
5698
			break;
6537
			break;
5699
 
6538
 
5700
     case 300 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); }  //$NON-NLS-1$
6539
     case 323 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); }  //$NON-NLS-1$
5701
		    consumeDefaultLabel();  
6540
		    consumeDefaultLabel();  
5702
			break;
6541
			break;
5703
 
6542
 
5704
    case 301 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
6543
    case 324 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); }  //$NON-NLS-1$
5705
		    consumeStatementWhile() ;  
6544
		    consumeStatementWhile() ;  
5706
			break;
6545
			break;
5707
 
6546
 
5708
    case 302 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); }  //$NON-NLS-1$
6547
    case 325 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); }  //$NON-NLS-1$
5709
		    consumeStatementWhile() ;  
6548
		    consumeStatementWhile() ;  
5710
			break;
6549
			break;
5711
 
6550
 
5712
    case 303 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); }  //$NON-NLS-1$
6551
    case 326 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); }  //$NON-NLS-1$
5713
		    consumeStatementDo() ;  
6552
		    consumeStatementDo() ;  
5714
			break;
6553
			break;
5715
 
6554
 
5716
    case 304 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); }  //$NON-NLS-1$
6555
    case 327 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); }  //$NON-NLS-1$
5717
		    consumeStatementFor() ;  
6556
		    consumeStatementFor() ;  
5718
			break;
6557
			break;
5719
 
6558
 
5720
    case 305 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); }  //$NON-NLS-1$
6559
    case 328 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); }  //$NON-NLS-1$
5721
		    consumeStatementFor() ;  
6560
		    consumeStatementFor() ;  
5722
			break;
6561
			break;
5723
 
6562
 
5724
    case 306 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); }  //$NON-NLS-1$
6563
    case 329 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); }  //$NON-NLS-1$
5725
		    consumeForInit() ;  
6564
		    consumeForInit() ;  
5726
			break;
6565
			break;
5727
 
6566
 
5728
    case 310 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); }  //$NON-NLS-1$
6567
    case 333 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); }  //$NON-NLS-1$
5729
		    consumeStatementExpressionList() ;  
6568
		    consumeStatementExpressionList() ;  
5730
			break;
6569
			break;
5731
 
6570
 
5732
    case 311 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); }  //$NON-NLS-1$
6571
    case 334 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); }  //$NON-NLS-1$
5733
		    consumeSimpleAssertStatement() ;  
6572
		    consumeSimpleAssertStatement() ;  
5734
			break;
6573
			break;
5735
 
6574
 
5736
    case 312 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); }  //$NON-NLS-1$
6575
    case 335 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); }  //$NON-NLS-1$
5737
		    consumeAssertStatement() ;  
6576
		    consumeAssertStatement() ;  
5738
			break;
6577
			break;
5739
 
6578
 
5740
    case 313 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); }  //$NON-NLS-1$
6579
    case 336 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); }  //$NON-NLS-1$
5741
		    consumeStatementBreak() ;  
6580
		    consumeStatementBreak() ;  
5742
			break;
6581
			break;
5743
 
6582
 
5744
    case 314 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); }  //$NON-NLS-1$
6583
    case 337 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); }  //$NON-NLS-1$
5745
		    consumeStatementBreakWithLabel() ;  
6584
		    consumeStatementBreakWithLabel() ;  
5746
			break;
6585
			break;
5747
 
6586
 
5748
    case 315 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); }  //$NON-NLS-1$
6587
    case 338 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); }  //$NON-NLS-1$
5749
		    consumeStatementContinue() ;  
6588
		    consumeStatementContinue() ;  
5750
			break;
6589
			break;
5751
 
6590
 
5752
    case 316 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); }  //$NON-NLS-1$
6591
    case 339 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); }  //$NON-NLS-1$
5753
		    consumeStatementContinueWithLabel() ;  
6592
		    consumeStatementContinueWithLabel() ;  
5754
			break;
6593
			break;
5755
 
6594
 
5756
    case 317 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); }  //$NON-NLS-1$
6595
    case 340 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); }  //$NON-NLS-1$
5757
		    consumeStatementReturn() ;  
6596
		    consumeStatementReturn() ;  
5758
			break;
6597
			break;
5759
 
6598
 
5760
    case 318 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); }  //$NON-NLS-1$
6599
    case 341 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); }  //$NON-NLS-1$
5761
		    consumeStatementThrow();  
6600
		    consumeStatementThrow();  
5762
			break;
6601
			break;
5763
 
6602
 
5764
    case 319 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); }  //$NON-NLS-1$
6603
    case 342 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); }  //$NON-NLS-1$
5765
		    consumeStatementSynchronized();  
6604
		    consumeStatementSynchronized();  
5766
			break;
6605
			break;
5767
 
6606
 
5768
    case 320 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); }  //$NON-NLS-1$
6607
    case 343 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); }  //$NON-NLS-1$
5769
		    consumeOnlySynchronized();  
6608
		    consumeOnlySynchronized();  
5770
			break;
6609
			break;
5771
 
6610
 
5772
    case 321 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); }  //$NON-NLS-1$
6611
    case 344 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); }  //$NON-NLS-1$
5773
		    consumeStatementTry(false);  
6612
		    consumeStatementTry(false);  
5774
			break;
6613
			break;
5775
 
6614
 
5776
    case 322 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); }  //$NON-NLS-1$
6615
    case 345 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); }  //$NON-NLS-1$
5777
		    consumeStatementTry(true);  
6616
		    consumeStatementTry(true);  
5778
			break;
6617
			break;
5779
 
6618
 
5780
    case 324 : if (DEBUG) { System.out.println("ExitTryBlock ::="); }  //$NON-NLS-1$
6619
    case 347 : if (DEBUG) { System.out.println("ExitTryBlock ::="); }  //$NON-NLS-1$
5781
		    consumeExitTryBlock();  
6620
		    consumeExitTryBlock();  
5782
			break;
6621
			break;
5783
 
6622
 
5784
    case 326 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); }  //$NON-NLS-1$
6623
    case 349 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); }  //$NON-NLS-1$
5785
		    consumeCatches();  
6624
		    consumeCatches();  
5786
			break;
6625
			break;
5787
 
6626
 
5788
    case 327 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); }  //$NON-NLS-1$
6627
    case 350 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); }  //$NON-NLS-1$
5789
		    consumeStatementCatch() ;  
6628
		    consumeStatementCatch() ;  
5790
			break;
6629
			break;
5791
 
6630
 
5792
    case 329 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); }  //$NON-NLS-1$
6631
    case 352 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); }  //$NON-NLS-1$
5793
		    consumeLeftParen();  
6632
		    consumeLeftParen();  
5794
			break;
6633
			break;
5795
 
6634
 
5796
    case 330 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); }  //$NON-NLS-1$
6635
    case 353 : if (DEBUG) { System.out.println("PushRPARENForUnannotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6636
		    consumeRightParenForUnannotatedTypeCast();  
6637
			break;
6638
 
6639
    case 354 : if (DEBUG) { System.out.println("PushRPARENForNameUnannotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6640
		    consumeRightParenForNameUnannotatedTypeCast();  
6641
			break;
6642
 
6643
    case 355 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); }  //$NON-NLS-1$
5797
		    consumeRightParen();  
6644
		    consumeRightParen();  
5798
			break;
6645
			break;
5799
 
6646
 
5800
    case 335 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); }  //$NON-NLS-1$
6647
    case 356 : if (DEBUG) { System.out.println("PushRPARENForAnnotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6648
		    consumeRightParenForAnnotatedTypeCast();  
6649
			break;
6650
 
6651
    case 357 : if (DEBUG) { System.out.println("PushRPARENForNameAndAnnotatedTypeCast ::= RPAREN"); }  //$NON-NLS-1$
6652
		    consumeRightParenForNameAndAnnotatedTypeCast();  
6653
			break;
6654
 
6655
    case 362 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); }  //$NON-NLS-1$
5801
		    consumePrimaryNoNewArrayThis();  
6656
		    consumePrimaryNoNewArrayThis();  
5802
			break;
6657
			break;
5803
 
6658
 
5804
    case 336 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); }  //$NON-NLS-1$
6659
    case 363 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); }  //$NON-NLS-1$
5805
		    consumePrimaryNoNewArray();  
6660
		    consumePrimaryNoNewArray();  
5806
			break;
6661
			break;
5807
 
6662
 
5808
    case 337 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); }  //$NON-NLS-1$
6663
    case 364 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); }  //$NON-NLS-1$
5809
		    consumePrimaryNoNewArrayWithName();  
6664
		    consumePrimaryNoNewArrayWithName();  
5810
			break;
6665
			break;
5811
 
6666
 
5812
    case 340 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); }  //$NON-NLS-1$
6667
    case 367 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); }  //$NON-NLS-1$
5813
		    consumePrimaryNoNewArrayNameThis();  
6668
		    consumePrimaryNoNewArrayNameThis();  
5814
			break;
6669
			break;
5815
 
6670
 
5816
    case 341 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); }  //$NON-NLS-1$
6671
    case 368 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); }  //$NON-NLS-1$
5817
		    consumePrimaryNoNewArrayNameSuper();  
6672
		    consumePrimaryNoNewArrayNameSuper();  
5818
			break;
6673
			break;
5819
 
6674
 
5820
    case 342 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); }  //$NON-NLS-1$
6675
    case 369 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name DOT class"); }  //$NON-NLS-1$
6676
		    consumePrimaryNoNewArrayNameWithTypeAnnotations();  
6677
			break;
6678
 
6679
    case 370 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers Name Dims DOT class"); }  //$NON-NLS-1$
6680
		    consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations();  
6681
			break;
6682
 
6683
    case 371 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType Dims DOT"); }  //$NON-NLS-1$
6684
		    consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations();  
6685
			break;
6686
 
6687
    case 372 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Modifiers PrimitiveType DOT class"); }  //$NON-NLS-1$
6688
		    consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations();  
6689
			break;
6690
 
6691
    case 373 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); }  //$NON-NLS-1$
5821
		    consumePrimaryNoNewArrayName();  
6692
		    consumePrimaryNoNewArrayName();  
5822
			break;
6693
			break;
5823
 
6694
 
5824
    case 343 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); }  //$NON-NLS-1$
6695
    case 374 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); }  //$NON-NLS-1$
5825
		    consumePrimaryNoNewArrayArrayType();  
6696
		    consumePrimaryNoNewArrayArrayType();  
5826
			break;
6697
			break;
5827
 
6698
 
5828
    case 344 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); }  //$NON-NLS-1$
6699
    case 375 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); }  //$NON-NLS-1$
5829
		    consumePrimaryNoNewArrayPrimitiveArrayType();  
6700
		    consumePrimaryNoNewArrayPrimitiveArrayType();  
5830
			break;
6701
			break;
5831
 
6702
 
5832
    case 345 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); }  //$NON-NLS-1$
6703
    case 376 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); }  //$NON-NLS-1$
5833
		    consumePrimaryNoNewArrayPrimitiveType();  
6704
		    consumePrimaryNoNewArrayPrimitiveType();  
5834
			break;
6705
			break;
5835
 
6706
 
5836
    case 348 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); }  //$NON-NLS-1$
6707
    case 379 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); }  //$NON-NLS-1$
5837
		    consumeAllocationHeader();  
6708
		    consumeAllocationHeader();  
5838
			break;
6709
			break;
5839
 
6710
 
5840
    case 349 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); }  //$NON-NLS-1$
6711
    case 380 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); }  //$NON-NLS-1$
5841
		    consumeClassInstanceCreationExpressionWithTypeArguments();  
6712
		    consumeClassInstanceCreationExpressionWithTypeArguments();  
5842
			break;
6713
			break;
5843
 
6714
 
5844
    case 350 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); }  //$NON-NLS-1$
6715
    case 381 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); }  //$NON-NLS-1$
5845
		    consumeClassInstanceCreationExpression();  
6716
		    consumeClassInstanceCreationExpression();  
5846
			break;
6717
			break;
5847
 
6718
 
5848
    case 351 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
6719
    case 382 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
5849
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
6720
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
5850
			break;
6721
			break;
5851
 
6722
 
5852
    case 352 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
6723
    case 383 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); }  //$NON-NLS-1$
5853
		    consumeClassInstanceCreationExpressionQualified() ;  
6724
		    consumeClassInstanceCreationExpressionQualified() ;  
5854
			break;
6725
			break;
5855
 
6726
 
5856
    case 353 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
6727
    case 384 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
5857
		    consumeClassInstanceCreationExpressionQualified() ;  
6728
		    consumeClassInstanceCreationExpressionQualified() ;  
5858
			break;
6729
			break;
5859
 
6730
 
5860
    case 354 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
6731
    case 385 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); }  //$NON-NLS-1$
5861
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
6732
		    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;  
5862
			break;
6733
			break;
5863
 
6734
 
5864
    case 355 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); }  //$NON-NLS-1$
6735
    case 386 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); }  //$NON-NLS-1$
5865
		    consumeClassInstanceCreationExpressionName() ;  
6736
		    consumeClassInstanceCreationExpressionName() ;  
5866
			break;
6737
			break;
5867
 
6738
 
5868
    case 356 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); }  //$NON-NLS-1$
6739
    case 387 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); }  //$NON-NLS-1$
5869
		    consumeClassBodyopt();  
6740
		    consumeClassBodyopt();  
5870
			break;
6741
			break;
5871
 
6742
 
5872
    case 358 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
6743
    case 389 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
5873
		    consumeEnterAnonymousClassBody(false);  
6744
		    consumeEnterAnonymousClassBody(false);  
5874
			break;
6745
			break;
5875
 
6746
 
5876
    case 359 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); }  //$NON-NLS-1$
6747
    case 390 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); }  //$NON-NLS-1$
5877
		    consumeClassBodyopt();  
6748
		    consumeClassBodyopt();  
5878
			break;
6749
			break;
5879
 
6750
 
5880
    case 361 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
6751
    case 392 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); }  //$NON-NLS-1$
5881
		    consumeEnterAnonymousClassBody(true);  
6752
		    consumeEnterAnonymousClassBody(true);  
5882
			break;
6753
			break;
5883
 
6754
 
5884
    case 363 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); }  //$NON-NLS-1$
6755
    case 394 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); }  //$NON-NLS-1$
5885
		    consumeArgumentList();  
6756
		    consumeArgumentList();  
5886
			break;
6757
			break;
5887
 
6758
 
5888
    case 364 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); }  //$NON-NLS-1$
6759
    case 395 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new Annotationsopt PrimitiveType"); }  //$NON-NLS-1$
5889
		    consumeArrayCreationHeader();  
6760
		    consumeArrayCreationHeader();  
5890
			break;
6761
			break;
5891
 
6762
 
5892
    case 365 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); }  //$NON-NLS-1$
6763
    case 396 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); }  //$NON-NLS-1$
5893
		    consumeArrayCreationHeader();  
6764
		    consumeArrayCreationHeader();  
5894
			break;
6765
			break;
5895
 
6766
 
5896
    case 366 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
6767
    case 397 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
5897
		    consumeArrayCreationExpressionWithoutInitializer();  
6768
		    consumeArrayCreationExpressionWithoutInitializer();  
5898
			break;
6769
			break;
5899
 
6770
 
5900
    case 367 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); }  //$NON-NLS-1$
6771
    case 398 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new Annotationsopt"); }  //$NON-NLS-1$
5901
		    consumeArrayCreationExpressionWithInitializer();  
6772
		    consumeArrayCreationExpressionWithInitializer();  
5902
			break;
6773
			break;
5903
 
6774
 
5904
    case 368 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
6775
    case 399 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); }  //$NON-NLS-1$
5905
		    consumeArrayCreationExpressionWithoutInitializer();  
6776
		    consumeArrayCreationExpressionWithoutInitializer();  
5906
			break;
6777
			break;
5907
 
6778
 
5908
    case 369 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); }  //$NON-NLS-1$
6779
    case 400 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); }  //$NON-NLS-1$
5909
		    consumeArrayCreationExpressionWithInitializer();  
6780
		    consumeArrayCreationExpressionWithInitializer();  
5910
			break;
6781
			break;
5911
 
6782
 
5912
    case 371 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); }  //$NON-NLS-1$
6783
    case 402 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); }  //$NON-NLS-1$
5913
		    consumeDimWithOrWithOutExprs();  
6784
		    consumeDimWithOrWithOutExprs();  
5914
			break;
6785
			break;
5915
 
6786
 
5916
     case 373 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
6787
     case 405 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET..."); }  //$NON-NLS-1$
5917
		    consumeDimWithOrWithOutExpr();  
6788
		    consumeDimWithOrWithOutExpr();  
5918
			break;
6789
			break;
5919
 
6790
 
5920
     case 374 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); }  //$NON-NLS-1$
6791
     case 406 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotations LBRACKET..."); }  //$NON-NLS-1$
6792
		    consumeDimWithOrWithOutExpr();  
6793
			break;
6794
 
6795
     case 407 : if (DEBUG) { System.out.println("DimsoptAnnotsopt ::="); }  //$NON-NLS-1$
6796
		    consumeEmptyDimsoptAnnotsopt();  
6797
			break;
6798
 
6799
     case 408 : if (DEBUG) { System.out.println("DimsoptAnnotsopt -> DimsAnnotLoop"); }  //$NON-NLS-1$
6800
		    consumeDimsWithTrailingAnnotsopt();  
6801
			break;
6802
 
6803
     case 411 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= Annotation"); }  //$NON-NLS-1$
6804
		    consumeTypeAnnotation(true);  
6805
			break;
6806
 
6807
     case 412 : if (DEBUG) { System.out.println("OneDimOrAnnot ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
6808
		    consumeOneDimLoop(true);  
6809
			break;
6810
 
6811
     case 413 : if (DEBUG) { System.out.println("TypeAnnotations ::= Annotation"); }  //$NON-NLS-1$
6812
		    consumeTypeAnnotation(false);  
6813
			break;
6814
 
6815
     case 414 : if (DEBUG) { System.out.println("TypeAnnotations ::= TypeAnnotations Annotation"); }  //$NON-NLS-1$
6816
		    consumeOneMoreTypeAnnotation();  
6817
			break;
6818
 
6819
     case 415 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); }  //$NON-NLS-1$
5921
		    consumeDims();  
6820
		    consumeDims();  
5922
			break;
6821
			break;
5923
 
6822
 
5924
     case 377 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
6823
     case 418 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); }  //$NON-NLS-1$
5925
		    consumeOneDimLoop();  
6824
		    consumeOneDimLoop(false);  
5926
			break;
6825
			break;
5927
 
6826
 
5928
    case 378 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); }  //$NON-NLS-1$
6827
     case 419 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); }  //$NON-NLS-1$
6828
		    consumeOneDimLoopWithAnnotations();  
6829
			break;
6830
 
6831
    case 420 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); }  //$NON-NLS-1$
5929
		    consumeFieldAccess(false);  
6832
		    consumeFieldAccess(false);  
5930
			break;
6833
			break;
5931
 
6834
 
5932
    case 379 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); }  //$NON-NLS-1$
6835
    case 421 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); }  //$NON-NLS-1$
5933
		    consumeFieldAccess(true);  
6836
		    consumeFieldAccess(true);  
5934
			break;
6837
			break;
5935
 
6838
 
5936
    case 380 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
6839
    case 422 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
5937
		    consumeMethodInvocationName();  
6840
		    consumeMethodInvocationName();  
5938
			break;
6841
			break;
5939
 
6842
 
5940
    case 381 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
6843
    case 423 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
5941
		    consumeMethodInvocationNameWithTypeArguments();  
6844
		    consumeMethodInvocationNameWithTypeArguments();  
5942
			break;
6845
			break;
5943
 
6846
 
5944
    case 382 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
6847
    case 424 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
5945
		    consumeMethodInvocationPrimaryWithTypeArguments();  
6848
		    consumeMethodInvocationPrimaryWithTypeArguments();  
5946
			break;
6849
			break;
5947
 
6850
 
5948
    case 383 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); }  //$NON-NLS-1$
6851
    case 425 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); }  //$NON-NLS-1$
5949
		    consumeMethodInvocationPrimary();  
6852
		    consumeMethodInvocationPrimary();  
5950
			break;
6853
			break;
5951
 
6854
 
5952
    case 384 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
6855
    case 426 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); }  //$NON-NLS-1$
5953
		    consumeMethodInvocationSuperWithTypeArguments();  
6856
		    consumeMethodInvocationSuperWithTypeArguments();  
5954
			break;
6857
			break;
5955
 
6858
 
5956
    case 385 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); }  //$NON-NLS-1$
6859
    case 427 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); }  //$NON-NLS-1$
5957
		    consumeMethodInvocationSuper();  
6860
		    consumeMethodInvocationSuper();  
5958
			break;
6861
			break;
5959
 
6862
 
5960
    case 386 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); }  //$NON-NLS-1$
6863
    case 428 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); }  //$NON-NLS-1$
5961
		    consumeArrayAccess(true);  
6864
		    consumeArrayAccess(true);  
5962
			break;
6865
			break;
5963
 
6866
 
5964
    case 387 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); }  //$NON-NLS-1$
6867
    case 429 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); }  //$NON-NLS-1$
5965
		    consumeArrayAccess(false);  
6868
		    consumeArrayAccess(false);  
5966
			break;
6869
			break;
5967
 
6870
 
5968
    case 388 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); }  //$NON-NLS-1$
6871
    case 430 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); }  //$NON-NLS-1$
5969
		    consumeArrayAccess(false);  
6872
		    consumeArrayAccess(false);  
5970
			break;
6873
			break;
5971
 
6874
 
5972
    case 390 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); }  //$NON-NLS-1$
6875
    case 432 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); }  //$NON-NLS-1$
5973
		    consumePostfixExpression();  
6876
		    consumePostfixExpression();  
5974
			break;
6877
			break;
5975
 
6878
 
5976
    case 393 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); }  //$NON-NLS-1$
6879
    case 435 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); }  //$NON-NLS-1$
5977
		    consumeUnaryExpression(OperatorIds.PLUS,true);  
6880
		    consumeUnaryExpression(OperatorIds.PLUS,true);  
5978
			break;
6881
			break;
5979
 
6882
 
5980
    case 394 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); }  //$NON-NLS-1$
6883
    case 436 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); }  //$NON-NLS-1$
5981
		    consumeUnaryExpression(OperatorIds.MINUS,true);  
6884
		    consumeUnaryExpression(OperatorIds.MINUS,true);  
5982
			break;
6885
			break;
5983
 
6886
 
5984
    case 395 : if (DEBUG) { System.out.println("PushPosition ::="); }  //$NON-NLS-1$
6887
    case 437 : if (DEBUG) { System.out.println("PushPosition ::="); }  //$NON-NLS-1$
5985
		    consumePushPosition();  
6888
		    consumePushPosition();  
5986
			break;
6889
			break;
5987
 
6890
 
5988
    case 398 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
6891
    case 440 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
5989
		    consumeUnaryExpression(OperatorIds.PLUS);  
6892
		    consumeUnaryExpression(OperatorIds.PLUS);  
5990
			break;
6893
			break;
5991
 
6894
 
5992
    case 399 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
6895
    case 441 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); }  //$NON-NLS-1$
5993
		    consumeUnaryExpression(OperatorIds.MINUS);  
6896
		    consumeUnaryExpression(OperatorIds.MINUS);  
5994
			break;
6897
			break;
5995
 
6898
 
5996
    case 401 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); }  //$NON-NLS-1$
6899
    case 443 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); }  //$NON-NLS-1$
5997
		    consumeUnaryExpression(OperatorIds.PLUS,false);  
6900
		    consumeUnaryExpression(OperatorIds.PLUS,false);  
5998
			break;
6901
			break;
5999
 
6902
 
6000
    case 402 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); }  //$NON-NLS-1$
6903
    case 444 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); }  //$NON-NLS-1$
6001
		    consumeUnaryExpression(OperatorIds.MINUS,false);  
6904
		    consumeUnaryExpression(OperatorIds.MINUS,false);  
6002
			break;
6905
			break;
6003
 
6906
 
6004
    case 404 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); }  //$NON-NLS-1$
6907
    case 446 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); }  //$NON-NLS-1$
6005
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
6908
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
6006
			break;
6909
			break;
6007
 
6910
 
6008
    case 405 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); }  //$NON-NLS-1$
6911
    case 447 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); }  //$NON-NLS-1$
6009
		    consumeUnaryExpression(OperatorIds.NOT);  
6912
		    consumeUnaryExpression(OperatorIds.NOT);  
6010
			break;
6913
			break;
6011
 
6914
 
6012
    case 407 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); }  //$NON-NLS-1$
6915
    case 449 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); }  //$NON-NLS-1$
6013
		    consumeCastExpressionWithPrimitiveType();  
6916
		    consumeCastExpressionWithPrimitiveType();  
6014
			break;
6917
			break;
6015
 
6918
 
6016
    case 408 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6919
    case 450 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers PrimitiveType..."); }  //$NON-NLS-1$
6920
		    consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations();  
6921
			break;
6922
 
6923
    case 451 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6017
		    consumeCastExpressionWithGenericsArray();  
6924
		    consumeCastExpressionWithGenericsArray();  
6018
			break;
6925
			break;
6019
 
6926
 
6020
    case 409 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6927
    case 452 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); }  //$NON-NLS-1$
6928
		    consumeCastExpressionWithGenericsArrayWithTypeAnnotations();  
6929
			break;
6930
 
6931
    case 453 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6021
		    consumeCastExpressionWithQualifiedGenericsArray();  
6932
		    consumeCastExpressionWithQualifiedGenericsArray();  
6022
			break;
6933
			break;
6023
 
6934
 
6024
    case 410 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); }  //$NON-NLS-1$
6935
    case 454 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); }  //$NON-NLS-1$
6936
		    consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations();  
6937
			break;
6938
 
6939
    case 455 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); }  //$NON-NLS-1$
6025
		    consumeCastExpressionLL1();  
6940
		    consumeCastExpressionLL1();  
6026
			break;
6941
			break;
6027
 
6942
 
6028
    case 411 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); }  //$NON-NLS-1$
6943
    case 456 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name..."); }  //$NON-NLS-1$
6944
		    consumeCastExpressionLL1WithTypeAnnotations();  
6945
			break;
6946
 
6947
    case 457 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); }  //$NON-NLS-1$
6029
		    consumeCastExpressionWithNameArray();  
6948
		    consumeCastExpressionWithNameArray();  
6030
			break;
6949
			break;
6031
 
6950
 
6032
    case 412 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); }  //$NON-NLS-1$
6951
    case 458 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Modifiers Name Dims..."); }  //$NON-NLS-1$
6952
		    consumeCastExpressionWithNameArrayWithTypeAnnotations();  
6953
			break;
6954
 
6955
    case 459 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); }  //$NON-NLS-1$
6033
		    consumeOnlyTypeArgumentsForCastExpression();  
6956
		    consumeOnlyTypeArgumentsForCastExpression();  
6034
			break;
6957
			break;
6035
 
6958
 
6036
    case 413 : if (DEBUG) { System.out.println("InsideCastExpression ::="); }  //$NON-NLS-1$
6959
    case 460 : if (DEBUG) { System.out.println("InsideCastExpression ::="); }  //$NON-NLS-1$
6037
		    consumeInsideCastExpression();  
6960
		    consumeInsideCastExpression();  
6038
			break;
6961
			break;
6039
 
6962
 
6040
    case 414 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); }  //$NON-NLS-1$
6963
    case 461 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); }  //$NON-NLS-1$
6041
		    consumeInsideCastExpressionLL1();  
6964
		    consumeInsideCastExpressionLL1();  
6042
			break;
6965
			break;
6043
 
6966
 
6044
    case 415 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); }  //$NON-NLS-1$
6967
    case 462 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); }  //$NON-NLS-1$
6045
		    consumeInsideCastExpressionWithQualifiedGenerics();  
6968
		    consumeInsideCastExpressionWithQualifiedGenerics();  
6046
			break;
6969
			break;
6047
 
6970
 
6048
    case 417 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6971
    case 463 : if (DEBUG) { System.out.println("InsideCastExpressionWithAnnotatedQualifiedGenerics ::="); }  //$NON-NLS-1$
6972
		    consumeInsideCastExpressionWithAnnotatedQualifiedGenerics();  
6973
			break;
6974
 
6975
    case 465 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6049
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
6976
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
6050
			break;
6977
			break;
6051
 
6978
 
6052
    case 418 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6979
    case 466 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6053
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
6980
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
6054
			break;
6981
			break;
6055
 
6982
 
6056
    case 419 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6983
    case 467 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); }  //$NON-NLS-1$
6057
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
6984
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
6058
			break;
6985
			break;
6059
 
6986
 
6060
    case 421 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); }  //$NON-NLS-1$
6987
    case 469 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); }  //$NON-NLS-1$
6061
		    consumeBinaryExpression(OperatorIds.PLUS);  
6988
		    consumeBinaryExpression(OperatorIds.PLUS);  
6062
			break;
6989
			break;
6063
 
6990
 
6064
    case 422 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); }  //$NON-NLS-1$
6991
    case 470 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); }  //$NON-NLS-1$
6065
		    consumeBinaryExpression(OperatorIds.MINUS);  
6992
		    consumeBinaryExpression(OperatorIds.MINUS);  
6066
			break;
6993
			break;
6067
 
6994
 
6068
    case 424 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); }  //$NON-NLS-1$
6995
    case 472 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); }  //$NON-NLS-1$
6069
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
6996
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
6070
			break;
6997
			break;
6071
 
6998
 
6072
    case 425 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); }  //$NON-NLS-1$
6999
    case 473 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); }  //$NON-NLS-1$
6073
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
7000
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
6074
			break;
7001
			break;
6075
 
7002
 
6076
    case 426 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
7003
    case 474 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
6077
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
7004
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
6078
			break;
7005
			break;
6079
 
7006
 
6080
    case 428 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); }  //$NON-NLS-1$
7007
    case 476 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); }  //$NON-NLS-1$
6081
		    consumeBinaryExpression(OperatorIds.LESS);  
7008
		    consumeBinaryExpression(OperatorIds.LESS);  
6082
			break;
7009
			break;
6083
 
7010
 
6084
    case 429 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); }  //$NON-NLS-1$
7011
    case 477 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); }  //$NON-NLS-1$
6085
		    consumeBinaryExpression(OperatorIds.GREATER);  
7012
		    consumeBinaryExpression(OperatorIds.GREATER);  
6086
			break;
7013
			break;
6087
 
7014
 
6088
    case 430 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); }  //$NON-NLS-1$
7015
    case 478 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); }  //$NON-NLS-1$
6089
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
7016
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
6090
			break;
7017
			break;
6091
 
7018
 
6092
    case 431 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); }  //$NON-NLS-1$
7019
    case 479 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); }  //$NON-NLS-1$
6093
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
7020
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
6094
			break;
7021
			break;
6095
 
7022
 
6096
    case 433 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); }  //$NON-NLS-1$
7023
    case 481 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); }  //$NON-NLS-1$
6097
		    consumeInstanceOfExpression();  
7024
		    consumeInstanceOfExpression();  
6098
			break;
7025
			break;
6099
 
7026
 
6100
    case 435 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); }  //$NON-NLS-1$
7027
    case 483 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); }  //$NON-NLS-1$
6101
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
7028
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
6102
			break;
7029
			break;
6103
 
7030
 
6104
    case 436 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); }  //$NON-NLS-1$
7031
    case 484 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); }  //$NON-NLS-1$
6105
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
7032
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
6106
			break;
7033
			break;
6107
 
7034
 
6108
    case 438 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); }  //$NON-NLS-1$
7035
    case 486 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); }  //$NON-NLS-1$
6109
		    consumeBinaryExpression(OperatorIds.AND);  
7036
		    consumeBinaryExpression(OperatorIds.AND);  
6110
			break;
7037
			break;
6111
 
7038
 
6112
    case 440 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); }  //$NON-NLS-1$
7039
    case 488 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); }  //$NON-NLS-1$
6113
		    consumeBinaryExpression(OperatorIds.XOR);  
7040
		    consumeBinaryExpression(OperatorIds.XOR);  
6114
			break;
7041
			break;
6115
 
7042
 
6116
    case 442 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); }  //$NON-NLS-1$
7043
    case 490 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); }  //$NON-NLS-1$
6117
		    consumeBinaryExpression(OperatorIds.OR);  
7044
		    consumeBinaryExpression(OperatorIds.OR);  
6118
			break;
7045
			break;
6119
 
7046
 
6120
    case 444 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); }  //$NON-NLS-1$
7047
    case 492 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); }  //$NON-NLS-1$
6121
		    consumeBinaryExpression(OperatorIds.AND_AND);  
7048
		    consumeBinaryExpression(OperatorIds.AND_AND);  
6122
			break;
7049
			break;
6123
 
7050
 
6124
    case 446 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
7051
    case 494 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
6125
		    consumeBinaryExpression(OperatorIds.OR_OR);  
7052
		    consumeBinaryExpression(OperatorIds.OR_OR);  
6126
			break;
7053
			break;
6127
 
7054
 
6128
    case 448 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
7055
    case 496 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); }  //$NON-NLS-1$
6129
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
7056
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
6130
			break;
7057
			break;
6131
 
7058
 
6132
    case 451 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); }  //$NON-NLS-1$
7059
    case 499 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); }  //$NON-NLS-1$
6133
		    consumeAssignment();  
7060
		    consumeAssignment();  
6134
			break;
7061
			break;
6135
 
7062
 
6136
    case 453 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); }  //$NON-NLS-1$
7063
    case 501 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); }  //$NON-NLS-1$
6137
		    ignoreExpressionAssignment(); 
7064
		    ignoreExpressionAssignment(); 
6138
			break;
7065
			break;
6139
 
7066
 
6140
    case 454 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); }  //$NON-NLS-1$
7067
    case 502 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); }  //$NON-NLS-1$
6141
		    consumeAssignmentOperator(EQUAL);  
7068
		    consumeAssignmentOperator(EQUAL);  
6142
			break;
7069
			break;
6143
 
7070
 
6144
    case 455 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); }  //$NON-NLS-1$
7071
    case 503 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); }  //$NON-NLS-1$
6145
		    consumeAssignmentOperator(MULTIPLY);  
7072
		    consumeAssignmentOperator(MULTIPLY);  
6146
			break;
7073
			break;
6147
 
7074
 
6148
    case 456 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); }  //$NON-NLS-1$
7075
    case 504 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); }  //$NON-NLS-1$
6149
		    consumeAssignmentOperator(DIVIDE);  
7076
		    consumeAssignmentOperator(DIVIDE);  
6150
			break;
7077
			break;
6151
 
7078
 
6152
    case 457 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); }  //$NON-NLS-1$
7079
    case 505 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); }  //$NON-NLS-1$
6153
		    consumeAssignmentOperator(REMAINDER);  
7080
		    consumeAssignmentOperator(REMAINDER);  
6154
			break;
7081
			break;
6155
 
7082
 
6156
    case 458 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); }  //$NON-NLS-1$
7083
    case 506 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); }  //$NON-NLS-1$
6157
		    consumeAssignmentOperator(PLUS);  
7084
		    consumeAssignmentOperator(PLUS);  
6158
			break;
7085
			break;
6159
 
7086
 
6160
    case 459 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); }  //$NON-NLS-1$
7087
    case 507 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); }  //$NON-NLS-1$
6161
		    consumeAssignmentOperator(MINUS);  
7088
		    consumeAssignmentOperator(MINUS);  
6162
			break;
7089
			break;
6163
 
7090
 
6164
    case 460 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); }  //$NON-NLS-1$
7091
    case 508 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); }  //$NON-NLS-1$
6165
		    consumeAssignmentOperator(LEFT_SHIFT);  
7092
		    consumeAssignmentOperator(LEFT_SHIFT);  
6166
			break;
7093
			break;
6167
 
7094
 
6168
    case 461 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
7095
    case 509 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
6169
		    consumeAssignmentOperator(RIGHT_SHIFT);  
7096
		    consumeAssignmentOperator(RIGHT_SHIFT);  
6170
			break;
7097
			break;
6171
 
7098
 
6172
    case 462 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
7099
    case 510 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); }  //$NON-NLS-1$
6173
		    consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);  
7100
		    consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);  
6174
			break;
7101
			break;
6175
 
7102
 
6176
    case 463 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); }  //$NON-NLS-1$
7103
    case 511 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); }  //$NON-NLS-1$
6177
		    consumeAssignmentOperator(AND);  
7104
		    consumeAssignmentOperator(AND);  
6178
			break;
7105
			break;
6179
 
7106
 
6180
    case 464 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); }  //$NON-NLS-1$
7107
    case 512 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); }  //$NON-NLS-1$
6181
		    consumeAssignmentOperator(XOR);  
7108
		    consumeAssignmentOperator(XOR);  
6182
			break;
7109
			break;
6183
 
7110
 
6184
    case 465 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); }  //$NON-NLS-1$
7111
    case 513 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); }  //$NON-NLS-1$
6185
		    consumeAssignmentOperator(OR);  
7112
		    consumeAssignmentOperator(OR);  
6186
			break;
7113
			break;
6187
 
7114
 
6188
    case 469 : if (DEBUG) { System.out.println("Expressionopt ::="); }  //$NON-NLS-1$
7115
    case 517 : if (DEBUG) { System.out.println("Expressionopt ::="); }  //$NON-NLS-1$
6189
		    consumeEmptyExpression();  
7116
		    consumeEmptyExpression();  
6190
			break;
7117
			break;
6191
 
7118
 
6192
    case 474 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); }  //$NON-NLS-1$
7119
    case 522 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); }  //$NON-NLS-1$
6193
		    consumeEmptyClassBodyDeclarationsopt();  
7120
		    consumeEmptyClassBodyDeclarationsopt();  
6194
			break;
7121
			break;
6195
 
7122
 
6196
    case 475 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7123
    case 523 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
6197
		    consumeClassBodyDeclarationsopt();  
7124
		    consumeClassBodyDeclarationsopt();  
6198
			break;
7125
			break;
6199
 
7126
 
6200
     case 476 : if (DEBUG) { System.out.println("Modifiersopt ::="); }  //$NON-NLS-1$
7127
     case 524 : if (DEBUG) { System.out.println("Modifiersopt ::="); }  //$NON-NLS-1$
6201
		    consumeDefaultModifiers();  
7128
		    consumeDefaultModifiers();  
6202
			break;
7129
			break;
6203
 
7130
 
6204
    case 477 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); }  //$NON-NLS-1$
7131
    case 525 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); }  //$NON-NLS-1$
6205
		    consumeModifiers();  
7132
		    consumeModifiers();  
6206
			break;
7133
			break;
6207
 
7134
 
6208
    case 478 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); }  //$NON-NLS-1$
7135
    case 526 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); }  //$NON-NLS-1$
6209
		    consumeEmptyBlockStatementsopt();  
7136
		    consumeEmptyBlockStatementsopt();  
6210
			break;
7137
			break;
6211
 
7138
 
6212
     case 480 : if (DEBUG) { System.out.println("Dimsopt ::="); }  //$NON-NLS-1$
7139
     case 528 : if (DEBUG) { System.out.println("Dimsopt ::="); }  //$NON-NLS-1$
6213
		    consumeEmptyDimsopt();  
7140
		    consumeEmptyDimsopt();  
6214
			break;
7141
			break;
6215
 
7142
 
6216
     case 482 : if (DEBUG) { System.out.println("ArgumentListopt ::="); }  //$NON-NLS-1$
7143
     case 530 : if (DEBUG) { System.out.println("ArgumentListopt ::="); }  //$NON-NLS-1$
6217
		    consumeEmptyArgumentListopt();  
7144
		    consumeEmptyArgumentListopt();  
6218
			break;
7145
			break;
6219
 
7146
 
6220
    case 486 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); }  //$NON-NLS-1$
7147
    case 534 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); }  //$NON-NLS-1$
6221
		    consumeFormalParameterListopt();  
7148
		    consumeFormalParameterListopt();  
6222
			break;
7149
			break;
6223
 
7150
 
6224
     case 490 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); }  //$NON-NLS-1$
7151
     case 538 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); }  //$NON-NLS-1$
6225
		    consumeEmptyInterfaceMemberDeclarationsopt();  
7152
		    consumeEmptyInterfaceMemberDeclarationsopt();  
6226
			break;
7153
			break;
6227
 
7154
 
6228
     case 491 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7155
     case 539 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
6229
		    consumeInterfaceMemberDeclarationsopt();  
7156
		    consumeInterfaceMemberDeclarationsopt();  
6230
			break;
7157
			break;
6231
 
7158
 
6232
    case 492 : if (DEBUG) { System.out.println("NestedType ::="); }  //$NON-NLS-1$
7159
    case 540 : if (DEBUG) { System.out.println("NestedType ::="); }  //$NON-NLS-1$
6233
		    consumeNestedType();  
7160
		    consumeNestedType();  
6234
			break;
7161
			break;
6235
7162
6236
     case 493 : if (DEBUG) { System.out.println("ForInitopt ::="); }  //$NON-NLS-1$
7163
     case 541 : if (DEBUG) { System.out.println("ForInitopt ::="); }  //$NON-NLS-1$
6237
		    consumeEmptyForInitopt();  
7164
		    consumeEmptyForInitopt();  
6238
			break;
7165
			break;
6239
 
7166
 
6240
     case 495 : if (DEBUG) { System.out.println("ForUpdateopt ::="); }  //$NON-NLS-1$
7167
     case 543 : if (DEBUG) { System.out.println("ForUpdateopt ::="); }  //$NON-NLS-1$
6241
		    consumeEmptyForUpdateopt();  
7168
		    consumeEmptyForUpdateopt();  
6242
			break;
7169
			break;
6243
 
7170
 
6244
     case 499 : if (DEBUG) { System.out.println("Catchesopt ::="); }  //$NON-NLS-1$
7171
     case 547 : if (DEBUG) { System.out.println("Catchesopt ::="); }  //$NON-NLS-1$
6245
		    consumeEmptyCatchesopt();  
7172
		    consumeEmptyCatchesopt();  
6246
			break;
7173
			break;
6247
 
7174
 
6248
     case 501 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); }  //$NON-NLS-1$
7175
     case 549 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); }  //$NON-NLS-1$
6249
		    consumeEnumDeclaration();  
7176
		    consumeEnumDeclaration();  
6250
			break;
7177
			break;
6251
 
7178
 
6252
     case 502 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); }  //$NON-NLS-1$
7179
     case 550 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); }  //$NON-NLS-1$
6253
		    consumeEnumHeader();  
7180
		    consumeEnumHeader();  
6254
			break;
7181
			break;
6255
 
7182
 
6256
     case 503 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); }  //$NON-NLS-1$
7183
     case 551 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); }  //$NON-NLS-1$
6257
		    consumeEnumHeaderName();  
7184
		    consumeEnumHeaderName();  
6258
			break;
7185
			break;
6259
 
7186
 
6260
     case 504 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); }  //$NON-NLS-1$
7187
     case 552 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); }  //$NON-NLS-1$
6261
		    consumeEnumHeaderNameWithTypeParameters();  
7188
		    consumeEnumHeaderNameWithTypeParameters();  
6262
			break;
7189
			break;
6263
 
7190
 
6264
     case 505 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); }  //$NON-NLS-1$
7191
     case 553 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); }  //$NON-NLS-1$
6265
		    consumeEnumBodyNoConstants();  
7192
		    consumeEnumBodyNoConstants();  
6266
			break;
7193
			break;
6267
 
7194
 
6268
     case 506 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); }  //$NON-NLS-1$
7195
     case 554 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); }  //$NON-NLS-1$
6269
		    consumeEnumBodyNoConstants();  
7196
		    consumeEnumBodyNoConstants();  
6270
			break;
7197
			break;
6271
 
7198
 
6272
     case 507 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); }  //$NON-NLS-1$
7199
     case 555 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); }  //$NON-NLS-1$
6273
		    consumeEnumBodyWithConstants();  
7200
		    consumeEnumBodyWithConstants();  
6274
			break;
7201
			break;
6275
 
7202
 
6276
     case 508 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); }  //$NON-NLS-1$
7203
     case 556 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); }  //$NON-NLS-1$
6277
		    consumeEnumBodyWithConstants();  
7204
		    consumeEnumBodyWithConstants();  
6278
			break;
7205
			break;
6279
 
7206
 
6280
    case 510 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); }  //$NON-NLS-1$
7207
    case 558 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); }  //$NON-NLS-1$
6281
		    consumeEnumConstants();  
7208
		    consumeEnumConstants();  
6282
			break;
7209
			break;
6283
 
7210
 
6284
    case 511 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); }  //$NON-NLS-1$
7211
    case 559 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); }  //$NON-NLS-1$
6285
		    consumeEnumConstantHeaderName();  
7212
		    consumeEnumConstantHeaderName();  
6286
			break;
7213
			break;
6287
 
7214
 
6288
    case 512 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); }  //$NON-NLS-1$
7215
    case 560 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); }  //$NON-NLS-1$
6289
		    consumeEnumConstantHeader();  
7216
		    consumeEnumConstantHeader();  
6290
			break;
7217
			break;
6291
 
7218
 
6292
    case 513 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); }  //$NON-NLS-1$
7219
    case 561 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); }  //$NON-NLS-1$
6293
		    consumeEnumConstantWithClassBody();  
7220
		    consumeEnumConstantWithClassBody();  
6294
			break;
7221
			break;
6295
 
7222
 
6296
    case 514 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); }  //$NON-NLS-1$
7223
    case 562 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); }  //$NON-NLS-1$
6297
		    consumeEnumConstantNoClassBody();  
7224
		    consumeEnumConstantNoClassBody();  
6298
			break;
7225
			break;
6299
 
7226
 
6300
    case 515 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
7227
    case 563 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); }  //$NON-NLS-1$
6301
		    consumeArguments();  
7228
		    consumeArguments();  
6302
			break;
7229
			break;
6303
 
7230
 
6304
    case 516 : if (DEBUG) { System.out.println("Argumentsopt ::="); }  //$NON-NLS-1$
7231
    case 564 : if (DEBUG) { System.out.println("Argumentsopt ::="); }  //$NON-NLS-1$
6305
		    consumeEmptyArguments();  
7232
		    consumeEmptyArguments();  
6306
			break;
7233
			break;
6307
 
7234
 
6308
    case 518 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); }  //$NON-NLS-1$
7235
    case 566 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); }  //$NON-NLS-1$
6309
		    consumeEnumDeclarations();  
7236
		    consumeEnumDeclarations();  
6310
			break;
7237
			break;
6311
 
7238
 
6312
    case 519 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); }  //$NON-NLS-1$
7239
    case 567 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); }  //$NON-NLS-1$
6313
		    consumeEmptyEnumDeclarations();  
7240
		    consumeEmptyEnumDeclarations();  
6314
			break;
7241
			break;
6315
 
7242
 
6316
    case 521 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); }  //$NON-NLS-1$
7243
    case 569 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); }  //$NON-NLS-1$
6317
		    consumeEnhancedForStatement();  
7244
		    consumeEnhancedForStatement();  
6318
			break;
7245
			break;
6319
 
7246
 
6320
    case 522 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); }  //$NON-NLS-1$
7247
    case 570 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); }  //$NON-NLS-1$
6321
		    consumeEnhancedForStatement();  
7248
		    consumeEnhancedForStatement();  
6322
			break;
7249
			break;
6323
 
7250
 
6324
    case 523 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); }  //$NON-NLS-1$
7251
    case 571 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type0..."); }  //$NON-NLS-1$
6325
		    consumeEnhancedForStatementHeaderInit(false);  
7252
		    consumeEnhancedForStatementHeaderInit(false);  
6326
			break;
7253
			break;
6327
 
7254
 
6328
    case 524 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); }  //$NON-NLS-1$
7255
    case 572 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); }  //$NON-NLS-1$
6329
		    consumeEnhancedForStatementHeaderInit(true);  
7256
		    consumeEnhancedForStatementHeaderInit(true);  
6330
			break;
7257
			break;
6331
 
7258
 
6332
    case 525 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); }  //$NON-NLS-1$
7259
    case 573 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); }  //$NON-NLS-1$
6333
		    consumeEnhancedForStatementHeader();  
7260
		    consumeEnhancedForStatementHeader();  
6334
			break;
7261
			break;
6335
 
7262
 
6336
    case 526 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); }  //$NON-NLS-1$
7263
    case 574 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); }  //$NON-NLS-1$
6337
		    consumeImportDeclaration();  
7264
		    consumeImportDeclaration();  
6338
			break;
7265
			break;
6339
 
7266
 
6340
    case 527 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); }  //$NON-NLS-1$
7267
    case 575 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); }  //$NON-NLS-1$
6341
		    consumeSingleStaticImportDeclarationName();  
7268
		    consumeSingleStaticImportDeclarationName();  
6342
			break;
7269
			break;
6343
 
7270
 
6344
    case 528 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
7271
    case 576 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); }  //$NON-NLS-1$
6345
		    consumeImportDeclaration();  
7272
		    consumeImportDeclaration();  
6346
			break;
7273
			break;
6347
 
7274
 
6348
    case 529 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); }  //$NON-NLS-1$
7275
    case 577 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); }  //$NON-NLS-1$
6349
		    consumeStaticImportOnDemandDeclarationName();  
7276
		    consumeStaticImportOnDemandDeclarationName();  
6350
			break;
7277
			break;
6351
 
7278
 
6352
    case 530 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
7279
    case 578 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
6353
		    consumeTypeArguments();  
7280
		    consumeTypeArguments();  
6354
			break;
7281
			break;
6355
 
7282
 
6356
    case 531 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
7283
    case 579 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); }  //$NON-NLS-1$
6357
		    consumeOnlyTypeArguments();  
7284
		    consumeOnlyTypeArguments();  
6358
			break;
7285
			break;
6359
 
7286
 
6360
    case 533 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
7287
    case 581 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
6361
		    consumeTypeArgumentList1();  
7288
		    consumeTypeArgumentList1();  
6362
			break;
7289
			break;
6363
 
7290
 
6364
    case 535 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); }  //$NON-NLS-1$
7291
    case 583 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); }  //$NON-NLS-1$
6365
		    consumeTypeArgumentList();  
7292
		    consumeTypeArgumentList();  
6366
			break;
7293
			break;
6367
 
7294
 
6368
    case 536 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); }  //$NON-NLS-1$
7295
    case 584 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); }  //$NON-NLS-1$
6369
		    consumeTypeArgument();  
7296
		    consumeTypeArgument();  
6370
			break;
7297
			break;
6371
 
7298
 
6372
    case 540 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); }  //$NON-NLS-1$
7299
    case 588 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); }  //$NON-NLS-1$
6373
		    consumeReferenceType1();  
7300
		    consumeReferenceType1();  
6374
			break;
7301
			break;
6375
 
7302
 
6376
    case 541 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
7303
    case 589 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
6377
		    consumeTypeArgumentReferenceType1();  
7304
		    consumeTypeArgumentReferenceType1();  
6378
			break;
7305
			break;
6379
 
7306
 
6380
    case 543 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
7307
    case 590 : if (DEBUG) { System.out.println("ReferenceType1 ::= Modifiers ClassOrInterface LESS..."); }  //$NON-NLS-1$
7308
		    consumeTypeArgumentReferenceType1WithTypeAnnotations();  
7309
			break;
7310
 
7311
    case 592 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
6381
		    consumeTypeArgumentList2();  
7312
		    consumeTypeArgumentList2();  
6382
			break;
7313
			break;
6383
 
7314
 
6384
    case 546 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); }  //$NON-NLS-1$
7315
    case 595 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); }  //$NON-NLS-1$
6385
		    consumeReferenceType2();  
7316
		    consumeReferenceType2();  
6386
			break;
7317
			break;
6387
 
7318
 
6388
    case 547 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
7319
    case 596 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); }  //$NON-NLS-1$
6389
		    consumeTypeArgumentReferenceType2();  
7320
		    consumeTypeArgumentReferenceType2();  
6390
			break;
7321
			break;
6391
 
7322
 
6392
    case 549 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
7323
    case 597 : if (DEBUG) { System.out.println("ReferenceType2 ::= Modifiers ClassOrInterface LESS..."); }  //$NON-NLS-1$
7324
		    consumeTypeArgumentReferenceType2WithTypeAnnotations();  
7325
			break;
7326
 
7327
    case 599 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); }  //$NON-NLS-1$
6393
		    consumeTypeArgumentList3();  
7328
		    consumeTypeArgumentList3();  
6394
			break;
7329
			break;
6395
 
7330
 
6396
    case 552 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
7331
    case 602 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
6397
		    consumeReferenceType3();  
7332
		    consumeReferenceType3();  
6398
			break;
7333
			break;
6399
 
7334
 
6400
    case 553 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); }  //$NON-NLS-1$
7335
    case 603 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); }  //$NON-NLS-1$
6401
		    consumeWildcard();  
7336
		    consumeWildcard();  
6402
			break;
7337
			break;
6403
 
7338
 
6404
    case 554 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); }  //$NON-NLS-1$
7339
    case 604 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); }  //$NON-NLS-1$
6405
		    consumeWildcardWithBounds();  
7340
		    consumeWildcardWithBounds();  
6406
			break;
7341
			break;
6407
 
7342
 
6408
    case 555 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); }  //$NON-NLS-1$
7343
    case 605 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); }  //$NON-NLS-1$
6409
		    consumeWildcardBoundsExtends();  
7344
		    consumeWildcardBoundsExtends();  
6410
			break;
7345
			break;
6411
 
7346
 
6412
    case 556 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); }  //$NON-NLS-1$
7347
    case 606 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); }  //$NON-NLS-1$
6413
		    consumeWildcardBoundsSuper();  
7348
		    consumeWildcardBoundsSuper();  
6414
			break;
7349
			break;
6415
 
7350
 
6416
    case 557 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); }  //$NON-NLS-1$
7351
    case 607 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); }  //$NON-NLS-1$
6417
		    consumeWildcard1();  
7352
		    consumeWildcard1();  
6418
			break;
7353
			break;
6419
 
7354
 
6420
    case 558 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); }  //$NON-NLS-1$
7355
    case 608 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); }  //$NON-NLS-1$
6421
		    consumeWildcard1WithBounds();  
7356
		    consumeWildcard1WithBounds();  
6422
			break;
7357
			break;
6423
 
7358
 
6424
    case 559 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); }  //$NON-NLS-1$
7359
    case 609 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); }  //$NON-NLS-1$
6425
		    consumeWildcardBounds1Extends();  
7360
		    consumeWildcardBounds1Extends();  
6426
			break;
7361
			break;
6427
 
7362
 
6428
    case 560 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); }  //$NON-NLS-1$
7363
    case 610 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); }  //$NON-NLS-1$
6429
		    consumeWildcardBounds1Super();  
7364
		    consumeWildcardBounds1Super();  
6430
			break;
7365
			break;
6431
 
7366
 
6432
    case 561 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); }  //$NON-NLS-1$
7367
    case 611 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); }  //$NON-NLS-1$
6433
		    consumeWildcard2();  
7368
		    consumeWildcard2();  
6434
			break;
7369
			break;
6435
 
7370
 
6436
    case 562 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); }  //$NON-NLS-1$
7371
    case 612 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); }  //$NON-NLS-1$
6437
		    consumeWildcard2WithBounds();  
7372
		    consumeWildcard2WithBounds();  
6438
			break;
7373
			break;
6439
 
7374
 
6440
    case 563 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); }  //$NON-NLS-1$
7375
    case 613 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); }  //$NON-NLS-1$
6441
		    consumeWildcardBounds2Extends();  
7376
		    consumeWildcardBounds2Extends();  
6442
			break;
7377
			break;
6443
 
7378
 
6444
    case 564 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); }  //$NON-NLS-1$
7379
    case 614 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); }  //$NON-NLS-1$
6445
		    consumeWildcardBounds2Super();  
7380
		    consumeWildcardBounds2Super();  
6446
			break;
7381
			break;
6447
 
7382
 
6448
    case 565 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
7383
    case 615 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); }  //$NON-NLS-1$
6449
		    consumeWildcard3();  
7384
		    consumeWildcard3();  
6450
			break;
7385
			break;
6451
 
7386
 
6452
    case 566 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); }  //$NON-NLS-1$
7387
    case 616 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); }  //$NON-NLS-1$
6453
		    consumeWildcard3WithBounds();  
7388
		    consumeWildcard3WithBounds();  
6454
			break;
7389
			break;
6455
 
7390
 
6456
    case 567 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); }  //$NON-NLS-1$
7391
    case 617 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); }  //$NON-NLS-1$
6457
		    consumeWildcardBounds3Extends();  
7392
		    consumeWildcardBounds3Extends();  
6458
			break;
7393
			break;
6459
 
7394
 
6460
    case 568 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); }  //$NON-NLS-1$
7395
    case 618 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); }  //$NON-NLS-1$
6461
		    consumeWildcardBounds3Super();  
7396
		    consumeWildcardBounds3Super();  
6462
			break;
7397
			break;
6463
 
7398
 
6464
    case 569 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); }  //$NON-NLS-1$
7399
    case 619 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); }  //$NON-NLS-1$
7400
		    consumeZeroTypeAnnotations(true);  
7401
			break;
7402
 
7403
    case 620 : if (DEBUG) { System.out.println("TypeParameterHeader ::= PushZeroTypeAnnotations..."); }  //$NON-NLS-1$
7404
		    consumeTypeParameterHeader();  
7405
			break;
7406
 
7407
    case 621 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotations Identifier"); }  //$NON-NLS-1$
6465
		    consumeTypeParameterHeader();  
7408
		    consumeTypeParameterHeader();  
6466
			break;
7409
			break;
6467
 
7410
 
6468
    case 570 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); }  //$NON-NLS-1$
7411
    case 622 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); }  //$NON-NLS-1$
6469
		    consumeTypeParameters();  
7412
		    consumeTypeParameters();  
6470
			break;
7413
			break;
6471
 
7414
 
6472
    case 572 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
7415
    case 624 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
6473
		    consumeTypeParameterList();  
7416
		    consumeTypeParameterList();  
6474
			break;
7417
			break;
6475
 
7418
 
6476
    case 574 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7419
    case 626 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6477
		    consumeTypeParameterWithExtends();  
7420
		    consumeTypeParameterWithExtends();  
6478
			break;
7421
			break;
6479
 
7422
 
6480
    case 575 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7423
    case 627 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6481
		    consumeTypeParameterWithExtendsAndBounds();  
7424
		    consumeTypeParameterWithExtendsAndBounds();  
6482
			break;
7425
			break;
6483
 
7426
 
6484
    case 577 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); }  //$NON-NLS-1$
7427
    case 629 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); }  //$NON-NLS-1$
6485
		    consumeAdditionalBoundList();  
7428
		    consumeAdditionalBoundList();  
6486
			break;
7429
			break;
6487
 
7430
 
6488
    case 578 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); }  //$NON-NLS-1$
7431
    case 630 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); }  //$NON-NLS-1$
6489
		    consumeAdditionalBound();  
7432
		    consumeAdditionalBound();  
6490
			break;
7433
			break;
6491
 
7434
 
6492
    case 580 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
7435
    case 632 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); }  //$NON-NLS-1$
6493
		    consumeTypeParameterList1();  
7436
		    consumeTypeParameterList1();  
6494
			break;
7437
			break;
6495
 
7438
 
6496
    case 581 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); }  //$NON-NLS-1$
7439
    case 633 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); }  //$NON-NLS-1$
6497
		    consumeTypeParameter1();  
7440
		    consumeTypeParameter1();  
6498
			break;
7441
			break;
6499
 
7442
 
6500
    case 582 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7443
    case 634 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6501
		    consumeTypeParameter1WithExtends();  
7444
		    consumeTypeParameter1WithExtends();  
6502
			break;
7445
			break;
6503
 
7446
 
6504
    case 583 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
7447
    case 635 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); }  //$NON-NLS-1$
6505
		    consumeTypeParameter1WithExtendsAndBounds();  
7448
		    consumeTypeParameter1WithExtendsAndBounds();  
6506
			break;
7449
			break;
6507
 
7450
 
6508
    case 585 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); }  //$NON-NLS-1$
7451
    case 637 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); }  //$NON-NLS-1$
6509
		    consumeAdditionalBoundList1();  
7452
		    consumeAdditionalBoundList1();  
6510
			break;
7453
			break;
6511
 
7454
 
6512
    case 586 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); }  //$NON-NLS-1$
7455
    case 638 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); }  //$NON-NLS-1$
6513
		    consumeAdditionalBound1();  
7456
		    consumeAdditionalBound1();  
6514
			break;
7457
			break;
6515
 
7458
 
6516
    case 592 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); }  //$NON-NLS-1$
7459
    case 644 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); }  //$NON-NLS-1$
6517
		    consumeUnaryExpression(OperatorIds.PLUS);  
7460
		    consumeUnaryExpression(OperatorIds.PLUS);  
6518
			break;
7461
			break;
6519
 
7462
 
6520
    case 593 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); }  //$NON-NLS-1$
7463
    case 645 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); }  //$NON-NLS-1$
6521
		    consumeUnaryExpression(OperatorIds.MINUS);  
7464
		    consumeUnaryExpression(OperatorIds.MINUS);  
6522
			break;
7465
			break;
6523
 
7466
 
6524
    case 596 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); }  //$NON-NLS-1$
7467
    case 648 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); }  //$NON-NLS-1$
6525
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
7468
		    consumeUnaryExpression(OperatorIds.TWIDDLE);  
6526
			break;
7469
			break;
6527
 
7470
 
6528
    case 597 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); }  //$NON-NLS-1$
7471
    case 649 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); }  //$NON-NLS-1$
6529
		    consumeUnaryExpression(OperatorIds.NOT);  
7472
		    consumeUnaryExpression(OperatorIds.NOT);  
6530
			break;
7473
			break;
6531
 
7474
 
6532
    case 600 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
7475
    case 652 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
6533
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
7476
		    consumeBinaryExpression(OperatorIds.MULTIPLY);  
6534
			break;
7477
			break;
6535
 
7478
 
6536
    case 601 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); }  //$NON-NLS-1$
7479
    case 653 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); }  //$NON-NLS-1$
6537
		    consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);  
7480
		    consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);  
6538
			break;
7481
			break;
6539
 
7482
 
6540
    case 602 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
7483
    case 654 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
6541
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
7484
		    consumeBinaryExpression(OperatorIds.DIVIDE);  
6542
			break;
7485
			break;
6543
 
7486
 
6544
    case 603 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); }  //$NON-NLS-1$
7487
    case 655 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); }  //$NON-NLS-1$
6545
		    consumeBinaryExpressionWithName(OperatorIds.DIVIDE);  
7488
		    consumeBinaryExpressionWithName(OperatorIds.DIVIDE);  
6546
			break;
7489
			break;
6547
 
7490
 
6548
    case 604 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
7491
    case 656 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); }  //$NON-NLS-1$
6549
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
7492
		    consumeBinaryExpression(OperatorIds.REMAINDER);  
6550
			break;
7493
			break;
6551
 
7494
 
6552
    case 605 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); }  //$NON-NLS-1$
7495
    case 657 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); }  //$NON-NLS-1$
6553
		    consumeBinaryExpressionWithName(OperatorIds.REMAINDER);  
7496
		    consumeBinaryExpressionWithName(OperatorIds.REMAINDER);  
6554
			break;
7497
			break;
6555
 
7498
 
6556
    case 607 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
7499
    case 659 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
6557
		    consumeBinaryExpression(OperatorIds.PLUS);  
7500
		    consumeBinaryExpression(OperatorIds.PLUS);  
6558
			break;
7501
			break;
6559
 
7502
 
6560
    case 608 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); }  //$NON-NLS-1$
7503
    case 660 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); }  //$NON-NLS-1$
6561
		    consumeBinaryExpressionWithName(OperatorIds.PLUS);  
7504
		    consumeBinaryExpressionWithName(OperatorIds.PLUS);  
6562
			break;
7505
			break;
6563
 
7506
 
6564
    case 609 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
7507
    case 661 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); }  //$NON-NLS-1$
6565
		    consumeBinaryExpression(OperatorIds.MINUS);  
7508
		    consumeBinaryExpression(OperatorIds.MINUS);  
6566
			break;
7509
			break;
6567
 
7510
 
6568
    case 610 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); }  //$NON-NLS-1$
7511
    case 662 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); }  //$NON-NLS-1$
6569
		    consumeBinaryExpressionWithName(OperatorIds.MINUS);  
7512
		    consumeBinaryExpressionWithName(OperatorIds.MINUS);  
6570
			break;
7513
			break;
6571
 
7514
 
6572
    case 612 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
7515
    case 664 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
6573
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
7516
		    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);  
6574
			break;
7517
			break;
6575
 
7518
 
6576
    case 613 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); }  //$NON-NLS-1$
7519
    case 665 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); }  //$NON-NLS-1$
6577
		    consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);  
7520
		    consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);  
6578
			break;
7521
			break;
6579
 
7522
 
6580
    case 614 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
7523
    case 666 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
6581
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
7524
		    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);  
6582
			break;
7525
			break;
6583
 
7526
 
6584
    case 615 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); }  //$NON-NLS-1$
7527
    case 667 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); }  //$NON-NLS-1$
6585
		    consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);  
7528
		    consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);  
6586
			break;
7529
			break;
6587
 
7530
 
6588
    case 616 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
7531
    case 668 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); }  //$NON-NLS-1$
6589
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
7532
		    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
6590
			break;
7533
			break;
6591
 
7534
 
6592
    case 617 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); }  //$NON-NLS-1$
7535
    case 669 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); }  //$NON-NLS-1$
6593
		    consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
7536
		    consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);  
6594
			break;
7537
			break;
6595
 
7538
 
6596
    case 619 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
7539
    case 671 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
6597
		    consumeBinaryExpression(OperatorIds.LESS);  
7540
		    consumeBinaryExpression(OperatorIds.LESS);  
6598
			break;
7541
			break;
6599
 
7542
 
6600
    case 620 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); }  //$NON-NLS-1$
7543
    case 672 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); }  //$NON-NLS-1$
6601
		    consumeBinaryExpressionWithName(OperatorIds.LESS);  
7544
		    consumeBinaryExpressionWithName(OperatorIds.LESS);  
6602
			break;
7545
			break;
6603
 
7546
 
6604
    case 621 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
7547
    case 673 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); }  //$NON-NLS-1$
6605
		    consumeBinaryExpression(OperatorIds.GREATER);  
7548
		    consumeBinaryExpression(OperatorIds.GREATER);  
6606
			break;
7549
			break;
6607
 
7550
 
6608
    case 622 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); }  //$NON-NLS-1$
7551
    case 674 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); }  //$NON-NLS-1$
6609
		    consumeBinaryExpressionWithName(OperatorIds.GREATER);  
7552
		    consumeBinaryExpressionWithName(OperatorIds.GREATER);  
6610
			break;
7553
			break;
6611
 
7554
 
6612
    case 623 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
7555
    case 675 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
6613
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
7556
		    consumeBinaryExpression(OperatorIds.LESS_EQUAL);  
6614
			break;
7557
			break;
6615
 
7558
 
6616
    case 624 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); }  //$NON-NLS-1$
7559
    case 676 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); }  //$NON-NLS-1$
6617
		    consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);  
7560
		    consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);  
6618
			break;
7561
			break;
6619
 
7562
 
6620
    case 625 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
7563
    case 677 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); }  //$NON-NLS-1$
6621
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
7564
		    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);  
6622
			break;
7565
			break;
6623
 
7566
 
6624
    case 626 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); }  //$NON-NLS-1$
7567
    case 678 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); }  //$NON-NLS-1$
6625
		    consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);  
7568
		    consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);  
6626
			break;
7569
			break;
6627
 
7570
 
6628
    case 628 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); }  //$NON-NLS-1$
7571
    case 680 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); }  //$NON-NLS-1$
6629
		    consumeInstanceOfExpressionWithName();  
7572
		    consumeInstanceOfExpressionWithName();  
6630
			break;
7573
			break;
6631
 
7574
 
6632
    case 629 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); }  //$NON-NLS-1$
7575
    case 681 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); }  //$NON-NLS-1$
6633
		    consumeInstanceOfExpression();  
7576
		    consumeInstanceOfExpression();  
6634
			break;
7577
			break;
6635
 
7578
 
6636
    case 631 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
7579
    case 683 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
6637
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
7580
		    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);  
6638
			break;
7581
			break;
6639
 
7582
 
6640
    case 632 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); }  //$NON-NLS-1$
7583
    case 684 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); }  //$NON-NLS-1$
6641
		    consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);  
7584
		    consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);  
6642
			break;
7585
			break;
6643
 
7586
 
6644
    case 633 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
7587
    case 685 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); }  //$NON-NLS-1$
6645
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
7588
		    consumeEqualityExpression(OperatorIds.NOT_EQUAL);  
6646
			break;
7589
			break;
6647
 
7590
 
6648
    case 634 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); }  //$NON-NLS-1$
7591
    case 686 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); }  //$NON-NLS-1$
6649
		    consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);  
7592
		    consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);  
6650
			break;
7593
			break;
6651
 
7594
 
6652
    case 636 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); }  //$NON-NLS-1$
7595
    case 688 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); }  //$NON-NLS-1$
6653
		    consumeBinaryExpression(OperatorIds.AND);  
7596
		    consumeBinaryExpression(OperatorIds.AND);  
6654
			break;
7597
			break;
6655
 
7598
 
6656
    case 637 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); }  //$NON-NLS-1$
7599
    case 689 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); }  //$NON-NLS-1$
6657
		    consumeBinaryExpressionWithName(OperatorIds.AND);  
7600
		    consumeBinaryExpressionWithName(OperatorIds.AND);  
6658
			break;
7601
			break;
6659
 
7602
 
6660
    case 639 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
7603
    case 691 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
6661
		    consumeBinaryExpression(OperatorIds.XOR);  
7604
		    consumeBinaryExpression(OperatorIds.XOR);  
6662
			break;
7605
			break;
6663
 
7606
 
6664
    case 640 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); }  //$NON-NLS-1$
7607
    case 692 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); }  //$NON-NLS-1$
6665
		    consumeBinaryExpressionWithName(OperatorIds.XOR);  
7608
		    consumeBinaryExpressionWithName(OperatorIds.XOR);  
6666
			break;
7609
			break;
6667
 
7610
 
6668
    case 642 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
7611
    case 694 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); }  //$NON-NLS-1$
6669
		    consumeBinaryExpression(OperatorIds.OR);  
7612
		    consumeBinaryExpression(OperatorIds.OR);  
6670
			break;
7613
			break;
6671
 
7614
 
6672
    case 643 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); }  //$NON-NLS-1$
7615
    case 695 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); }  //$NON-NLS-1$
6673
		    consumeBinaryExpressionWithName(OperatorIds.OR);  
7616
		    consumeBinaryExpressionWithName(OperatorIds.OR);  
6674
			break;
7617
			break;
6675
 
7618
 
6676
    case 645 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); }  //$NON-NLS-1$
7619
    case 697 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); }  //$NON-NLS-1$
6677
		    consumeBinaryExpression(OperatorIds.AND_AND);  
7620
		    consumeBinaryExpression(OperatorIds.AND_AND);  
6678
			break;
7621
			break;
6679
 
7622
 
6680
    case 646 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); }  //$NON-NLS-1$
7623
    case 698 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); }  //$NON-NLS-1$
6681
		    consumeBinaryExpressionWithName(OperatorIds.AND_AND);  
7624
		    consumeBinaryExpressionWithName(OperatorIds.AND_AND);  
6682
			break;
7625
			break;
6683
 
7626
 
6684
    case 648 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); }  //$NON-NLS-1$
7627
    case 700 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); }  //$NON-NLS-1$
6685
		    consumeBinaryExpression(OperatorIds.OR_OR);  
7628
		    consumeBinaryExpression(OperatorIds.OR_OR);  
6686
			break;
7629
			break;
6687
 
7630
 
6688
    case 649 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); }  //$NON-NLS-1$
7631
    case 701 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); }  //$NON-NLS-1$
6689
		    consumeBinaryExpressionWithName(OperatorIds.OR_OR);  
7632
		    consumeBinaryExpressionWithName(OperatorIds.OR_OR);  
6690
			break;
7633
			break;
6691
 
7634
 
6692
    case 651 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); }  //$NON-NLS-1$
7635
    case 703 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); }  //$NON-NLS-1$
6693
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
7636
		    consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;  
6694
			break;
7637
			break;
6695
 
7638
 
6696
    case 652 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); }  //$NON-NLS-1$
7639
    case 704 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); }  //$NON-NLS-1$
6697
		    consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;  
7640
		    consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;  
6698
			break;
7641
			break;
6699
 
7642
 
6700
    case 656 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
7643
    case 708 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
6701
		    consumeAnnotationTypeDeclarationHeaderName() ;  
7644
		    consumeAnnotationTypeDeclarationHeaderName() ;  
6702
			break;
7645
			break;
6703
 
7646
 
6704
    case 657 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
7647
    case 709 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); }  //$NON-NLS-1$
6705
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
7648
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
6706
			break;
7649
			break;
6707
 
7650
 
6708
    case 658 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
7651
    case 710 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
6709
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
7652
		    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;  
6710
			break;
7653
			break;
6711
 
7654
 
6712
    case 659 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
7655
    case 711 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); }  //$NON-NLS-1$
6713
		    consumeAnnotationTypeDeclarationHeaderName() ;  
7656
		    consumeAnnotationTypeDeclarationHeaderName() ;  
6714
			break;
7657
			break;
6715
 
7658
 
6716
    case 660 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); }  //$NON-NLS-1$
7659
    case 712 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); }  //$NON-NLS-1$
6717
		    consumeAnnotationTypeDeclarationHeader() ;  
7660
		    consumeAnnotationTypeDeclarationHeader() ;  
6718
			break;
7661
			break;
6719
 
7662
 
6720
    case 661 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); }  //$NON-NLS-1$
7663
    case 713 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); }  //$NON-NLS-1$
6721
		    consumeAnnotationTypeDeclaration() ;  
7664
		    consumeAnnotationTypeDeclaration() ;  
6722
			break;
7665
			break;
6723
 
7666
 
6724
    case 663 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); }  //$NON-NLS-1$
7667
    case 715 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); }  //$NON-NLS-1$
6725
		    consumeEmptyAnnotationTypeMemberDeclarationsopt() ;  
7668
		    consumeEmptyAnnotationTypeMemberDeclarationsopt() ;  
6726
			break;
7669
			break;
6727
 
7670
 
6728
    case 664 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
7671
    case 716 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); }  //$NON-NLS-1$
6729
		    consumeAnnotationTypeMemberDeclarationsopt() ;  
7672
		    consumeAnnotationTypeMemberDeclarationsopt() ;  
6730
			break;
7673
			break;
6731
 
7674
 
6732
    case 666 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); }  //$NON-NLS-1$
7675
    case 718 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); }  //$NON-NLS-1$
6733
		    consumeAnnotationTypeMemberDeclarations() ;  
7676
		    consumeAnnotationTypeMemberDeclarations() ;  
6734
			break;
7677
			break;
6735
 
7678
 
6736
    case 667 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); }  //$NON-NLS-1$
7679
    case 719 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); }  //$NON-NLS-1$
6737
		    consumeMethodHeaderNameWithTypeParameters(true);  
7680
		    consumeMethodHeaderNameWithTypeParameters(true);  
6738
			break;
7681
			break;
6739
 
7682
 
6740
    case 668 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); }  //$NON-NLS-1$
7683
    case 720 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type0..."); }  //$NON-NLS-1$
6741
		    consumeMethodHeaderName(true);  
7684
		    consumeMethodHeaderName(true);  
6742
			break;
7685
			break;
6743
 
7686
 
6744
    case 669 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); }  //$NON-NLS-1$
7687
    case 721 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); }  //$NON-NLS-1$
6745
		    consumeEmptyMethodHeaderDefaultValue() ;  
7688
		    consumeEmptyMethodHeaderDefaultValue() ;  
6746
			break;
7689
			break;
6747
 
7690
 
6748
    case 670 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); }  //$NON-NLS-1$
7691
    case 722 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); }  //$NON-NLS-1$
6749
		    consumeMethodHeaderDefaultValue();  
7692
		    consumeMethodHeaderDefaultValue();  
6750
			break;
7693
			break;
6751
 
7694
 
6752
    case 671 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); }  //$NON-NLS-1$
7695
    case 723 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); }  //$NON-NLS-1$
6753
		    consumeMethodHeader();  
7696
		    consumeMethodHeader();  
6754
			break;
7697
			break;
6755
 
7698
 
6756
    case 672 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); }  //$NON-NLS-1$
7699
    case 724 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); }  //$NON-NLS-1$
6757
		    consumeAnnotationTypeMemberDeclaration() ;  
7700
		    consumeAnnotationTypeMemberDeclaration() ;  
6758
			break;
7701
			break;
6759
 
7702
 
6760
    case 680 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); }  //$NON-NLS-1$
7703
    case 732 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); }  //$NON-NLS-1$
6761
		    consumeAnnotationName() ;  
7704
		    consumeAnnotationName() ;  
6762
			break;
7705
			break;
6763
 
7706
 
6764
    case 681 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
7707
    case 733 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
6765
		    consumeNormalAnnotation() ;  
7708
		    consumeNormalAnnotation() ;  
6766
			break;
7709
			break;
6767
 
7710
 
6768
    case 682 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); }  //$NON-NLS-1$
7711
    case 734 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); }  //$NON-NLS-1$
6769
		    consumeEmptyMemberValuePairsopt() ;  
7712
		    consumeEmptyMemberValuePairsopt() ;  
6770
			break;
7713
			break;
6771
 
7714
 
6772
    case 685 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); }  //$NON-NLS-1$
7715
    case 737 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); }  //$NON-NLS-1$
6773
		    consumeMemberValuePairs() ;  
7716
		    consumeMemberValuePairs() ;  
6774
			break;
7717
			break;
6775
 
7718
 
6776
    case 686 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); }  //$NON-NLS-1$
7719
    case 738 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); }  //$NON-NLS-1$
6777
		    consumeMemberValuePair() ;  
7720
		    consumeMemberValuePair() ;  
6778
			break;
7721
			break;
6779
 
7722
 
6780
    case 687 : if (DEBUG) { System.out.println("EnterMemberValue ::="); }  //$NON-NLS-1$
7723
    case 739 : if (DEBUG) { System.out.println("EnterMemberValue ::="); }  //$NON-NLS-1$
6781
		    consumeEnterMemberValue() ;  
7724
		    consumeEnterMemberValue() ;  
6782
			break;
7725
			break;
6783
 
7726
 
6784
    case 688 : if (DEBUG) { System.out.println("ExitMemberValue ::="); }  //$NON-NLS-1$
7727
    case 740 : if (DEBUG) { System.out.println("ExitMemberValue ::="); }  //$NON-NLS-1$
6785
		    consumeExitMemberValue() ;  
7728
		    consumeExitMemberValue() ;  
6786
			break;
7729
			break;
6787
 
7730
 
6788
    case 690 : if (DEBUG) { System.out.println("MemberValue ::= Name"); }  //$NON-NLS-1$
7731
    case 742 : if (DEBUG) { System.out.println("MemberValue ::= Name"); }  //$NON-NLS-1$
6789
		    consumeMemberValueAsName() ;  
7732
		    consumeMemberValueAsName() ;  
6790
			break;
7733
			break;
6791
 
7734
 
6792
    case 693 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7735
    case 745 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
6793
		    consumeMemberValueArrayInitializer() ;  
7736
		    consumeMemberValueArrayInitializer() ;  
6794
			break;
7737
			break;
6795
 
7738
 
6796
    case 694 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7739
    case 746 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
6797
		    consumeMemberValueArrayInitializer() ;  
7740
		    consumeMemberValueArrayInitializer() ;  
6798
			break;
7741
			break;
6799
 
7742
 
6800
    case 695 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7743
    case 747 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
6801
		    consumeEmptyMemberValueArrayInitializer() ;  
7744
		    consumeEmptyMemberValueArrayInitializer() ;  
6802
			break;
7745
			break;
6803
 
7746
 
6804
    case 696 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
7747
    case 748 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); }  //$NON-NLS-1$
6805
		    consumeEmptyMemberValueArrayInitializer() ;  
7748
		    consumeEmptyMemberValueArrayInitializer() ;  
6806
			break;
7749
			break;
6807
 
7750
 
6808
    case 697 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); }  //$NON-NLS-1$
7751
    case 749 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); }  //$NON-NLS-1$
6809
		    consumeEnterMemberValueArrayInitializer() ;  
7752
		    consumeEnterMemberValueArrayInitializer() ;  
6810
			break;
7753
			break;
6811
 
7754
 
6812
    case 699 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); }  //$NON-NLS-1$
7755
    case 751 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); }  //$NON-NLS-1$
6813
		    consumeMemberValues() ;  
7756
		    consumeMemberValues() ;  
6814
			break;
7757
			break;
6815
 
7758
 
6816
    case 700 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); }  //$NON-NLS-1$
7759
    case 752 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); }  //$NON-NLS-1$
6817
		    consumeMarkerAnnotation() ;  
7760
		    consumeMarkerAnnotation() ;  
6818
			break;
7761
			break;
6819
 
7762
 
6820
    case 701 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); }  //$NON-NLS-1$
7763
    case 753 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); }  //$NON-NLS-1$
6821
		    consumeSingleMemberAnnotationMemberValue() ;  
7764
		    consumeSingleMemberAnnotationMemberValue() ;  
6822
			break;
7765
			break;
6823
 
7766
 
6824
    case 702 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
7767
    case 754 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); }  //$NON-NLS-1$
6825
		    consumeSingleMemberAnnotation() ;  
7768
		    consumeSingleMemberAnnotation() ;  
6826
			break;
7769
			break;
6827
 
7770
 
6828
    case 703 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); }  //$NON-NLS-1$
7771
    case 755 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); }  //$NON-NLS-1$
6829
		    consumeRecoveryMethodHeaderNameWithTypeParameters();  
7772
		    consumeRecoveryMethodHeaderNameWithTypeParameters();  
6830
			break;
7773
			break;
6831
 
7774
 
6832
    case 704 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); }  //$NON-NLS-1$
7775
    case 756 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type0..."); }  //$NON-NLS-1$
6833
		    consumeRecoveryMethodHeaderName();  
7776
		    consumeRecoveryMethodHeaderName();  
6834
			break;
7777
			break;
6835
 
7778
 
6836
    case 705 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
7779
    case 757 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
6837
		    consumeMethodHeader();  
7780
		    consumeMethodHeader();  
6838
			break;
7781
			break;
6839
 
7782
 
6840
    case 706 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
7783
    case 758 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); }  //$NON-NLS-1$
6841
		    consumeMethodHeader();  
7784
		    consumeMethodHeader();  
6842
			break;
7785
			break;
6843
 
7786
 
Lines 7736-7746 Link Here
7736
	pushOnGenericsStack(getTypeReference(0));
8679
	pushOnGenericsStack(getTypeReference(0));
7737
	this.intPtr--;
8680
	this.intPtr--;
7738
}
8681
}
8682
protected void consumeTypeArgumentReferenceType1WithTypeAnnotations() {
8683
	concatGenericsLists();
8684
	TypeReference typeReference = getUnannotatedTypeReference(0);
8685
	// copy from expression stack to type annotation stack
8686
	int length;
8687
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
8688
		System.arraycopy(
8689
				this.expressionStack,
8690
				(this.expressionPtr -= length) + 1,
8691
				typeReference.annotations = new Annotation[length],
8692
				0,
8693
				length);
8694
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
8695
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
8696
			typeReferenceSourceStart = this.modifiersSourceStart;
8697
		}
8698
		typeReference.bits |= ASTNode.HasTypeAnnotations;
8699
		typeReference.sourceStart = typeReferenceSourceStart;
8700
	}
8701
	pushOnGenericsStack(typeReference);
8702
	// remove the 0 pushed by ZeroTypeAnnotation
8703
	this.typeAnnotationLengthPtr--;
8704
	this.intPtr--;
8705
	if (this.modifiers != ClassFileConstants.AccDefault) {
8706
		problemReporter().invalidLocationForModifiers(typeReference);
8707
	}
8708
	resetModifiers();
8709
}
7739
protected void consumeTypeArgumentReferenceType2() {
8710
protected void consumeTypeArgumentReferenceType2() {
7740
	concatGenericsLists();
8711
	concatGenericsLists();
7741
	pushOnGenericsStack(getTypeReference(0));
8712
	pushOnGenericsStack(getTypeReference(0));
7742
	this.intPtr--;
8713
	this.intPtr--;
7743
}
8714
}
8715
protected void consumeTypeArgumentReferenceType2WithTypeAnnotations() {
8716
	concatGenericsLists();
8717
	TypeReference typeReference = getUnannotatedTypeReference(0);
8718
	// copy from expression stack to type annotation stack
8719
	int length;
8720
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
8721
		System.arraycopy(
8722
				this.expressionStack,
8723
				(this.expressionPtr -= length) + 1,
8724
				typeReference.annotations = new Annotation[length],
8725
				0,
8726
				length);
8727
		int typeReferenceSourceStart = typeReference.annotations[0].sourceStart;
8728
		if (this.modifiersSourceStart < typeReferenceSourceStart) {
8729
			typeReferenceSourceStart = this.modifiersSourceStart;
8730
		}
8731
		typeReference.bits |= ASTNode.HasTypeAnnotations;
8732
		typeReference.sourceStart = typeReferenceSourceStart;
8733
	}
8734
	pushOnGenericsStack(typeReference);
8735
	this.intPtr--;
8736
	if (this.modifiers != ClassFileConstants.AccDefault) {
8737
		problemReporter().invalidLocationForModifiers(typeReference);
8738
	}
8739
	resetModifiers();
8740
}
7744
protected void consumeTypeArguments() {
8741
protected void consumeTypeArguments() {
7745
	concatGenericsLists();
8742
	concatGenericsLists();
7746
	this.intPtr--;
8743
	this.intPtr--;
Lines 7829-7834 Link Here
7829
	typeParameter.declarationSourceEnd = superType.sourceEnd;
8826
	typeParameter.declarationSourceEnd = superType.sourceEnd;
7830
	typeParameter.type = superType;
8827
	typeParameter.type = superType;
7831
	superType.bits |= ASTNode.IsSuperType;
8828
	superType.bits |= ASTNode.IsSuperType;
8829
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
7832
	this.genericsStack[this.genericsPtr] = typeParameter;
8830
	this.genericsStack[this.genericsPtr] = typeParameter;
7833
}
8831
}
7834
protected void consumeTypeParameter1WithExtendsAndBounds() {
8832
protected void consumeTypeParameter1WithExtendsAndBounds() {
Lines 7841-7855 Link Here
7841
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
8839
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
7842
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
8840
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
7843
	typeParameter.type = superType;
8841
	typeParameter.type = superType;
8842
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
7844
	superType.bits |= ASTNode.IsSuperType;
8843
	superType.bits |= ASTNode.IsSuperType;
7845
	typeParameter.bounds = bounds;
8844
	typeParameter.bounds = bounds;
7846
	for (int i = 0, max = bounds.length; i < max; i++) {
8845
	for (int i = 0, max = bounds.length; i < max; i++) {
7847
		bounds[i].bits |= ASTNode.IsSuperType;
8846
		TypeReference bound = bounds[i];
8847
		bound.bits |= ASTNode.IsSuperType;
8848
		typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
7848
	}
8849
	}
7849
}
8850
}
7850
protected void consumeTypeParameterHeader() {
8851
protected void consumeTypeParameterHeader() {
7851
	//TypeParameterHeader ::= Identifier
8852
	//TypeParameterHeader ::= Identifier
7852
	TypeParameter typeParameter = new TypeParameter();
8853
	TypeParameter typeParameter = new TypeParameter();
8854
	int length;
8855
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
8856
		System.arraycopy(
8857
				this.typeAnnotationStack,
8858
				(this.typeAnnotationPtr -= length) + 1,
8859
				typeParameter.annotations = new Annotation[length],
8860
				0,
8861
				length);
8862
		typeParameter.bits |= ASTNode.HasTypeAnnotations;
8863
	}
7853
	long pos = this.identifierPositionStack[this.identifierPtr];
8864
	long pos = this.identifierPositionStack[this.identifierPtr];
7854
	final int end = (int) pos;
8865
	final int end = (int) pos;
7855
	typeParameter.declarationSourceEnd = end;
8866
	typeParameter.declarationSourceEnd = end;
Lines 7901-7906 Link Here
7901
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
8912
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
7902
	typeParameter.declarationSourceEnd = superType.sourceEnd;
8913
	typeParameter.declarationSourceEnd = superType.sourceEnd;
7903
	typeParameter.type = superType;
8914
	typeParameter.type = superType;
8915
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
7904
	superType.bits |= ASTNode.IsSuperType;
8916
	superType.bits |= ASTNode.IsSuperType;
7905
}
8917
}
7906
protected void consumeTypeParameterWithExtendsAndBounds() {
8918
protected void consumeTypeParameterWithExtendsAndBounds() {
Lines 7912-7922 Link Here
7912
	TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
8924
	TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
7913
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
8925
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
7914
	typeParameter.type = superType;
8926
	typeParameter.type = superType;
8927
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
7915
	superType.bits |= ASTNode.IsSuperType;
8928
	superType.bits |= ASTNode.IsSuperType;
7916
	typeParameter.bounds = bounds;
8929
	typeParameter.bounds = bounds;
7917
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
8930
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
7918
	for (int i = 0, max = bounds.length; i < max; i++) {
8931
	for (int i = 0, max = bounds.length; i < max; i++) {
7919
		bounds[i].bits |= ASTNode.IsSuperType;
8932
		TypeReference bound = bounds[i];
8933
		bound.bits |= ASTNode.IsSuperType;
8934
		typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
7920
	}
8935
	}
7921
}
8936
}
7922
protected void consumeUnaryExpression(int op) {
8937
protected void consumeUnaryExpression(int op) {
Lines 8141-8152 Link Here
8141
	m.explicitDeclarations = c.explicitDeclarations;
9156
	m.explicitDeclarations = c.explicitDeclarations;
8142
	m.returnType = null;
9157
	m.returnType = null;
8143
	m.javadoc = c.javadoc;
9158
	m.javadoc = c.javadoc;
9159
	m.bits = c.bits;
8144
	return m;
9160
	return m;
8145
}
9161
}
8146
9162
8147
protected TypeReference copyDims(TypeReference typeRef, int dim) {
9163
protected TypeReference copyDims(TypeReference typeRef, int dim) {
8148
	return typeRef.copyDims(dim);
9164
	return typeRef.copyDims(dim);
8149
}
9165
}
9166
9167
protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation[][]annotationsOnDimensions) {
9168
	return typeRef.copyDims(dim, annotationsOnDimensions);
9169
}
9170
8150
protected FieldDeclaration createFieldDeclaration(char[] fieldDeclarationName, int sourceStart, int sourceEnd) {
9171
protected FieldDeclaration createFieldDeclaration(char[] fieldDeclarationName, int sourceStart, int sourceEnd) {
8151
	return new FieldDeclaration(fieldDeclarationName, sourceStart, sourceEnd);
9172
	return new FieldDeclaration(fieldDeclarationName, sourceStart, sourceEnd);
8152
}
9173
}
Lines 8379-8385 Link Here
8379
	} else if (this.currentElement != null){
9400
	} else if (this.currentElement != null){
8380
		if (VERBOSE_RECOVERY){
9401
		if (VERBOSE_RECOVERY){
8381
			System.out.print(Messages.parser_syntaxRecovery);
9402
			System.out.print(Messages.parser_syntaxRecovery);
8382
			System.out.println("--------------------------");		 //$NON-NLS-1$
9403
			System.out.println("--------------------------"); //$NON-NLS-1$
8383
			System.out.println(this.compilationUnit);
9404
			System.out.println(this.compilationUnit);
8384
			System.out.println("----------------------------------"); //$NON-NLS-1$
9405
			System.out.println("----------------------------------"); //$NON-NLS-1$
8385
		}
9406
		}
Lines 8628-8640 Link Here
8628
	return exp;
9649
	return exp;
8629
}
9650
}
8630
protected TypeReference getTypeReference(int dim) {
9651
protected TypeReference getTypeReference(int dim) {
9652
	TypeReference ref = getUnannotatedTypeReference(dim);
9653
	int length;
9654
	if (this.typeAnnotationLengthPtr >= 0
9655
			&& (length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
9656
		//	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
9657
9658
		System.arraycopy(
9659
				this.typeAnnotationStack,
9660
				(this.typeAnnotationPtr -= length) + 1,
9661
				ref.annotations = new Annotation[length],
9662
				0,
9663
				length);
9664
		ref.sourceStart = ref.annotations[0].sourceStart;
9665
		ref.bits |= ASTNode.HasTypeAnnotations;
9666
	}
9667
	return ref;
9668
}
9669
protected TypeReference getUnannotatedTypeReference(int dim) {
8631
	/* build a Reference on a variable that may be qualified or not
9670
	/* build a Reference on a variable that may be qualified or not
8632
	 This variable is a type reference and dim will be its dimensions*/
9671
	 This variable is a type reference and dim will be its dimensions*/
8633
9672
8634
	TypeReference ref;
9673
	TypeReference ref;
9674
	Annotation [][] annotationsOnDimensions = null;
8635
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
9675
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
8636
	if (length < 0) { //flag for precompiled type reference on base types
9676
	if (length < 0) { //flag for precompiled type reference on base types
8637
		ref = TypeReference.baseTypeReference(-length, dim);
9677
		if (dim > 0) {
9678
			annotationsOnDimensions = getAnnotationsOnDimensions(dim);
9679
		}
9680
		ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
8638
		ref.sourceStart = this.intStack[this.intPtr--];
9681
		ref.sourceStart = this.intStack[this.intPtr--];
8639
		if (dim == 0) {
9682
		if (dim == 0) {
8640
			ref.sourceEnd = this.intStack[this.intPtr--];
9683
			ref.sourceEnd = this.intStack[this.intPtr--];
Lines 8656-8667 Link Here
8656
						this.identifierStack[this.identifierPtr],
9699
						this.identifierStack[this.identifierPtr],
8657
						this.identifierPositionStack[this.identifierPtr--]);
9700
						this.identifierPositionStack[this.identifierPtr--]);
8658
			} else {
9701
			} else {
9702
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
8659
				ref =
9703
				ref =
8660
					new ArrayTypeReference(
9704
					new ArrayTypeReference(
8661
						this.identifierStack[this.identifierPtr],
9705
						this.identifierStack[this.identifierPtr],
8662
						dim,
9706
						dim,
9707
						annotationsOnDimensions,
8663
						this.identifierPositionStack[this.identifierPtr--]);
9708
						this.identifierPositionStack[this.identifierPtr--]);
8664
				ref.sourceEnd = this.endPosition;
9709
				ref.sourceEnd = this.endPosition;
9710
				if (annotationsOnDimensions != null) {
9711
					ref.bits |= ASTNode.HasTypeAnnotations;
9712
				}
8665
			}
9713
			}
8666
		} else {
9714
		} else {
8667
			this.genericsLengthPtr--;
9715
			this.genericsLengthPtr--;
Lines 8679-8698 Link Here
8679
			if (dim == 0) {
9727
			if (dim == 0) {
8680
				ref = new QualifiedTypeReference(tokens, positions);
9728
				ref = new QualifiedTypeReference(tokens, positions);
8681
			} else {
9729
			} else {
8682
				ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
9730
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
9731
				ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions);
8683
				ref.sourceEnd = this.endPosition;
9732
				ref.sourceEnd = this.endPosition;
9733
				ref.bits |= ASTNode.HasTypeAnnotations;
8684
			}
9734
			}
8685
		}
9735
		}
8686
	}
9736
	}
8687
	return ref;
9737
	return ref;
8688
}
9738
}
8689
protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
9739
protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
9740
	Annotation[][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
8690
	if (identifierLength == 1 && numberOfIdentifiers == 1) {
9741
	if (identifierLength == 1 && numberOfIdentifiers == 1) {
8691
		int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
9742
		int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
8692
		TypeReference[] typeArguments = new TypeReference[currentTypeArgumentsLength];
9743
		TypeReference[] typeArguments = new TypeReference[currentTypeArgumentsLength];
8693
		this.genericsPtr -= currentTypeArgumentsLength;
9744
		this.genericsPtr -= currentTypeArgumentsLength;
8694
		System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments, 0, currentTypeArgumentsLength);
9745
		System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments, 0, currentTypeArgumentsLength);
8695
		ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, this.identifierPositionStack[this.identifierPtr--]);
9746
		ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, annotationsOnDimensions, this.identifierPositionStack[this.identifierPtr--]);
8696
		if (dim != 0) {
9747
		if (dim != 0) {
8697
			parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition;
9748
			parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition;
8698
		}
9749
		}
Lines 8726-8732 Link Here
8726
				currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--];
9777
				currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--];
8727
			}
9778
			}
8728
		}
9779
		}
8729
		ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions);
9780
		ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, annotationsOnDimensions, positions);
8730
		if (dim != 0) {
9781
		if (dim != 0) {
8731
			parameterizedQualifiedTypeReference.sourceEnd = this.endStatementPosition;
9782
			parameterizedQualifiedTypeReference.sourceEnd = this.endStatementPosition;
8732
		}
9783
		}
Lines 8947-8952 Link Here
8947
	this.astLengthPtr = -1;
9998
	this.astLengthPtr = -1;
8948
	this.expressionPtr = -1;
9999
	this.expressionPtr = -1;
8949
	this.expressionLengthPtr = -1;
10000
	this.expressionLengthPtr = -1;
10001
	this.unattachedAnnotationPtr = -1;
10002
	this.typeAnnotationLengthPtr = -1;
10003
	this.typeAnnotationPtr = -1;
8950
	this.identifierPtr = -1;
10004
	this.identifierPtr = -1;
8951
	this.identifierLengthPtr	= -1;
10005
	this.identifierLengthPtr	= -1;
8952
	this.intPtr = -1;
10006
	this.intPtr = -1;
Lines 10087-10092 Link Here
10087
	}
11141
	}
10088
	this.astLengthStack[this.astLengthPtr] = 1;
11142
	this.astLengthStack[this.astLengthPtr] = 1;
10089
}
11143
}
11144
protected void pushOnTypeAnnotationStack(Annotation annotation) {
11145
11146
	int stackLength = this.typeAnnotationStack.length;
11147
	if (++this.typeAnnotationPtr >= stackLength) {
11148
		System.arraycopy(
11149
			this.typeAnnotationStack, 0,
11150
			this.typeAnnotationStack = new Annotation[stackLength + TypeAnnotationStackIncrement], 0,
11151
			stackLength);
11152
	}
11153
	this.typeAnnotationStack[this.typeAnnotationPtr] = annotation;
11154
11155
	stackLength = this.typeAnnotationLengthStack.length;
11156
	if (++this.typeAnnotationLengthPtr >= stackLength) {
11157
		System.arraycopy(
11158
			this.typeAnnotationLengthStack, 0,
11159
			this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0,
11160
			stackLength);
11161
	}
11162
	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = 1;
11163
}
11164
protected void pushOnTypeAnnotationLengthStack(int pos) {
11165
11166
	int stackLength = this.typeAnnotationLengthStack.length;
11167
	if (++this.typeAnnotationLengthPtr >= stackLength) {
11168
		System.arraycopy(
11169
			this.typeAnnotationLengthStack, 0,
11170
			this.typeAnnotationLengthStack = new int[stackLength + TypeAnnotationStackIncrement], 0,
11171
			stackLength);
11172
	}
11173
	this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr] = pos;
11174
}
10090
protected void pushOnExpressionStack(Expression expr) {
11175
protected void pushOnExpressionStack(Expression expr) {
10091
11176
10092
	int stackLength = this.expressionStack.length;
11177
	int stackLength = this.expressionStack.length;
Lines 10510-10515 Link Here
10510
	this.astLengthPtr = -1;
11595
	this.astLengthPtr = -1;
10511
	this.expressionPtr = -1;
11596
	this.expressionPtr = -1;
10512
	this.expressionLengthPtr = -1;
11597
	this.expressionLengthPtr = -1;
11598
	this.unattachedAnnotationPtr = -1;
11599
	this.typeAnnotationLengthPtr = -1;
11600
	this.typeAnnotationPtr = -1;
10513
	this.identifierPtr = -1;
11601
	this.identifierPtr = -1;
10514
	this.identifierLengthPtr	= -1;
11602
	this.identifierLengthPtr	= -1;
10515
	this.intPtr = -1;
11603
	this.intPtr = -1;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java (-13 / +13 lines)
Lines 15-35 Link Here
15
public interface ParserBasicInformation {
15
public interface ParserBasicInformation {
16
16
17
	int ERROR_SYMBOL = 110,
17
	int ERROR_SYMBOL = 110,
18
		MAX_NAME_LENGTH = 41,
18
		MAX_NAME_LENGTH = 50,
19
		NUM_STATES = 970,
19
		NUM_STATES = 1052,
20
20
21
		NT_OFFSET = 110,
21
		NT_OFFSET = 110,
22
		SCOPE_UBOUND = 133,
22
		SCOPE_UBOUND = 222,
23
		SCOPE_SIZE = 134,
23
		SCOPE_SIZE = 223,
24
		LA_STATE_OFFSET = 12789,
24
		LA_STATE_OFFSET = 15121,
25
		MAX_LA = 1,
25
		MAX_LA = 1,
26
		NUM_RULES = 706,
26
		NUM_RULES = 758,
27
		NUM_TERMINALS = 110,
27
		NUM_TERMINALS = 110,
28
		NUM_NON_TERMINALS = 314,
28
		NUM_NON_TERMINALS = 335,
29
		NUM_SYMBOLS = 424,
29
		NUM_SYMBOLS = 445,
30
		START_STATE = 821,
30
		START_STATE = 1765,
31
		EOFT_SYMBOL = 69,
31
		EOFT_SYMBOL = 66,
32
		EOLT_SYMBOL = 69,
32
		EOLT_SYMBOL = 66,
33
		ACCEPT_ACTION = 12788,
33
		ACCEPT_ACTION = 15120,
34
		ERROR_ACTION = 12789;
34
		ERROR_ACTION = 15121;
35
}
35
}
(-)compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java (-91 / +91 lines)
Lines 33-146 Link Here
33
		TokenNameCOMMENT_BLOCK = 1002,
33
		TokenNameCOMMENT_BLOCK = 1002,
34
		TokenNameCOMMENT_JAVADOC = 1003;
34
		TokenNameCOMMENT_JAVADOC = 1003;
35
35
36
	int TokenNameIdentifier = 26,
36
	int TokenNameIdentifier = 23,
37
		TokenNameabstract = 56,
37
		TokenNameabstract = 33,
38
		TokenNameassert = 74,
38
		TokenNameassert = 75,
39
		TokenNameboolean = 32,
39
		TokenNameboolean = 44,
40
		TokenNamebreak = 75,
40
		TokenNamebreak = 76,
41
		TokenNamebyte = 33,
41
		TokenNamebyte = 45,
42
		TokenNamecase = 101,
42
		TokenNamecase = 102,
43
		TokenNamecatch = 102,
43
		TokenNamecatch = 103,
44
		TokenNamechar = 34,
44
		TokenNamechar = 46,
45
		TokenNameclass = 72,
45
		TokenNameclass = 71,
46
		TokenNamecontinue = 76,
46
		TokenNamecontinue = 77,
47
		TokenNameconst = 108,
47
		TokenNameconst = 108,
48
		TokenNamedefault = 97,
48
		TokenNamedefault = 87,
49
		TokenNamedo = 77,
49
		TokenNamedo = 78,
50
		TokenNamedouble = 35,
50
		TokenNamedouble = 47,
51
		TokenNameelse = 103,
51
		TokenNameelse = 104,
52
		TokenNameenum = 98,
52
		TokenNameenum = 100,
53
		TokenNameextends = 99,
53
		TokenNameextends = 88,
54
		TokenNamefalse = 44,
54
		TokenNamefalse = 56,
55
		TokenNamefinal = 57,
55
		TokenNamefinal = 34,
56
		TokenNamefinally = 104,
56
		TokenNamefinally = 105,
57
		TokenNamefloat = 36,
57
		TokenNamefloat = 48,
58
		TokenNamefor = 78,
58
		TokenNamefor = 79,
59
		TokenNamegoto = 109,
59
		TokenNamegoto = 109,
60
		TokenNameif = 79,
60
		TokenNameif = 80,
61
		TokenNameimplements = 106,
61
		TokenNameimplements = 107,
62
		TokenNameimport = 100,
62
		TokenNameimport = 101,
63
		TokenNameinstanceof = 12,
63
		TokenNameinstanceof = 13,
64
		TokenNameint = 37,
64
		TokenNameint = 49,
65
		TokenNameinterface = 95,
65
		TokenNameinterface = 85,
66
		TokenNamelong = 38,
66
		TokenNamelong = 50,
67
		TokenNamenative = 58,
67
		TokenNamenative = 35,
68
		TokenNamenew = 43,
68
		TokenNamenew = 55,
69
		TokenNamenull = 45,
69
		TokenNamenull = 57,
70
		TokenNamepackage = 96,
70
		TokenNamepackage = 86,
71
		TokenNameprivate = 59,
71
		TokenNameprivate = 36,
72
		TokenNameprotected = 60,
72
		TokenNameprotected = 37,
73
		TokenNamepublic = 61,
73
		TokenNamepublic = 38,
74
		TokenNamereturn = 80,
74
		TokenNamereturn = 81,
75
		TokenNameshort = 39,
75
		TokenNameshort = 51,
76
		TokenNamestatic = 54,
76
		TokenNamestatic = 32,
77
		TokenNamestrictfp = 62,
77
		TokenNamestrictfp = 39,
78
		TokenNamesuper = 41,
78
		TokenNamesuper = 53,
79
		TokenNameswitch = 81,
79
		TokenNameswitch = 82,
80
		TokenNamesynchronized = 55,
80
		TokenNamesynchronized = 40,
81
		TokenNamethis = 42,
81
		TokenNamethis = 54,
82
		TokenNamethrow = 82,
82
		TokenNamethrow = 83,
83
		TokenNamethrows = 105,
83
		TokenNamethrows = 106,
84
		TokenNametransient = 63,
84
		TokenNametransient = 41,
85
		TokenNametrue = 46,
85
		TokenNametrue = 58,
86
		TokenNametry = 83,
86
		TokenNametry = 84,
87
		TokenNamevoid = 40,
87
		TokenNamevoid = 52,
88
		TokenNamevolatile = 64,
88
		TokenNamevolatile = 42,
89
		TokenNamewhile = 73,
89
		TokenNamewhile = 73,
90
		TokenNameIntegerLiteral = 47,
90
		TokenNameIntegerLiteral = 59,
91
		TokenNameLongLiteral = 48,
91
		TokenNameLongLiteral = 60,
92
		TokenNameFloatingPointLiteral = 49,
92
		TokenNameFloatingPointLiteral = 61,
93
		TokenNameDoubleLiteral = 50,
93
		TokenNameDoubleLiteral = 62,
94
		TokenNameCharacterLiteral = 51,
94
		TokenNameCharacterLiteral = 63,
95
		TokenNameStringLiteral = 52,
95
		TokenNameStringLiteral = 64,
96
		TokenNamePLUS_PLUS = 8,
96
		TokenNamePLUS_PLUS = 9,
97
		TokenNameMINUS_MINUS = 9,
97
		TokenNameMINUS_MINUS = 10,
98
		TokenNameEQUAL_EQUAL = 18,
98
		TokenNameEQUAL_EQUAL = 18,
99
		TokenNameLESS_EQUAL = 15,
99
		TokenNameLESS_EQUAL = 15,
100
		TokenNameGREATER_EQUAL = 16,
100
		TokenNameGREATER_EQUAL = 16,
101
		TokenNameNOT_EQUAL = 19,
101
		TokenNameNOT_EQUAL = 19,
102
		TokenNameLEFT_SHIFT = 17,
102
		TokenNameLEFT_SHIFT = 17,
103
		TokenNameRIGHT_SHIFT = 10,
103
		TokenNameRIGHT_SHIFT = 11,
104
		TokenNameUNSIGNED_RIGHT_SHIFT = 11,
104
		TokenNameUNSIGNED_RIGHT_SHIFT = 12,
105
		TokenNamePLUS_EQUAL = 84,
105
		TokenNamePLUS_EQUAL = 89,
106
		TokenNameMINUS_EQUAL = 85,
106
		TokenNameMINUS_EQUAL = 90,
107
		TokenNameMULTIPLY_EQUAL = 86,
107
		TokenNameMULTIPLY_EQUAL = 91,
108
		TokenNameDIVIDE_EQUAL = 87,
108
		TokenNameDIVIDE_EQUAL = 92,
109
		TokenNameAND_EQUAL = 88,
109
		TokenNameAND_EQUAL = 93,
110
		TokenNameOR_EQUAL = 89,
110
		TokenNameOR_EQUAL = 94,
111
		TokenNameXOR_EQUAL = 90,
111
		TokenNameXOR_EQUAL = 95,
112
		TokenNameREMAINDER_EQUAL = 91,
112
		TokenNameREMAINDER_EQUAL = 96,
113
		TokenNameLEFT_SHIFT_EQUAL = 92,
113
		TokenNameLEFT_SHIFT_EQUAL = 97,
114
		TokenNameRIGHT_SHIFT_EQUAL = 93,
114
		TokenNameRIGHT_SHIFT_EQUAL = 98,
115
		TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 94,
115
		TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 99,
116
		TokenNameOR_OR = 25,
116
		TokenNameOR_OR = 27,
117
		TokenNameAND_AND = 24,
117
		TokenNameAND_AND = 26,
118
		TokenNamePLUS = 1,
118
		TokenNamePLUS = 1,
119
		TokenNameMINUS = 2,
119
		TokenNameMINUS = 2,
120
		TokenNameNOT = 66,
120
		TokenNameNOT = 67,
121
		TokenNameREMAINDER = 5,
121
		TokenNameREMAINDER = 5,
122
		TokenNameXOR = 21,
122
		TokenNameXOR = 22,
123
		TokenNameAND = 20,
123
		TokenNameAND = 20,
124
		TokenNameMULTIPLY = 4,
124
		TokenNameMULTIPLY = 4,
125
		TokenNameOR = 22,
125
		TokenNameOR = 24,
126
		TokenNameTWIDDLE = 67,
126
		TokenNameTWIDDLE = 68,
127
		TokenNameDIVIDE = 6,
127
		TokenNameDIVIDE = 6,
128
		TokenNameGREATER = 13,
128
		TokenNameGREATER = 14,
129
		TokenNameLESS = 7,
129
		TokenNameLESS = 7,
130
		TokenNameLPAREN = 28,
130
		TokenNameLPAREN = 29,
131
		TokenNameRPAREN = 29,
131
		TokenNameRPAREN = 30,
132
		TokenNameLBRACE = 68,
132
		TokenNameLBRACE = 69,
133
		TokenNameRBRACE = 31,
133
		TokenNameRBRACE = 43,
134
		TokenNameLBRACKET = 14,
134
		TokenNameLBRACKET = 8,
135
		TokenNameRBRACKET = 70,
135
		TokenNameRBRACKET = 70,
136
		TokenNameSEMICOLON = 27,
136
		TokenNameSEMICOLON = 28,
137
		TokenNameQUESTION = 23,
137
		TokenNameQUESTION = 25,
138
		TokenNameCOLON = 65,
138
		TokenNameCOLON = 65,
139
		TokenNameCOMMA = 30,
139
		TokenNameCOMMA = 31,
140
		TokenNameDOT = 3,
140
		TokenNameDOT = 3,
141
		TokenNameEQUAL = 71,
141
		TokenNameEQUAL = 74,
142
		TokenNameAT = 53,
142
		TokenNameAT = 21,
143
		TokenNameELLIPSIS = 107,
143
		TokenNameELLIPSIS = 72,
144
		TokenNameEOF = 69,
144
		TokenNameEOF = 66,
145
		TokenNameERROR = 110;
145
		TokenNameERROR = 110;
146
}
146
}
(-)compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java (-3 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 15-20 Link Here
15
import org.eclipse.jdt.internal.compiler.parser.Parser;
15
import org.eclipse.jdt.internal.compiler.parser.Parser;
16
import org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation;
16
import org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation;
17
import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner;
17
import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner;
18
import org.eclipse.jdt.internal.compiler.parser.Scanner;
18
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
19
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
19
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
20
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
20
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
21
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
Lines 780-787 Link Here
780
	    }
781
	    }
781
782
782
		//
783
		//
783
		// Next, try deletion of the error token.
784
		// Next, try deletion of the error token, preferring deletion as a criteria in
784
		//
785
		// case of identical, superfluous keyword tokens. See below.
785
		j = parseCheck(
786
		j = parseCheck(
786
				stck,
787
				stck,
787
				stack_top,
788
				stack_top,
Lines 797-802 Link Here
797
			repair.misspellIndex = k;
798
			repair.misspellIndex = k;
798
			repair.code = DELETION_CODE;
799
			repair.code = DELETION_CODE;
799
			repair.distance = j;
800
			repair.distance = j;
801
		} else if (j == repair.distance) {
802
			// Handle some cases where deletion as a repair strategy is obviously superior to
803
			// others. e.g: Object o = new new Object() {}; For some reason, with the new grammar
804
			// rules to support type annotations in place, the scopeTrial's choice above wins out
805
			// with the repair strategy being to insert a semicolon after the first new. That looks
806
			// very suspicious. It is not clear if that is due to the bug in the implementation of
807
			// scopeTrial or in the jikespg parser generator or in the grammar.
808
			
809
			// The current fix is a temporary point-fix to address this problem. It does make sense
810
			// as a rule, but is a bit ad-hoc in nature and the reason why scopeTrial succeeds needs
811
			// to be understood. (TODO(Ayush): Investigate scopeTrial's choice)
812
			LexStream.Token previousToken = this.lexStream.token(repair.bufferPosition + 1);
813
			LexStream.Token curToken = this.lexStream.token(repair.bufferPosition + 2);
814
			if (previousToken != null && curToken != null && previousToken.kind == curToken.kind && Scanner.isKeyword(curToken.kind)) {
815
				repair.misspellIndex = k;
816
				repair.code = DELETION_CODE;
817
				repair.distance = j;
818
			}
800
		}
819
		}
801
820
802
		//
821
		//
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-77 / +66 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 2410-2415 Link Here
2410
		methodDecl.sourceStart,
2410
		methodDecl.sourceStart,
2411
		methodDecl.sourceEnd);
2411
		methodDecl.sourceEnd);
2412
}
2412
}
2413
public void invalidLocationForModifiers(ASTNode location) {
2414
	this.handle(
2415
			IProblem.InvalidLocationForModifiers,
2416
			NoArgument,
2417
			NoArgument,
2418
			location.sourceStart,
2419
			location.sourceEnd);
2420
}
2413
public void illegalModifierForVariable(LocalDeclaration localDecl, boolean complainAsArgument) {
2421
public void illegalModifierForVariable(LocalDeclaration localDecl, boolean complainAsArgument) {
2414
	String[] arguments = new String[] {new String(localDecl.name)};
2422
	String[] arguments = new String[] {new String(localDecl.name)};
2415
	this.handle(
2423
	this.handle(
Lines 3784-3797 Link Here
3784
			expression.sourceStart,
3792
			expression.sourceStart,
3785
			expression.sourceEnd);
3793
			expression.sourceEnd);
3786
}
3794
}
3787
public void invalidTypeReference(Expression expression) {
3788
	this.handle(
3789
		IProblem.InvalidTypeExpression,
3790
		NoArgument,
3791
		NoArgument,
3792
		expression.sourceStart,
3793
		expression.sourceEnd);
3794
}
3795
public void invalidTypeToSynchronize(Expression expression, TypeBinding type) {
3795
public void invalidTypeToSynchronize(Expression expression, TypeBinding type) {
3796
	this.handle(
3796
	this.handle(
3797
		IProblem.InvalidTypeToSynchronized,
3797
		IProblem.InvalidTypeToSynchronized,
Lines 3923-3999 Link Here
3923
		end);
3923
		end);
3924
}
3924
}
3925
private boolean isIdentifier(int token) {
3925
private boolean isIdentifier(int token) {
3926
	return token == TerminalTokens.TokenNameIdentifier;
3926
	return Scanner.isIdentifier(token);
3927
}
3927
}
3928
private boolean isKeyword(int token) {
3928
private boolean isKeyword(int token) {
3929
	switch(token) {
3929
	return Scanner.isKeyword(token);
3930
		case TerminalTokens.TokenNameabstract:
3931
		case TerminalTokens.TokenNameassert:
3932
		case TerminalTokens.TokenNamebyte:
3933
		case TerminalTokens.TokenNamebreak:
3934
		case TerminalTokens.TokenNameboolean:
3935
		case TerminalTokens.TokenNamecase:
3936
		case TerminalTokens.TokenNamechar:
3937
		case TerminalTokens.TokenNamecatch:
3938
		case TerminalTokens.TokenNameclass:
3939
		case TerminalTokens.TokenNamecontinue:
3940
		case TerminalTokens.TokenNamedo:
3941
		case TerminalTokens.TokenNamedouble:
3942
		case TerminalTokens.TokenNamedefault:
3943
		case TerminalTokens.TokenNameelse:
3944
		case TerminalTokens.TokenNameextends:
3945
		case TerminalTokens.TokenNamefor:
3946
		case TerminalTokens.TokenNamefinal:
3947
		case TerminalTokens.TokenNamefloat:
3948
		case TerminalTokens.TokenNamefalse:
3949
		case TerminalTokens.TokenNamefinally:
3950
		case TerminalTokens.TokenNameif:
3951
		case TerminalTokens.TokenNameint:
3952
		case TerminalTokens.TokenNameimport:
3953
		case TerminalTokens.TokenNameinterface:
3954
		case TerminalTokens.TokenNameimplements:
3955
		case TerminalTokens.TokenNameinstanceof:
3956
		case TerminalTokens.TokenNamelong:
3957
		case TerminalTokens.TokenNamenew:
3958
		case TerminalTokens.TokenNamenull:
3959
		case TerminalTokens.TokenNamenative:
3960
		case TerminalTokens.TokenNamepublic:
3961
		case TerminalTokens.TokenNamepackage:
3962
		case TerminalTokens.TokenNameprivate:
3963
		case TerminalTokens.TokenNameprotected:
3964
		case TerminalTokens.TokenNamereturn:
3965
		case TerminalTokens.TokenNameshort:
3966
		case TerminalTokens.TokenNamesuper:
3967
		case TerminalTokens.TokenNamestatic:
3968
		case TerminalTokens.TokenNameswitch:
3969
		case TerminalTokens.TokenNamestrictfp:
3970
		case TerminalTokens.TokenNamesynchronized:
3971
		case TerminalTokens.TokenNametry:
3972
		case TerminalTokens.TokenNamethis:
3973
		case TerminalTokens.TokenNametrue:
3974
		case TerminalTokens.TokenNamethrow:
3975
		case TerminalTokens.TokenNamethrows:
3976
		case TerminalTokens.TokenNametransient:
3977
		case TerminalTokens.TokenNamevoid:
3978
		case TerminalTokens.TokenNamevolatile:
3979
		case TerminalTokens.TokenNamewhile:
3980
			return true;
3981
		default:
3982
			return false;
3983
	}
3984
}
3930
}
3985
private boolean isLiteral(int token) {
3931
private boolean isLiteral(int token) {
3986
	switch(token) {
3932
	return Scanner.isLiteral(token);
3987
		case TerminalTokens.TokenNameIntegerLiteral:
3988
		case TerminalTokens.TokenNameLongLiteral:
3989
		case TerminalTokens.TokenNameFloatingPointLiteral:
3990
		case TerminalTokens.TokenNameDoubleLiteral:
3991
		case TerminalTokens.TokenNameStringLiteral:
3992
		case TerminalTokens.TokenNameCharacterLiteral:
3993
			return true;
3994
		default:
3995
			return false;
3996
	}
3997
}
3933
}
3998
3934
3999
private boolean isRecoveredName(char[] simpleName) {
3935
private boolean isRecoveredName(char[] simpleName) {
Lines 6297-6309 Link Here
6297
		flag = IProblem.EndOfSource;
6233
		flag = IProblem.EndOfSource;
6298
	else if (errorTokenName.equals(Scanner.INVALID_HEXA))
6234
	else if (errorTokenName.equals(Scanner.INVALID_HEXA))
6299
		flag = IProblem.InvalidHexa;
6235
		flag = IProblem.InvalidHexa;
6236
	else if (errorTokenName.equals(Scanner.ILLEGAL_HEXA_LITERAL))
6237
		flag = IProblem.IllegalHexaLiteral;
6300
	else if (errorTokenName.equals(Scanner.INVALID_OCTAL))
6238
	else if (errorTokenName.equals(Scanner.INVALID_OCTAL))
6301
		flag = IProblem.InvalidOctal;
6239
		flag = IProblem.InvalidOctal;
6302
	else if (errorTokenName.equals(Scanner.INVALID_CHARACTER_CONSTANT))
6240
	else if (errorTokenName.equals(Scanner.INVALID_CHARACTER_CONSTANT))
6303
		flag = IProblem.InvalidCharacterConstant;
6241
		flag = IProblem.InvalidCharacterConstant;
6304
	else if (errorTokenName.equals(Scanner.INVALID_ESCAPE))
6242
	else if (errorTokenName.equals(Scanner.INVALID_ESCAPE))
6305
		flag = IProblem.InvalidEscape;
6243
		flag = IProblem.InvalidEscape;
6306
	else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)){
6244
	else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)) {
6307
		flag = IProblem.InvalidUnicodeEscape;
6245
		flag = IProblem.InvalidUnicodeEscape;
6308
		// better locate the error message
6246
		// better locate the error message
6309
		char[] source = scanner.source;
6247
		char[] source = scanner.source;
Lines 6336-6341 Link Here
6336
		flag = IProblem.UnterminatedString;
6274
		flag = IProblem.UnterminatedString;
6337
	else if (errorTokenName.equals(Scanner.INVALID_DIGIT))
6275
	else if (errorTokenName.equals(Scanner.INVALID_DIGIT))
6338
		flag = IProblem.InvalidDigit;
6276
		flag = IProblem.InvalidDigit;
6277
	else if (errorTokenName.equals(Scanner.INVALID_BINARY))
6278
		flag = IProblem.InvalidBinary;
6279
	else if (errorTokenName.equals(Scanner.ILLEGAL_BINARY_LITERAL))
6280
		flag = IProblem.IllegalBinaryLiteral;
6281
	else if (errorTokenName.equals(Scanner.INVALID_UNDERSCORE))
6282
		flag = IProblem.IllegalUnderscorePosition;
6283
	else if (errorTokenName.equals(Scanner.INVALID_USAGE_OF_UNDERSCORE))
6284
		flag = IProblem.IllegalUsageOfUnderscore;
6285
	else if (errorTokenName.equals(Scanner.UNTERMINATED_EXOTIC_IDENTIFIER))
6286
		flag = IProblem.UnterminatedExoticIdentifier;
6287
	else if (errorTokenName.equals(Scanner.INVALID_CHAR_IN_EXOTIC_IDENTIFIER))
6288
		flag = IProblem.UnterminatedExoticIdentifier;
6289
	else if (errorTokenName.equals(Scanner.INVALID_EMPTY_EXOTIC_IDENTIFIER))
6290
		flag = IProblem.InvalidEmptyExoticIdentifier;
6291
	else if (errorTokenName.equals(Scanner.ILLEGAL_DANGEROUS_CHARACTER))
6292
		flag = IProblem.IllegalDangerousCharacter;
6293
	else if (errorTokenName.equals(Scanner.ILLEGAL_EXOTIC_IDENTIFIER))
6294
		flag = IProblem.IllegalExoticIdentifier;
6339
6295
6340
	String[] arguments = flag == IProblem.ParsingErrorNoSuggestion
6296
	String[] arguments = flag == IProblem.ParsingErrorNoSuggestion
6341
			? new String[] {errorTokenName}
6297
			? new String[] {errorTokenName}
Lines 7617-7620 Link Here
7617
		typeRef.sourceStart,
7573
		typeRef.sourceStart,
7618
		typeRef.sourceEnd);
7574
		typeRef.sourceEnd);
7619
}
7575
}
7576
7577
public void invalidUsageOfTypeAnnotations(Annotation annotation) {
7578
	this.handle(
7579
			IProblem.InvalidUsageOfTypeAnnotations,
7580
			NoArgument,
7581
			NoArgument,
7582
			annotation.sourceStart,
7583
			annotation.sourceEnd);
7584
}
7585
public void illegalReceiverAnnotations(Annotation first, Annotation last) {
7586
	this.handle(
7587
			IProblem.InvalidUsageOfReceiverAnnotations,
7588
			NoArgument,
7589
			NoArgument,
7590
			first.sourceStart,
7591
			last.sourceEnd);	
7592
}
7593
public void misplacedTypeAnnotations(Annotation first, Annotation last) {
7594
	this.handle(
7595
			IProblem.MisplacedTypeAnnotations,
7596
			NoArgument,
7597
			NoArgument,
7598
			first.sourceStart,
7599
			last.sourceEnd);	
7600
}
7601
public void illegalUsageOfTypeAnnotations(Annotation annotation) {
7602
	this.handle(
7603
			IProblem.IllegalUsageOfTypeAnnotations,
7604
			NoArgument,
7605
			NoArgument,
7606
			annotation.sourceStart,
7607
			annotation.sourceEnd);	
7608
}
7620
}
7609
}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-3 / +16 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2000, 2010 IBM Corporation and others.
2
# Copyright (c) 2000, 2011 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 213-219 Link Here
213
242 = Syntax error, insert "{0}" to complete phrase
213
242 = Syntax error, insert "{0}" to complete phrase
214
214
215
250 = Unexpected end of file
215
250 = Unexpected end of file
216
251 = Invalid hex literal number
216
251 = Invalid hexadecimal floating point literal number
217
252 = Invalid octal literal number
217
252 = Invalid octal literal number
218
253 = Invalid character constant
218
253 = Invalid character constant
219
254 = Invalid escape sequence (valid ones are  \\b  \\t  \\n  \\f  \\r  \\"  \\'  \\\\ )
219
254 = Invalid escape sequence (valid ones are  \\b  \\t  \\n  \\f  \\r  \\"  \\'  \\\\ )
Lines 228-233 Link Here
228
263 = Invalid low surrogate: must be within 0xDC00 and 0xDFFF
228
263 = Invalid low surrogate: must be within 0xDC00 and 0xDFFF
229
264 = Invalid high surrogate: must be within 0xD800 and 0xDBFF
229
264 = Invalid high surrogate: must be within 0xD800 and 0xDBFF
230
265 = Unnecessary $NON-NLS$ tag
230
265 = Unnecessary $NON-NLS$ tag
231
266 = Invalid binary literal number (only '0' and '1' are expected)
232
267 = Binary literals can only be used with source level greater or equals to 1.7
233
268 = Underscores have to be located within digits
234
269 = Underscores can only be used with source level greater or equals to 1.7
235
270 = Hexadecimal floating point literals can only be used with source level greater or equals to 1.5
236
271 = Exotic identifier is not properly closed by a double-quote
237
272 = Exotic identifier cannot be empty
238
273 = Invalid dangerous character (/ . ; < > [ ]). They must be escaped
239
274 = Exotic identifiers can only be used with compliance level greater or equals to 1.7
231
240
232
280 = Discouraged access: {0}
241
280 = Discouraged access: {0}
233
242
Lines 568-574 Link Here
568
634 = The method {0}({1}) of type {2} must override or implement a supertype method
577
634 = The method {0}({1}) of type {2} must override or implement a supertype method
569
635 = Unnecessary @SuppressWarnings("{0}")
578
635 = Unnecessary @SuppressWarnings("{0}")
570
636 = The method {0}({1}) of type {2} should be tagged with @Override since it actually overrides a superinterface method
579
636 = The method {0}({1}) of type {2} should be tagged with @Override since it actually overrides a superinterface method
571
580
637 = Syntax error, type annotations are available only when source level is at least 1.7
581
638 = Receiver annotations are illegal in a static method context
582
639 = Syntax error, type annotations are illegal here
583
640 = Syntax error, modifiers are illegal here
584
641 = Type annotation is illegal for a method that returns void
572
### MORE GENERICS
585
### MORE GENERICS
573
660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}>
586
660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}>
574
587
(-)dom/org/eclipse/jdt/core/dom/AST.java (-12 / +34 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 131-136 Link Here
131
	public static final int JLS3 = 3;
131
	public static final int JLS3 = 3;
132
132
133
	/**
133
	/**
134
	 * Constant for indicating the AST API that handles JLS3 + JDK 7 construct.
135
	 * This API is capable of handling all constructs in the
136
	 * Java language as described in the Java Language
137
	 * Specification, Third Edition (JLS3) + new JDK 7 syntax.
138
     * JLS3 is a superset of all earlier versions of the
139
     * Java language, and the JLS3 API can be used to manipulate
140
     * programs written in all versions of the Java language
141
     * up to and including J2SE 7 (aka JDK 1.7).
142
     *
143
	 * @since 3.7
144
	 */
145
	public static final int JLS4 = 4;
146
147
	/**
134
	 * The binding resolver for this AST. Initially a binding resolver that
148
	 * The binding resolver for this AST. Initially a binding resolver that
135
	 * does not resolve names at all.
149
	 * does not resolve names at all.
136
	 */
150
	 */
Lines 206-214 Link Here
206
     * @since 3.0
220
     * @since 3.0
207
	 */
221
	 */
208
	private AST(int level) {
222
	private AST(int level) {
209
		if ((level != AST.JLS2)
223
		switch(level) {
210
			&& (level != AST.JLS3)) {
224
			case AST.JLS2 :
211
			throw new IllegalArgumentException();
225
			case AST.JLS3 :
226
			case AST.JLS4 :
227
				// legal values
228
				break;
229
			default:
230
				throw new IllegalArgumentException();
212
		}
231
		}
213
		this.apiLevel = level;
232
		this.apiLevel = level;
214
		// initialize a scanner
233
		// initialize a scanner
Lines 216-223 Link Here
216
				true /*comment*/,
235
				true /*comment*/,
217
				true /*whitespace*/,
236
				true /*whitespace*/,
218
				false /*nls*/,
237
				false /*nls*/,
219
				ClassFileConstants.JDK1_3 /*sourceLevel*/,
238
				level == AST.JLS4 ? ClassFileConstants.JDK1_7 : ClassFileConstants.JDK1_3 /*sourceLevel*/,
220
				ClassFileConstants.JDK1_5 /*complianceLevel*/,
239
				level == AST.JLS4 ? ClassFileConstants.JDK1_7 : ClassFileConstants.JDK1_5 /*complianceLevel*/,
221
				null/*taskTag*/,
240
				null/*taskTag*/,
222
				null/*taskPriorities*/,
241
				null/*taskPriorities*/,
223
				true/*taskCaseSensitive*/);
242
				true/*taskCaseSensitive*/);
Lines 370-377 Link Here
370
	 * Creates a new Java abstract syntax tree
389
	 * Creates a new Java abstract syntax tree
371
     * (AST) following the specified set of API rules.
390
     * (AST) following the specified set of API rules.
372
     * <p>
391
     * <p>
373
     * Clients should use this method specifing {@link #JLS3} as the
392
     * Clients should use this method specifying {@link #JLS3} as the
374
     * AST level in all cases, even when dealing with JDK 1.3 or 1.4..
393
     * AST level in all cases, even when dealing with JDK 1.3 or 1.4.
375
     * </p>
394
     * </p>
376
     *
395
     *
377
 	 * @param level the API level; one of the LEVEL constants
396
 	 * @param level the API level; one of the LEVEL constants
Lines 383-393 Link Here
383
     * @since 3.0
402
     * @since 3.0
384
	 */
403
	 */
385
	public static AST newAST(int level) {
404
	public static AST newAST(int level) {
386
		if ((level != AST.JLS2)
405
		switch(level) {
387
			&& (level != AST.JLS3)) {
406
			case AST.JLS2 :
388
			throw new IllegalArgumentException();
407
			case AST.JLS3 :
408
			case AST.JLS4 :
409
				return new AST(level);
410
			default:
411
				throw new IllegalArgumentException();
389
		}
412
		}
390
		return new AST(level);
391
	}
413
	}
392
414
393
	/**
415
	/**
(-)dom/org/eclipse/jdt/core/dom/ASTParser.java (-4 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2010 IBM Corporation and others.
2
 * Copyright (c) 2004, 2011 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 217-225 Link Here
217
	 * declared on <code>AST</code>
217
	 * declared on <code>AST</code>
218
	 */
218
	 */
219
	ASTParser(int level) {
219
	ASTParser(int level) {
220
		if ((level != AST.JLS2_INTERNAL)
220
		switch(level) {
221
			&& (level != AST.JLS3)) {
221
			case AST.JLS2_INTERNAL :
222
			throw new IllegalArgumentException();
222
			case AST.JLS3 :
223
			case AST.JLS4 :
224
				break;
225
			default:
226
				throw new IllegalArgumentException();
223
		}
227
		}
224
		this.apiLevel = level;
228
		this.apiLevel = level;
225
		initializeDefaults();
229
		initializeDefaults();
(-)dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java (-1 / +47 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2008 IBM Corporation and others.
2
 * Copyright (c) 2006, 2011 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 126-131 Link Here
126
	}
126
	}
127
127
128
	public void endVisit(Block node) {
128
	public void endVisit(Block node) {
129
		int level = node.getAST().apiLevel;
130
		
131
		List statements = node.statements();
132
		next : for (int i = 0, max = statements.size(); i < max; i++) {
133
			ASTNode statement = (ASTNode) statements.get(i);
134
			if (statement.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT) {
135
				VariableDeclarationStatement variableDeclarationStatement =  (VariableDeclarationStatement) statement;
136
				
137
				if (level == AST.JLS2_INTERNAL) {
138
					if (variableDeclarationStatement.getModifiers() != Modifier.NONE) {
139
						continue next;
140
					}
141
				} else if (level >= AST.JLS3) {
142
					if (variableDeclarationStatement.modifiers().size() != 0) {
143
						continue next;
144
					}
145
				}
146
				
147
				Type type = variableDeclarationStatement.getType();
148
				if (type.getNodeType() != ASTNode.SIMPLE_TYPE) {
149
					continue next;
150
				}
151
				
152
				List fragments = variableDeclarationStatement.fragments();
153
				if (fragments.size() == 1) {
154
					VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
155
					
156
					SimpleName simpleName = fragment.getName();
157
					if (CharOperation.equals(RecoveryScanner.FAKE_IDENTIFIER, simpleName.getIdentifier().toCharArray())) {
158
						SimpleType simpleType = (SimpleType) type;
159
						Name name = simpleType.getName();
160
						name.setParent(null, null);
161
						name.setFlags(name.getFlags() | ASTNode.RECOVERED);
162
						
163
						final ExpressionStatement stmt = new ExpressionStatement(name.getAST());
164
						stmt.setExpression(name);
165
						stmt.setSourceRange(variableDeclarationStatement.getStartPosition(), variableDeclarationStatement.getLength());
166
						stmt.setFlags(stmt.getFlags() | ASTNode.RECOVERED);
167
						
168
						statements.add(i, stmt);
169
						statements.remove(variableDeclarationStatement);
170
					}
171
				}
172
			}
173
		}
174
		
129
		this.blockDepth--;
175
		this.blockDepth--;
130
		if(this.blockDepth <= 0) {
176
		if(this.blockDepth <= 0) {
131
			flagNodeWithInsertedTokens();
177
			flagNodeWithInsertedTokens();
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 46-52 Link Here
46
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
46
	ReferenceBinding allocatedType = codegenBinding.declaringClass;
47
47
48
	if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) {
48
	if (codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) {
49
		codeStream.new_(allocatedType);
49
		codeStream.new_(this.type, allocatedType);
50
		if (valueRequired) {
50
		if (valueRequired) {
51
			codeStream.dup();
51
			codeStream.dup();
52
		}
52
		}
Lines 83-89 Link Here
83
		if (this.arguments != null) {
83
		if (this.arguments != null) {
84
			int argsLength = this.arguments.length;
84
			int argsLength = this.arguments.length;
85
			codeStream.generateInlinedValue(argsLength);
85
			codeStream.generateInlinedValue(argsLength);
86
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
86
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
87
			codeStream.dup();
87
			codeStream.dup();
88
			for (int i = 0; i < argsLength; i++) {
88
			for (int i = 0; i < argsLength; i++) {
89
				codeStream.generateInlinedValue(i);
89
				codeStream.generateInlinedValue(i);
Lines 99-105 Link Here
99
			}
99
			}
100
		} else {
100
		} else {
101
			codeStream.generateInlinedValue(0);
101
			codeStream.generateInlinedValue(0);
102
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
102
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
103
		}
103
		}
104
		codeStream.invokeJavaLangReflectConstructorNewInstance();
104
		codeStream.invokeJavaLangReflectConstructorNewInstance();
105
		codeStream.checkcast(allocatedType);
105
		codeStream.checkcast(allocatedType);
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java (-2 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 19-24 Link Here
19
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
19
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
20
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
20
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
21
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
21
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
22
import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream;
22
import org.eclipse.jdt.internal.compiler.lookup.Binding;
23
import org.eclipse.jdt.internal.compiler.lookup.Binding;
23
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
25
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
Lines 115-122 Link Here
115
	this.produceAttributes = this.referenceBinding.scope.compilerOptions().produceDebugAttributes;
116
	this.produceAttributes = this.referenceBinding.scope.compilerOptions().produceDebugAttributes;
116
	this.creatingProblemType = creatingProblemType;
117
	this.creatingProblemType = creatingProblemType;
117
	if (this.targetJDK >= ClassFileConstants.JDK1_6) {
118
	if (this.targetJDK >= ClassFileConstants.JDK1_6) {
118
		this.codeStream = new StackMapFrameCodeStream(this);
119
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
119
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
120
		if (this.targetJDK >= ClassFileConstants.JDK1_7) {
121
			this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
122
			this.codeStream = new TypeAnnotationCodeStream(this);
123
		} else {
124
			this.codeStream = new StackMapFrameCodeStream(this);
125
		}
120
	} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
126
	} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
121
		this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
127
		this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
122
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
128
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 111-117 Link Here
111
		if (this.arguments != null) {
111
		if (this.arguments != null) {
112
			int argsLength = this.arguments.length;
112
			int argsLength = this.arguments.length;
113
			codeStream.generateInlinedValue(argsLength);
113
			codeStream.generateInlinedValue(argsLength);
114
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
114
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
115
			codeStream.dup();
115
			codeStream.dup();
116
			for (int i = 0; i < argsLength; i++) {
116
			for (int i = 0; i < argsLength; i++) {
117
				codeStream.generateInlinedValue(i);
117
				codeStream.generateInlinedValue(i);
Lines 127-133 Link Here
127
			}
127
			}
128
		} else {
128
		} else {
129
			codeStream.generateInlinedValue(0);
129
			codeStream.generateInlinedValue(0);
130
			codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
130
			codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
131
		}
131
		}
132
		codeStream.invokeJavaLangReflectMethodInvoke();
132
		codeStream.invokeJavaLangReflectMethodInvoke();
133
133
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java (-1 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 790-795 Link Here
790
790
791
	// reset stacks in consistent state
791
	// reset stacks in consistent state
792
	this.expressionPtr = -1;
792
	this.expressionPtr = -1;
793
	this.unattachedAnnotationPtr = -1;
794
	this.typeAnnotationLengthPtr = -1;
795
	this.typeAnnotationPtr = -1;
793
	this.identifierPtr = -1;
796
	this.identifierPtr = -1;
794
	this.identifierLengthPtr = -1;
797
	this.identifierLengthPtr = -1;
795
798
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 63-69 Link Here
63
		codeStream.aconst_null();
63
		codeStream.aconst_null();
64
64
65
		// void.class
65
		// void.class
66
		codeStream.generateClassLiteralAccessForType(TypeBinding.VOID, null);
66
		codeStream.generateClassLiteralAccessForType(null, TypeBinding.VOID, null);
67
	} else {
67
	} else {
68
		// swap with expression
68
		// swap with expression
69
		int valueTypeID = this.expression.resolvedType.id;
69
		int valueTypeID = this.expression.resolvedType.id;
Lines 80-86 Link Here
80
		}
80
		}
81
81
82
		// generate the expression type
82
		// generate the expression type
83
		codeStream.generateClassLiteralAccessForType(this.expression.resolvedType, null);
83
		codeStream.generateClassLiteralAccessForType(null, this.expression.resolvedType, null);
84
	}
84
	}
85
85
86
	// generate the invoke virtual to "setResult(Object,Class)"
86
	// generate the invoke virtual to "setResult(Object,Class)"
(-)grammar/java.g
Lines 177-185 Link Here
177
Goal ::= '>>' StaticInitializer
177
Goal ::= '>>' StaticInitializer
178
Goal ::= '>>' Initializer
178
Goal ::= '>>' Initializer
179
-- error recovery
179
-- error recovery
(-)Modifiersopt is used to properly consume a header and exit the rule reduction at the end of the parse() method (-4 / +51 lines)
Lines 200-205 Link Here
200
Goal ::= '?' AnnotationTypeMemberDeclaration
199
Goal ::= '?' AnnotationTypeMemberDeclaration
201
/:$readableName Goal:/
200
/:$readableName Goal:/
202
201
202
RecoveryExitHeader ::= $empty
203
RecoveryExitHeader ::= '...'
204
203
Literal -> IntegerLiteral
205
Literal -> IntegerLiteral
204
Literal -> LongLiteral
206
Literal -> LongLiteral
205
Literal -> FloatingPointLiteral
207
Literal -> FloatingPointLiteral
Lines 213-221 Link Here
213
BooleanLiteral -> false
215
BooleanLiteral -> false
214
/:$readableName BooleanLiteral:/
216
/:$readableName BooleanLiteral:/
215
217
216
Type ::= PrimitiveType
218
-- Type is a wrapper that automatically allows for jsr308 style
219
-- annotations to prefix a (Java5/6) Type. If type annotations
220
-- are illegal in a certain place, use TypeInternal instead.
221
-- If type annotations are legal, but so are java5/6 style
222
-- declaration annotations, use Type0 instead.
223
224
Type ::= TypeInternal
225
-- consumeUnannotatedType inserts 0 at the suitable place in the type
226
-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
227
-- length of the type annotations 0 or otherwise.
228
/.$putCase consumeUnannotatedType();  $break ./
229
Type ::= TypeAnnotations TypeInternal
230
/:$compliance 1.7:/
231
/:$readableName Type:/
232
233
-- Type0 is to be used in places where type annotations are legal
234
-- but are not consumed as TypeAnnotations, but as modifiers. This
235
-- is because from the parser's point of view there are places where
236
-- java5/6 style declarations annotations can occur in the same place
237
-- and it is too early to tell which is which.
238
Type0 ::= TypeInternal
239
-- consumeUnannotatedType inserts 0 at the suitable place in the type
240
-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
241
-- length of the type annotations 0 or otherwise.
242
/.$putCase consumeUnannotatedType();  $break ./
243
/:$readableName Type:/
244
245
-- TypeInternal is the Java5/6 Type
246
TypeInternal ::= PrimitiveType
217
/.$putCase consumePrimitiveType(); $break ./
247
/.$putCase consumePrimitiveType(); $break ./
218
Type -> ReferenceType
248
TypeInternal -> ReferenceType0
219
/:$readableName Type:/
249
/:$readableName Type:/
220
250
221
PrimitiveType -> NumericType
251
PrimitiveType -> NumericType
Lines 236-263 Link Here
236
FloatingPointType -> 'double'
266
FloatingPointType -> 'double'
237
/:$readableName FloatingPointType:/
267
/:$readableName FloatingPointType:/
238
268
239
ReferenceType ::= ClassOrInterfaceType
269
---------------------------- JSR308-------------------------------------------
270
-- ReferenceType has been wrapped now, so that it can be used by itself without
271
-- having to spell out the rule once with Modifiers & once without.
272
-- If type annotations are not legal prefixes to ReferenceType at some point, use 
273
-- ReferenceType0 instead. Otherwise reject the annotations in the parser.
274
275
ReferenceType ::= ReferenceType0
276
-- consumeUnannotatedType inserts 0 at the suitable place in the type
277
-- annotation stacks, so that the TOS(typeAnnotationsLengthStack) is the right
278
-- length of the type annotations 0 or otherwise.
279
/.$putCase consumeUnannotatedType();  $break ./
280
ReferenceType ::= Modifiers ReferenceType0
281
/.$putCase consumeAnnotatedType();  $break ./
282
/:$compliance 1.7:/
283
/:$readableName ReferenceType:/
284
285
ReferenceType0 ::= ClassOrInterfaceType0
240
/.$putCase consumeReferenceType();  $break ./
286
/.$putCase consumeReferenceType();  $break ./
241
ReferenceType -> ArrayType
287
ReferenceType0 -> ArrayType
242
/:$readableName ReferenceType:/
288
/:$readableName ReferenceType:/
243
289
(-)------------------------------------------------------------- (-32 / +166 lines)
Lines 267-274 Link Here
267
-- ArrayType ::= ArrayType '[' ']'
342
-- ArrayType ::= ArrayType '[' ']'
268
--
343
--
269
344
270
ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name
345
ArrayTypeWithTypeArgumentsName ::= GenericTypeDotName
271
/.$putCase consumeArrayTypeWithTypeArgumentsName();  $break ./
272
/:$readableName ArrayTypeWithTypeArgumentsName:/
346
/:$readableName ArrayTypeWithTypeArgumentsName:/
273
347
274
ArrayType ::= PrimitiveType Dims
348
ArrayType ::= PrimitiveType Dims
Lines 347-355 Link Here
347
/:$readableName Header1:/
421
/:$readableName Header1:/
348
422
349
Header2 -> Header
423
Header2 -> Header
350
Header2 -> EnumConstantHeader
424
Header2 -> EnumConstantHeader RecoveryEnumConstantSeparatoropt
351
/:$readableName Header2:/
425
/:$readableName Header2:/
352
426
427
RecoveryEnumConstantSeparatoropt ::= $empty
428
RecoveryEnumConstantSeparatoropt ::= ','
429
RecoveryEnumConstantSeparatoropt ::= ';'
430
353
CatchHeader ::= 'catch' '(' FormalParameter ')' '{'
431
CatchHeader ::= 'catch' '(' FormalParameter ')' '{'
354
/.$putCase consumeCatchHeader(); $break ./
432
/.$putCase consumeCatchHeader(); $break ./
355
/:$readableName CatchHeader:/
433
/:$readableName CatchHeader:/
Lines 548-554 Link Here
548
--    | 'transient'
626
--    | 'transient'
549
--    | 'volatile'
627
--    | 'volatile'
550
628
551
FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
629
FieldDeclaration ::= Modifiersopt Type0 VariableDeclarators ';'
552
/.$putCase consumeFieldDeclaration(); $break ./
630
/.$putCase consumeFieldDeclaration(); $break ./
553
/:$readableName FieldDeclaration:/
631
/:$readableName FieldDeclaration:/
554
632
Lines 556-561 Link Here
556
VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
634
VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
557
/.$putCase consumeVariableDeclarators(); $break ./
635
/.$putCase consumeVariableDeclarators(); $break ./
558
/:$readableName VariableDeclarators:/
636
/:$readableName VariableDeclarators:/
637
/:$recovery_template Identifier:/
559
638
560
VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
639
VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
561
VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
640
VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
Lines 619-625 Link Here
619
698
620
MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
699
MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
621
/.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./
700
/.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./
622
MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
701
MethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
623
/.$putCase consumeMethodHeaderName(false); $break ./
702
/.$putCase consumeMethodHeaderName(false); $break ./
624
/:$readableName MethodHeaderName:/
703
/:$readableName MethodHeaderName:/
625
704
Lines 628-634 Link Here
628
/:$readableName ):/
707
/:$readableName ):/
629
/:$recovery_template ):/
708
/:$recovery_template ):/
630
709
631
MethodHeaderExtendedDims ::= Dimsopt
710
MethodHeaderExtendedDims ::= DimsoptAnnotsopt
632
/.$putCase consumeMethodHeaderExtendedDims(); $break ./
711
/.$putCase consumeMethodHeaderExtendedDims(); $break ./
633
/:$readableName MethodHeaderExtendedDims:/
712
/:$readableName MethodHeaderExtendedDims:/
634
713
Lines 636-642 Link Here
636
/.$putCase consumeMethodHeaderThrowsClause(); $break ./
715
/.$putCase consumeMethodHeaderThrowsClause(); $break ./
637
/:$readableName MethodHeaderThrowsClause:/
716
/:$readableName MethodHeaderThrowsClause:/
638
717
639
ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt
718
ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen Annotationsopt MethodHeaderThrowsClauseopt
640
/.$putCase consumeConstructorHeader(); $break ./
719
/.$putCase consumeConstructorHeader(); $break ./
641
/:$readableName ConstructorDeclaration:/
720
/:$readableName ConstructorDeclaration:/
642
721
Lines 651-660 Link Here
651
/.$putCase consumeFormalParameterList(); $break ./
730
/.$putCase consumeFormalParameterList(); $break ./
652
/:$readableName FormalParameterList:/
731
/:$readableName FormalParameterList:/
653
732
733
PotentialNameArray -> $empty
734
/.$putCase consumePotentialNameArrayType(); $break ./
735
/:$readableName PotentialNameArray:/
736
654
--1.1 feature
737
--1.1 feature
655
FormalParameter ::= Modifiersopt Type VariableDeclaratorId
738
--FormalParameter ::= Modifiersopt Type VariableDeclaratorId
739
--FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
740
--The above rules have been rewritten by inlinng the type subgrammar
741
--to avoid the conflicts resulting from jsr308 changes.
742
FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt VariableDeclaratorId
743
/.$putCase consumeFormalParameter(false); $break ./
744
FormalParameter ::= Modifiersopt PrimitiveType DimsoptAnnotsopt '...' VariableDeclaratorId
745
/.$putCase consumeFormalParameter(true); $break ./
746
/:$compliance 1.5:/
747
FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray VariableDeclaratorId
748
/.$putCase consumeFormalParameter(false); $break ./
749
FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt PotentialNameArray '...' VariableDeclaratorId
750
/.$putCase consumeFormalParameter(true); $break ./
751
/:$compliance 1.5:/
752
FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt VariableDeclaratorId
753
/.$putCase consumeFormalParameter(false); $break ./
754
FormalParameter ::= Modifiersopt GenericType DimsoptAnnotsopt '...' VariableDeclaratorId
755
/.$putCase consumeFormalParameter(true); $break ./
756
/:$compliance 1.5:/
757
FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt VariableDeclaratorId
656
/.$putCase consumeFormalParameter(false); $break ./
758
/.$putCase consumeFormalParameter(false); $break ./
657
FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
759
FormalParameter ::= Modifiersopt GenericTypeDotName DimsoptAnnotsopt '...' VariableDeclaratorId
658
/.$putCase consumeFormalParameter(true); $break ./
760
/.$putCase consumeFormalParameter(true); $break ./
659
/:$readableName FormalParameter:/
761
/:$readableName FormalParameter:/
660
/:$compliance 1.5:/
762
/:$compliance 1.5:/
Lines 808-814 Link Here
808
InvalidInitializer -> Initializer
910
InvalidInitializer -> Initializer
809
/:$readableName InvalidInitializer:/
911
/:$readableName InvalidInitializer:/
810
912
811
812
InterfaceMemberDeclaration -> AbstractMethodDeclaration
913
InterfaceMemberDeclaration -> AbstractMethodDeclaration
813
InterfaceMemberDeclaration -> InvalidConstructorDeclaration
914
InterfaceMemberDeclaration -> InvalidConstructorDeclaration
814
InterfaceMemberDeclaration -> InvalidInitializer
915
InterfaceMemberDeclaration -> InvalidInitializer
Lines 872-884 Link Here
872
/.$putCase consumeLocalVariableDeclarationStatement(); $break ./
973
/.$putCase consumeLocalVariableDeclarationStatement(); $break ./
873
/:$readableName LocalVariableDeclarationStatement:/
974
/:$readableName LocalVariableDeclarationStatement:/
874
975
875
LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators
976
LocalVariableDeclaration ::= Type0 PushModifiers VariableDeclarators
876
/.$putCase consumeLocalVariableDeclaration(); $break ./
977
/.$putCase consumeLocalVariableDeclaration(); $break ./
877
-- 1.1 feature
978
-- 1.1 feature
878
-- The modifiers part of this rule makes the grammar more permissive. 
979
-- The modifiers part of this rule makes the grammar more permissive. 
879
-- The only modifier here is final. We put Modifiers to allow multiple modifiers
980
-- The only modifier here is final. We put Modifiers to allow multiple modifiers
880
-- This will require to check the validity of the modifier
981
-- This will require to check the validity of the modifier
881
LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators
982
LocalVariableDeclaration ::= Modifiers Type0 PushRealModifiers VariableDeclarators
882
/.$putCase consumeLocalVariableDeclaration(); $break ./
983
/.$putCase consumeLocalVariableDeclaration(); $break ./
883
/:$readableName LocalVariableDeclaration:/
984
/:$readableName LocalVariableDeclaration:/
884
985
Lines 1115-1124 Link Here
1115
/.$putCase consumeLeftParen(); $break ./
1216
/.$putCase consumeLeftParen(); $break ./
1116
/:$readableName (:/
1217
/:$readableName (:/
1117
/:$recovery_template (:/
1218
/:$recovery_template (:/
1219
PushRPARENForUnannotatedTypeCast ::= ')'
1220
/.$putCase consumeRightParenForUnannotatedTypeCast(); $break ./
1221
/:$readableName ):/
1222
/:$recovery_template ):/
1223
PushRPARENForNameUnannotatedTypeCast ::=  ')'
1224
/.$putCase consumeRightParenForNameUnannotatedTypeCast(); $break ./
1225
/:$readableName ):/
1226
/:$recovery_template ):/
1118
PushRPAREN ::= ')'
1227
PushRPAREN ::= ')'
1119
/.$putCase consumeRightParen(); $break ./
1228
/.$putCase consumeRightParen(); $break ./
1120
/:$readableName ):/
1229
/:$readableName ):/
1121
/:$recovery_template ):/
1230
/:$recovery_template ):/
1231
PushRPARENForAnnotatedTypeCast ::= ')'
1232
/.$putCase consumeRightParenForAnnotatedTypeCast(); $break ./
1233
/:$readableName ):/
1234
/:$recovery_template ):/
1235
1236
PushRPARENForNameAndAnnotatedTypeCast ::= ')'
1237
/.$putCase consumeRightParenForNameAndAnnotatedTypeCast(); $break ./
1238
/:$readableName ):/
1239
/:$recovery_template ):/
1122
1240
1123
Primary -> PrimaryNoNewArray
1241
Primary -> PrimaryNoNewArray
1124
Primary -> ArrayCreationWithArrayInitializer
1242
Primary -> ArrayCreationWithArrayInitializer
Lines 1138-1143 Link Here
1138
PrimaryNoNewArray -> ClassInstanceCreationExpression
1256
PrimaryNoNewArray -> ClassInstanceCreationExpression
1139
PrimaryNoNewArray -> FieldAccess
1257
PrimaryNoNewArray -> FieldAccess
1140
--1.1 feature
1258
--1.1 feature
1259
-- javac doesn't permit type annotations here.
1141
PrimaryNoNewArray ::= Name '.' 'this'
1260
PrimaryNoNewArray ::= Name '.' 'this'
1142
/.$putCase consumePrimaryNoNewArrayNameThis(); $break ./
1261
/.$putCase consumePrimaryNoNewArrayNameThis(); $break ./
1143
PrimaryNoNewArray ::= Name '.' 'super'
1262
PrimaryNoNewArray ::= Name '.' 'super'
Lines 1148-1153 Link Here
1148
--inline Type in the previous rule in order to make the grammar LL1 instead 
1267
--inline Type in the previous rule in order to make the grammar LL1 instead 
1149
-- of LL2. The result is the 3 next rules.
1268
-- of LL2. The result is the 3 next rules.
1150
1269
1270
PrimaryNoNewArray ::= Modifiers Name '.' 'class'
1271
/.$putCase consumePrimaryNoNewArrayNameWithTypeAnnotations(); $break ./
1272
/:$compliance 1.7:/
1273
1274
PrimaryNoNewArray ::= Modifiers Name Dims '.' 'class'
1275
/.$putCase consumePrimaryNoNewArrayArrayTypeWithTypeAnnotations(); $break ./
1276
/:$compliance 1.7:/
1277
1278
PrimaryNoNewArray ::= Modifiers PrimitiveType Dims '.' 'class'
1279
/.$putCase consumePrimaryNoNewArrayPrimitiveArrayTypeWithTypeAnnotations(); $break ./
1280
/:$compliance 1.7:/
1281
1282
PrimaryNoNewArray ::= Modifiers PrimitiveType '.' 'class'
1283
/.$putCase consumePrimaryNoNewArrayPrimitiveTypeWithTypeAnnotations(); $break ./
1284
/:$compliance 1.7:/
1285
1151
PrimaryNoNewArray ::= Name '.' 'class'
1286
PrimaryNoNewArray ::= Name '.' 'class'
1152
/.$putCase consumePrimaryNoNewArrayName(); $break ./
1287
/.$putCase consumePrimaryNoNewArrayName(); $break ./
1153
1288
Lines 1224-1241 Link Here
1224
/.$putCase consumeArgumentList(); $break ./
1359
/.$putCase consumeArgumentList(); $break ./
1225
/:$readableName ArgumentList:/
1360
/:$readableName ArgumentList:/
1226
1361
1227
ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs
1362
-- ArrayCreationHeader is used only in recovery and the consume* method is a NOP.
1363
ArrayCreationHeader ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs
1228
/.$putCase consumeArrayCreationHeader(); $break ./
1364
/.$putCase consumeArrayCreationHeader(); $break ./
1229
1230
ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
1365
ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
1231
/.$putCase consumeArrayCreationHeader(); $break ./
1366
/.$putCase consumeArrayCreationHeader(); $break ./
1232
/:$readableName ArrayCreationHeader:/
1367
/:$readableName ArrayCreationHeader:/
1233
1368
1234
ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
1369
ArrayCreationWithoutArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs
1235
/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
1370
/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
1236
/:$readableName ArrayCreationWithoutArrayInitializer:/
1371
/:$readableName ArrayCreationWithoutArrayInitializer:/
1237
1372
1238
ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
1373
ArrayCreationWithArrayInitializer ::= 'new' Annotationsopt PrimitiveType DimWithOrWithOutExprs ArrayInitializer
1239
/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
1374
/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
1240
/:$readableName ArrayCreationWithArrayInitializer:/
1375
/:$readableName ArrayCreationWithArrayInitializer:/
1241
1376
Lines 1250-1261 Link Here
1250
/.$putCase consumeDimWithOrWithOutExprs(); $break ./
1385
/.$putCase consumeDimWithOrWithOutExprs(); $break ./
1251
/:$readableName Dimensions:/
1386
/:$readableName Dimensions:/
1252
1387
1253
DimWithOrWithOutExpr ::= '[' Expression ']'
1388
DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations Expression ']'
1254
DimWithOrWithOutExpr ::= '[' ']'
1389
DimWithOrWithOutExpr ::= TypeAnnotations '[' Expression ']'
1390
/:$compliance 1.7:/
1391
DimWithOrWithOutExpr ::= '[' PushZeroTypeAnnotations ']'
1255
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1392
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1393
DimWithOrWithOutExpr ::= TypeAnnotations '[' ']'
1394
/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1395
/:$compliance 1.7:/
1256
/:$readableName Dimension:/
1396
/:$readableName Dimension:/
1257
-- -----------------------------------------------
1397
-- -----------------------------------------------
1258
1398
1399
-- jsr 308
1400
1401
DimsoptAnnotsopt -> $empty
1402
/. $putCase consumeEmptyDimsoptAnnotsopt(); $break ./
1403
/:$readableName AnnotationsDimensionsSequence:/
1404
DimsoptAnnotsopt -> DimsAnnotLoop
1405
/. $putCase consumeDimsWithTrailingAnnotsopt(); $break ./
1406
/:$readableName Dimensionsoptannotsopt:/
1407
DimsAnnotLoop ::= OneDimOrAnnot
1408
DimsAnnotLoop ::= DimsAnnotLoop OneDimOrAnnot
1409
/:$readableName DimsAnnotLoop:/
1410
1411
OneDimOrAnnot ::= Annotation
1412
/. $putCase consumeTypeAnnotation(true); $break ./
1413
-- Complain if source level < 1.7
1414
/:$compliance 1.7:/
1415
OneDimOrAnnot -> '[' ']'
1416
/. $putCase consumeOneDimLoop(true); $break ./
1417
-- Bump up dimensions && mark zero annotations.
1418
/:$readableName OneDimensionOrAnnotation:/
1419
1420
TypeAnnotations ::= Annotation
1421
/. $putCase consumeTypeAnnotation(false); $break ./
1422
/:$compliance 1.7:/
1423
TypeAnnotations ::= TypeAnnotations Annotation
1424
/. $putCase consumeOneMoreTypeAnnotation(); $break ./
1425
/:$compliance 1.7:/
1426
/:$readableName TypeAnnotations:/
1427
1259
Dims ::= DimsLoop
1428
Dims ::= DimsLoop
1260
/. $putCase consumeDims(); $break ./
1429
/. $putCase consumeDims(); $break ./
1261
/:$readableName Dimensions:/
1430
/:$readableName Dimensions:/
Lines 1263-1270 Link Here
1263
DimsLoop ::= DimsLoop OneDimLoop
1432
DimsLoop ::= DimsLoop OneDimLoop
1264
/:$readableName Dimensions:/
1433
/:$readableName Dimensions:/
1265
OneDimLoop ::= '[' ']'
1434
OneDimLoop ::= '[' ']'
1266
/. $putCase consumeOneDimLoop(); $break ./
1435
/. $putCase consumeOneDimLoop(false); $break ./
1436
-- Bump up dimensions && mark zero annotations.
1267
/:$readableName Dimension:/
1437
/:$readableName Dimension:/
1438
OneDimLoop ::= TypeAnnotations '[' ']'
1439
/:$compliance 1.7:/
1440
/. $putCase consumeOneDimLoopWithAnnotations(); $break ./
1441
-- Bump up dimensions
1442
/:$readableName DimensionWithAnnotations:/
1268
1443
1269
FieldAccess ::= Primary '.' 'Identifier'
1444
FieldAccess ::= Primary '.' 'Identifier'
1270
/.$putCase consumeFieldAccess(false); $break ./
1445
/.$putCase consumeFieldAccess(false); $break ./
Lines 1345-1360 Link Here
1345
UnaryExpressionNotPlusMinus -> CastExpression
1520
UnaryExpressionNotPlusMinus -> CastExpression
1346
/:$readableName Expression:/
1521
/:$readableName Expression:/
1347
1522
1348
CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
1523
CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpression
1349
/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
1524
/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
1350
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
1525
CastExpression ::= PushLPAREN Modifiers PrimitiveType Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpression
1526
/:$compliance 1.7:/
1527
/.$putCase consumeCastExpressionWithPrimitiveTypeWithTypeAnnotations(); $break ./
1528
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1351
/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
1529
/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
1352
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
1530
CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1531
/:$compliance 1.7:/
1532
/.$putCase consumeCastExpressionWithGenericsArrayWithTypeAnnotations(); $break ./
1533
CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForUnannotatedTypeCast InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
1353
/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
1534
/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
1354
CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
1535
CastExpression ::= PushLPAREN Modifiers Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType0 Dimsopt PushRPARENForAnnotatedTypeCast InsideCastExpressionWithAnnotatedQualifiedGenerics UnaryExpressionNotPlusMinus
1536
/:$compliance 1.7:/
1537
/.$putCase consumeCastExpressionWithQualifiedGenericsArrayWithTypeAnnotations(); $break ./
1538
CastExpression ::= PushLPAREN Name PushRPARENForNameUnannotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
1355
/.$putCase consumeCastExpressionLL1(); $break ./
1539
/.$putCase consumeCastExpressionLL1(); $break ./
1356
CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
1540
CastExpression ::= PushLPAREN Modifiers Name PushRPARENForNameAndAnnotatedTypeCast InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
1541
/:$compliance 1.7:/
1542
/.$putCase consumeCastExpressionLL1WithTypeAnnotations(); $break ./
1543
CastExpression ::= PushLPAREN Name Dims PushRPARENForUnannotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1357
/.$putCase consumeCastExpressionWithNameArray(); $break ./
1544
/.$putCase consumeCastExpressionWithNameArray(); $break ./
1545
CastExpression ::= PushLPAREN Modifiers Name Dims PushRPARENForAnnotatedTypeCast InsideCastExpression UnaryExpressionNotPlusMinus
1546
/:$compliance 1.7:/
1547
/.$putCase consumeCastExpressionWithNameArrayWithTypeAnnotations(); $break ./
1358
/:$readableName CastExpression:/
1548
/:$readableName CastExpression:/
1359
1549
1360
OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
1550
OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
Lines 1371-1376 Link Here
1371
/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
1561
/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
1372
/:$readableName InsideCastExpression:/
1562
/:$readableName InsideCastExpression:/
1373
1563
1564
InsideCastExpressionWithAnnotatedQualifiedGenerics ::= $empty
1565
/.$putCase consumeInsideCastExpressionWithAnnotatedQualifiedGenerics(); $break ./
1566
/:$readableName InsideCastExpression:/
1567
1374
MultiplicativeExpression -> UnaryExpression
1568
MultiplicativeExpression -> UnaryExpression
1375
MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
1569
MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
1376
/.$putCase consumeBinaryExpression(OperatorIds.MULTIPLY); $break ./
1570
/.$putCase consumeBinaryExpression(OperatorIds.MULTIPLY); $break ./
Lines 1673-1683 Link Here
1673
/.$putCase consumeEnhancedForStatement(); $break ./
1867
/.$putCase consumeEnhancedForStatement(); $break ./
1674
/:$readableName EnhancedForStatementNoShortIf:/
1868
/:$readableName EnhancedForStatementNoShortIf:/
1675
1869
1676
EnhancedForStatementHeaderInit ::= 'for' '(' Type PushModifiers Identifier Dimsopt
1870
EnhancedForStatementHeaderInit ::= 'for' '(' Type0 PushModifiers Identifier Dimsopt
1677
/.$putCase consumeEnhancedForStatementHeaderInit(false); $break ./
1871
/.$putCase consumeEnhancedForStatementHeaderInit(false); $break ./
1678
/:$readableName EnhancedForStatementHeaderInit:/
1872
/:$readableName EnhancedForStatementHeaderInit:/
1679
1873
1680
EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type PushRealModifiers Identifier Dimsopt
1874
EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type0 PushRealModifiers Identifier Dimsopt
1681
/.$putCase consumeEnhancedForStatementHeaderInit(true); $break ./
1875
/.$putCase consumeEnhancedForStatementHeaderInit(true); $break ./
1682
/:$readableName EnhancedForStatementHeaderInit:/
1876
/:$readableName EnhancedForStatementHeaderInit:/
1683
1877
Lines 1752-1759 Link Here
1752
/:$compliance 1.5:/
1946
/:$compliance 1.5:/
1753
ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
1947
ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
1754
/.$putCase consumeTypeArgumentReferenceType1(); $break ./
1948
/.$putCase consumeTypeArgumentReferenceType1(); $break ./
1755
/:$readableName ReferenceType1:/
1756
/:$compliance 1.5:/
1949
/:$compliance 1.5:/
1950
ReferenceType1 ::= Modifiers ClassOrInterface '<' TypeArgumentList2
1951
/:$compliance 1.7:/
1952
/.$putCase consumeTypeArgumentReferenceType1WithTypeAnnotations(); $break ./
1953
/:$readableName ReferenceType1:/
1757
1954
1758
TypeArgumentList2 -> TypeArgument2
1955
TypeArgumentList2 -> TypeArgument2
1759
/:$compliance 1.5:/
1956
/:$compliance 1.5:/
Lines 1773-1780 Link Here
1773
/:$compliance 1.5:/
1970
/:$compliance 1.5:/
1774
ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
1971
ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
1775
/.$putCase consumeTypeArgumentReferenceType2(); $break ./
1972
/.$putCase consumeTypeArgumentReferenceType2(); $break ./
1776
/:$readableName ReferenceType2:/
1777
/:$compliance 1.5:/
1973
/:$compliance 1.5:/
1974
ReferenceType2 ::= Modifiers ClassOrInterface '<' TypeArgumentList3
1975
/:$compliance 1.7:/
1976
/.$putCase consumeTypeArgumentReferenceType2WithTypeAnnotations(); $break ./
1977
/:$readableName ReferenceType2:/
1778
1978
1779
TypeArgumentList3 -> TypeArgument3
1979
TypeArgumentList3 -> TypeArgument3
1780
TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
1980
TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
Lines 1856-1865 Link Here
1856
/:$readableName WildcardBound3:/
2056
/:$readableName WildcardBound3:/
1857
/:$compliance 1.5:/
2057
/:$compliance 1.5:/
1858
2058
1859
TypeParameterHeader ::= Identifier
2059
PushZeroTypeAnnotations ::= $empty
2060
/.$putCase consumeZeroTypeAnnotations(true); $break ./
2061
/:$readableName ZeroTypeAnnotations:/
2062
2063
TypeParameterHeader ::= PushZeroTypeAnnotations Identifier
1860
/.$putCase consumeTypeParameterHeader(); $break ./
2064
/.$putCase consumeTypeParameterHeader(); $break ./
1861
/:$readableName TypeParameter:/
1862
/:$compliance 1.5:/
2065
/:$compliance 1.5:/
2066
TypeParameterHeader ::= TypeAnnotations Identifier
2067
/:$compliance 1.7:/
2068
/.$putCase consumeTypeParameterHeader(); $break ./
2069
/:$readableName TypeParameter:/
1863
2070
1864
TypeParameters ::= '<' TypeParameterList1
2071
TypeParameters ::= '<' TypeParameterList1
1865
/.$putCase consumeTypeParameters(); $break ./
2072
/.$putCase consumeTypeParameters(); $break ./
Lines 2126-2132 Link Here
2126
2333
2127
AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2334
AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2128
/.$putCase consumeMethodHeaderNameWithTypeParameters(true); $break ./
2335
/.$putCase consumeMethodHeaderNameWithTypeParameters(true); $break ./
2129
AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
2336
AnnotationMethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
2130
/.$putCase consumeMethodHeaderName(true); $break ./
2337
/.$putCase consumeMethodHeaderName(true); $break ./
2131
/:$readableName MethodHeaderName:/
2338
/:$readableName MethodHeaderName:/
2132
/:$compliance 1.5:/
2339
/:$compliance 1.5:/
Lines 2172-2177 Link Here
2172
/.$putCase consumeAnnotationName() ; $break ./
2379
/.$putCase consumeAnnotationName() ; $break ./
2173
/:$readableName AnnotationName:/
2380
/:$readableName AnnotationName:/
2174
/:$compliance 1.5:/
2381
/:$compliance 1.5:/
2382
/:$recovery_template @ Identifier:/
2175
2383
2176
NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')'
2384
NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')'
2177
/.$putCase consumeNormalAnnotation() ; $break ./
2385
/.$putCase consumeNormalAnnotation() ; $break ./
Lines 2269-2275 Link Here
2269
RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2477
RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
2270
/.$putCase consumeRecoveryMethodHeaderNameWithTypeParameters(); $break ./
2478
/.$putCase consumeRecoveryMethodHeaderNameWithTypeParameters(); $break ./
2271
/:$compliance 1.5:/
2479
/:$compliance 1.5:/
2272
RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
2480
RecoveryMethodHeaderName ::= Modifiersopt Type0 'Identifier' '('
2273
/.$putCase consumeRecoveryMethodHeaderName(); $break ./
2481
/.$putCase consumeRecoveryMethodHeaderName(); $break ./
2274
/:$readableName MethodHeaderName:/
2482
/:$readableName MethodHeaderName:/
2275
2483
Lines 2338-2340 Link Here
2338
2546
2339
$end
2547
$end
2340
-- need a carriage return after the $end
2548
-- need a carriage return after the $end
2549
(-)model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java (-1 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 140-143 Link Here
140
	 * @since 3.2
140
	 * @since 3.2
141
	 */
141
	 */
142
	char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
142
	char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
143
144
	/**
145
	 * "RuntimeVisibleTypeAnnotations" attribute (added in jsr 308).
146
	 * @since 3.7
147
	 */
148
	char[] RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
149
150
	/**
151
	 * "RuntimeInvisibleTypeAnnotations" attribute (added in jsr 308).
152
	 * @since 3.7
153
	 */
154
	char[] RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
143
}
155
}
(-)model/org/eclipse/jdt/core/util/IExtendedAnnotation.java (+160 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of an extended annotation structure as described in the JVM specifications
15
 * (added in JavaSE-1.7).
16
 *
17
 * This interface may be implemented by clients.
18
 *
19
 * @since 3.7
20
 */
21
public interface IExtendedAnnotation extends IAnnotation {
22
	/**
23
	 * Answer back the target type as described in the JVM specifications.
24
	 *
25
	 * @return the target type
26
	 */
27
	int getTargetType();
28
	
29
	/**
30
	 * Answer back the offset.
31
	 * 
32
	 * For a target_type value equals to:
33
	 * <table border="1">
34
	 * <tr>
35
	 * <th>target_type</th>
36
	 * <th>offset description</th>
37
	 * </tr>
38
	 * <tr>
39
	 * <td>0x00, 0x02, 0x04, 0x1E</td>
40
	 * <td>The offset within the bytecodes of the containing method of the <code>checkcast</code> 
41
	 * bytecode emitted for a typecast, the <code>instanceof</code> bytecode for the type tests, 
42
	 * the <code>new</code> bytecode emitted for the object creation expression, the <code>ldc(_w)</code>
43
	 * bytecode emitted for class literal, or the <code>getstatic</code> bytecode emitted for primitive
44
	 * class literals.</td>
45
	 * </tr>
46
	 * <tr>
47
	 * <td>0x18, 0x1A</td>
48
	 * <td>The offset within the bytecodes of the containing method of the <code>new</code> 
49
	 * bytecode emitted for a constructor call, or the <code>invoke{interface|special|static|virtual}</code>
50
	 * bytecode emitted for a method invocation.</td>
51
	 * </tr>
52
	 * </table>
53
	 * 
54
	 * 
55
	 * @return the offset
56
	 */
57
	int getOffset();
58
	
59
	/**
60
	 * Answer back the local variable reference info table length of this entry as specified in
61
	 * the JVM specifications.
62
	 * 
63
	 * <p>This is defined only for annotations related a local variable.</p>
64
	 *
65
	 * @return the local variable reference info table length of this entry as specified in
66
	 * the JVM specifications
67
	 */
68
	int getLocalVariableRefenceInfoLength();
69
	
70
	/**
71
	 * Answer back the local variable reference info table of this entry as specified in
72
	 * the JVM specifications. Answer an empty array if none.
73
	 * 
74
	 * <p>This is defined only for annotations related a local variable.</p>
75
	 *
76
	 * @return the local variable reference info table of this entry as specified in
77
	 * the JVM specifications. Answer an empty array if none
78
	 */
79
	ILocalVariableReferenceInfo[] getLocalVariableTable();
80
	
81
	/**
82
	 * Answer back the method parameter index.
83
	 * 
84
	 * <p>The index is 0-based.</p>
85
	 * 
86
	 * @return the method parameter index
87
	 */
88
	int getParameterIndex();
89
90
	/**
91
	 * Answer back the method type parameter index.
92
	 * 
93
	 * <p>The index is 0-based.</p>
94
	 * 
95
	 * @return the method type parameter index
96
	 */
97
	int getTypeParameterIndex();
98
99
	/**
100
	 * Answer back the method type parameter bound index.
101
	 * 
102
	 * <p>The index is 0-based.</p>
103
	 * 
104
	 * @return the method type parameter bound index
105
	 */
106
	int getTypeParameterBoundIndex();
107
108
	/**
109
	 * Answer back the index in the given different situations.
110
	 * 
111
	 * <p>The index is 0-based.</p>
112
	 * 
113
	 * <table border="1">
114
	 * <tr>
115
	 * <th>target_type</th>
116
	 * <th>offset description</th>
117
	 * </tr>
118
	 * <tr>
119
	 * <td>0x18, 0x1A</td>
120
	 * <td>the type argument index in the expression</td>
121
	 * </tr>
122
	 * <tr>
123
	 * <td>0x14</td>
124
	 * <td>the index of the type in the clause: <code>-1 (255)</code> is used if the annotation is on 
125
	 * the superclass type, and the value <code>i</code> is used if the annotation is on the <code>i</code>th
126
	 * superinterface type (counting from zero).</td>
127
	 * </tr>
128
	 * <tr>
129
	 * <td>0x16</td>
130
	 * <td>the index of the exception type in the clause: the value <code>i</code> denotes an annotation of the 
131
	 * <code>i</code>th exception type (counting from zero).</td>
132
	 * </tr>
133
	 * </table>
134
	 * @return the index in the given different situations
135
	 */
136
	int getAnnotationTypeIndex();
137
	
138
	/**
139
	 * Answer back the target type of the location of the wildcard as described in the JVM specifications.
140
	 *
141
	 * @return the target type of the location of the wildcard
142
	 */
143
	int getWildcardLocationType();
144
	
145
	/**
146
	 * Answer back the locations of the wildcard type as described in the JVM specifications.
147
	 *
148
	 * @return the locations of the wildcard type
149
	 */
150
	int[] getWildcardLocations();
151
	
152
	/**
153
	 * Answer back the locations of the annotated type as described in the JVM specifications.
154
	 * 
155
	 * <p>This is used for parameterized and array types.</p>
156
	 *
157
	 * @return the locations of the annotated type
158
	 */
159
	int[] getLocations();
160
}
(-)model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java (+60 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
14
15
/**
16
 * Description of an extended annotation target types constants as described in the JVM specifications
17
 * (added in JavaSE-1.7).
18
 *
19
 * @since 3.7
20
 * @noimplement This interface is not intended to be implemented by clients.
21
 * @noextend This interface is not intended to be extended by clients.
22
 */
23
public interface IExtendedAnnotationConstants {
24
	int METHOD_RECEIVER = AnnotationTargetTypeConstants.METHOD_RECEIVER;
25
	int METHOD_RECEIVER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY;
26
	int METHOD_RETURN_TYPE = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE;
27
	int METHOD_RETURN_TYPE_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY;
28
	int METHOD_PARAMETER = AnnotationTargetTypeConstants.METHOD_PARAMETER;
29
	int METHOD_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY;
30
	int FIELD = AnnotationTargetTypeConstants.FIELD;
31
	int FIELD_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.FIELD_GENERIC_OR_ARRAY;
32
	int CLASS_TYPE_PARAMETER_BOUND = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND;
33
	int CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
34
	int METHOD_TYPE_PARAMETER_BOUND = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND;
35
	int METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY;
36
	int CLASS_EXTENDS_IMPLEMENTS = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS;
37
	int CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY;
38
	int THROWS = AnnotationTargetTypeConstants.THROWS;
39
	int THROWS_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.THROWS_GENERIC_OR_ARRAY;
40
	int WILDCARD_BOUND = AnnotationTargetTypeConstants.WILDCARD_BOUND;
41
	int WILDCARD_BOUND_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY;
42
	int METHOD_TYPE_PARAMETER = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER;
43
	int METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY;
44
	int CLASS_TYPE_PARAMETER = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER;
45
	int CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY;
46
	int TYPE_CAST = AnnotationTargetTypeConstants.TYPE_CAST;
47
	int TYPE_CAST_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_CAST_GENERIC_OR_ARRAY;
48
	int TYPE_INSTANCEOF = AnnotationTargetTypeConstants.TYPE_INSTANCEOF;
49
	int TYPE_INSTANCEOF_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY;
50
	int OBJECT_CREATION = AnnotationTargetTypeConstants.OBJECT_CREATION;
51
	int OBJECT_CREATION_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.OBJECT_CREATION_GENERIC_OR_ARRAY;
52
	int LOCAL_VARIABLE = AnnotationTargetTypeConstants.LOCAL_VARIABLE;
53
	int LOCAL_VARIABLE_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY;
54
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL;
55
	int TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY;
56
	int TYPE_ARGUMENT_METHOD_CALL = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL;
57
	int TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY;
58
	int CLASS_LITERAL = AnnotationTargetTypeConstants.CLASS_LITERAL;
59
	int CLASS_LITERAL_GENERIC_OR_ARRAY = AnnotationTargetTypeConstants.CLASS_LITERAL_GENERIC_OR_ARRAY;
60
}
(-)model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of a local variable reference info table entry as specified in the JVM specifications.
15
 *
16
 * This interface may be implemented by clients.
17
 *
18
 * @since 3.7
19
 */
20
public interface ILocalVariableReferenceInfo {
21
22
	/**
23
	 * Answer back the start pc of this entry as specified in
24
	 * the JVM specifications.
25
	 *
26
	 * @return the start pc of this entry as specified in
27
	 * the JVM specifications
28
	 */
29
	int getStartPC();
30
31
	/**
32
	 * Answer back the length of this entry as specified in
33
	 * the JVM specifications.
34
	 *
35
	 * @return the length of this entry as specified in
36
	 * the JVM specifications
37
	 */
38
	int getLength();
39
40
	/**
41
	 * Answer back the resolved position of the local variable as specified in
42
	 * the JVM specifications.
43
	 *
44
	 * @return the resolved position of the local variable as specified in
45
	 * the JVM specifications
46
	 */
47
	int getIndex();
48
}
(-)model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of a runtime invisible type annotations attribute as described in the JVM specifications
15
 * (added in JavaSE-1.7).
16
 *
17
 * This interface may be implemented by clients.
18
 *
19
 * @since 3.7
20
 */
21
public interface IRuntimeInvisibleTypeAnnotationsAttribute extends IClassFileAttribute {
22
23
	/**
24
	 * Answer back the number of extended annotations as described in the JVM specifications.
25
	 *
26
	 * @return the number of extended annotations
27
	 */
28
	int getExtendedAnnotationsNumber();
29
30
	/**
31
	 * Answer back the extended annotations. Answers an empty collection if none.
32
	 *
33
	 * @return the extended annotations
34
	 */
35
	IExtendedAnnotation[] getExtendedAnnotations();
36
}
(-)model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of a runtime visible type annotations attribute as described in the JVM specifications
15
 * (added in J2SE 1.5).
16
 *
17
 * This interface may be implemented by clients.
18
 *
19
 * @since 3.7
20
 */
21
public interface IRuntimeVisibleTypeAnnotationsAttribute extends IClassFileAttribute {
22
23
	/**
24
	 * Answer back the number of annotations as described in the JVM specifications.
25
	 *
26
	 * @return the number of annotations
27
	 */
28
	int getExtendedAnnotationsNumber();
29
30
	/**
31
	 * Answer back the extended annotations. Answers an empty collection if none.
32
	 *
33
	 * @return the extended annotations. Answers an empty collection if none.
34
	 */
35
	IExtendedAnnotation[] getExtendedAnnotations();
36
}
(-)model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java (-10 / +178 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 18-23 Link Here
18
import org.eclipse.jdt.internal.compiler.ast.*;
18
import org.eclipse.jdt.internal.compiler.ast.*;
19
import org.eclipse.jdt.internal.compiler.parser.*;
19
import org.eclipse.jdt.internal.compiler.parser.*;
20
import org.eclipse.jdt.internal.compiler.problem.*;
20
import org.eclipse.jdt.internal.compiler.problem.*;
21
import org.eclipse.jdt.internal.compiler.util.Util;
21
22
22
public class DocumentElementParser extends Parser {
23
public class DocumentElementParser extends Parser {
23
	IDocumentElementRequestor requestor;
24
	IDocumentElementRequestor requestor;
Lines 411-416 Link Here
411
	char[] varName = this.identifierStack[this.identifierPtr];
412
	char[] varName = this.identifierStack[this.identifierPtr];
412
	long namePosition = this.identifierPositionStack[this.identifierPtr--];
413
	long namePosition = this.identifierPositionStack[this.identifierPtr--];
413
	int extendedTypeDimension = this.intStack[this.intPtr--];
414
	int extendedTypeDimension = this.intStack[this.intPtr--];
415
	// pop any annotations on extended dimensions now, so they don't pollute the base dimensions.
416
	Annotation [][] annotationsOnExtendedDimensions = extendedTypeDimension == 0 ? null : getAnnotationsOnDimensions(extendedTypeDimension);
417
414
418
415
	AbstractVariableDeclaration declaration;
419
	AbstractVariableDeclaration declaration;
416
	if (this.nestedMethod[this.nestedType] != 0) {
420
	if (this.nestedMethod[this.nestedType] != 0) {
Lines 474-480 Link Here
474
		declaration.type = type;
478
		declaration.type = type;
475
	} else {
479
	} else {
476
		int dimension = typeDim + extendedTypeDimension;
480
		int dimension = typeDim + extendedTypeDimension;
477
		declaration.type = copyDims(type, dimension);
481
		Annotation [][] annotationsOnAllDimensions = null;
482
		Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions();
483
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
484
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedTypeDimension, annotationsOnExtendedDimensions); 
485
		}
486
		declaration.type = copyDims(type, dimension, annotationsOnAllDimensions);
478
	}
487
	}
479
	this.variablesCounter[this.nestedType]++;
488
	this.variablesCounter[this.nestedType]++;
480
	this.nestedMethod[this.nestedType]++;
489
	this.nestedMethod[this.nestedType]++;
Lines 499-504 Link Here
499
				extendedTypeDimension == 0 ? -1 : this.endPosition);
508
				extendedTypeDimension == 0 ? -1 : this.endPosition);
500
	}
509
	}
501
}
510
}
511
protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) {
512
	TypeReference type;
513
514
	char[] identifierName = this.identifierStack[this.identifierPtr];
515
	long namePosition = this.identifierPositionStack[this.identifierPtr];
516
517
	LocalDeclaration localDeclaration = createLocalDeclaration(identifierName, (int) (namePosition >>> 32), (int) namePosition);
518
	localDeclaration.declarationSourceEnd = localDeclaration.declarationEnd;
519
520
	int extraDims = this.intStack[this.intPtr--];
521
	this.identifierPtr--;
522
	this.identifierLengthPtr--;
523
	// remove fake modifiers/modifiers start
524
	int declarationSourceStart1 = 0;
525
	int modifiersSourceStart1 = 0;
526
	int modifiersValue  = 0;
527
	if (hasModifiers) {
528
		declarationSourceStart1 = this.intStack[this.intPtr--];
529
		modifiersSourceStart1 = this.intStack[this.intPtr--];
530
		modifiersValue = this.intStack[this.intPtr--];
531
	} else {
532
		this.intPtr-=3;
533
	}
534
535
	type = getTypeReference(this.intStack[this.intPtr--] + extraDims); // type dimension
536
537
	// consume annotations
538
	int length;
539
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--])!= 0) {
540
		System.arraycopy(
541
			this.expressionStack,
542
			(this.expressionPtr -= length) + 1,
543
			localDeclaration.annotations = new Annotation[length],
544
			0,
545
			length);
546
	}
547
	if (hasModifiers) {
548
		localDeclaration.declarationSourceStart = declarationSourceStart1;
549
		localDeclaration.modifiersSourceStart = modifiersSourceStart1;
550
		localDeclaration.modifiers = modifiersValue;
551
	} else {
552
		localDeclaration.declarationSourceStart = type.sourceStart;
553
	}
554
	localDeclaration.type = type;
555
556
	ForeachStatement iteratorForStatement =
557
		new ForeachStatement(
558
			localDeclaration,
559
			this.intStack[this.intPtr--]);
560
	pushOnAstStack(iteratorForStatement);
561
562
	iteratorForStatement.sourceEnd = localDeclaration.declarationSourceEnd;
563
}
564
protected void consumeMethodHeaderNameWithTypeParameters(boolean isAnnotationMethod) {
565
	// MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
566
	// AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
567
	// RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
568
	MethodDeclaration md = null;
569
	if(isAnnotationMethod) {
570
		md = new AnnotationMethodDeclaration(this.compilationUnit.compilationResult);
571
		this.recordStringLiterals = false;
572
	} else {
573
		md = new MethodDeclaration(this.compilationUnit.compilationResult);
574
	}
575
576
	//name
577
	md.selector = this.identifierStack[this.identifierPtr];
578
	long selectorSource = this.identifierPositionStack[this.identifierPtr--];
579
	this.identifierLengthPtr--;
580
	//type
581
	md.returnType = getTypeReference(this.intStack[this.intPtr--]);
582
583
	// consume type parameters
584
	int length = this.genericsLengthStack[this.genericsLengthPtr--];
585
	this.genericsPtr -= length;
586
	System.arraycopy(this.genericsStack, this.genericsPtr + 1, md.typeParameters = new TypeParameter[length], 0, length);
587
588
	//modifiers
589
	md.declarationSourceStart = this.intStack[this.intPtr--];
590
	md.modifiersSourceStart = this.intStack[this.intPtr--];
591
	md.modifiers = this.intStack[this.intPtr--];
592
	// consume annotations
593
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
594
		System.arraycopy(
595
			this.expressionStack,
596
			(this.expressionPtr -= length) + 1,
597
			md.annotations = new Annotation[length],
598
			0,
599
			length);
600
	}
601
	// javadoc
602
	md.javadoc = this.javadoc;
603
	this.javadoc = null;
604
605
	//highlight starts at selector start
606
	md.sourceStart = (int) (selectorSource >>> 32);
607
	pushOnAstStack(md);
608
	md.sourceEnd = this.lParenPos;
609
	md.bodyStart = this.lParenPos+1;
610
	this.listLength = 0; // initialize this.listLength before reading parameters/throws
611
612
	// recovery
613
	if (this.currentElement != null){
614
		boolean isType;
615
		if ((isType = this.currentElement instanceof RecoveredType)
616
			//|| md.modifiers != 0
617
			|| (Util.getLineNumber(md.returnType.sourceStart, this.scanner.lineEnds, 0, this.scanner.linePtr)
618
					== Util.getLineNumber(md.sourceStart, this.scanner.lineEnds, 0, this.scanner.linePtr))){
619
			if(isType) {
620
				((RecoveredType) this.currentElement).pendingTypeParameters = null;
621
			}
622
			this.lastCheckPoint = md.bodyStart;
623
			this.currentElement = this.currentElement.add(md, 0);
624
			this.lastIgnoredToken = -1;
625
		} else {
626
			this.lastCheckPoint = md.sourceStart;
627
			this.restartRecovery = true;
628
		}
629
	}
630
}
502
/*
631
/*
503
 *
632
 *
504
 * INTERNAL USE-ONLY
633
 * INTERNAL USE-ONLY
Lines 559-568 Link Here
559
		endOfEllipsis = this.intStack[this.intPtr--];
688
		endOfEllipsis = this.intStack[this.intPtr--];
560
	}
689
	}
561
	int firstDimensions = this.intStack[this.intPtr--];
690
	int firstDimensions = this.intStack[this.intPtr--];
562
	final int typeDimensions = firstDimensions + extendedDimensions;
691
	TypeReference type = getUnannotatedTypeReference(extendedDimensions);
563
	TypeReference type = getTypeReference(typeDimensions);
692
	Annotation [] varArgsAnnotations = null;
693
	int length;
694
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
695
		System.arraycopy(
696
			this.typeAnnotationStack,
697
			(this.typeAnnotationPtr -= length) + 1,
698
			varArgsAnnotations = new Annotation[length],
699
			0,
700
			length);
701
	} 
702
	final int typeDimensions = firstDimensions + extendedDimensions + (isVarArgs ? 1 : 0);
703
	if (typeDimensions != extendedDimensions) {
704
		// jsr308 type annotations management
705
		Annotation [][] annotationsOnFirstDimensions = firstDimensions == 0 ? null : getAnnotationsOnDimensions(firstDimensions);
706
		Annotation [][] annotationsOnExtendedDimensions = extendedDimensions == 0 ? null : type.getAnnotationsOnDimensions();
707
		Annotation [][] annotationsOnAllDimensions = null;
708
		if (annotationsOnFirstDimensions != null || annotationsOnExtendedDimensions != null || varArgsAnnotations != null) {
709
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions, annotationsOnFirstDimensions, extendedDimensions, annotationsOnExtendedDimensions); 
710
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(firstDimensions + extendedDimensions, annotationsOnAllDimensions, isVarArgs ? 1 : 0, isVarArgs ? new Annotation[][]{varArgsAnnotations} : null);
711
		}
712
		type = copyDims(type, typeDimensions, annotationsOnAllDimensions);
713
		type.sourceEnd = type.isParameterizedTypeReference() ? this.endStatementPosition : this.endPosition;
714
	}
564
	if (isVarArgs) {
715
	if (isVarArgs) {
565
		type = copyDims(type, typeDimensions + 1);
566
		if (extendedDimensions == 0) {
716
		if (extendedDimensions == 0) {
567
			type.sourceEnd = endOfEllipsis;
717
			type.sourceEnd = endOfEllipsis;
568
		}
718
		}
Lines 576-582 Link Here
576
			type,
726
			type,
577
			this.intStack[this.intPtr + 1]);// modifiers
727
			this.intStack[this.intPtr + 1]);// modifiers
578
	// consume annotations
728
	// consume annotations
579
	int length;
580
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
729
	if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
581
		System.arraycopy(
730
		System.arraycopy(
582
			this.expressionStack,
731
			this.expressionStack,
Lines 830-842 Link Here
830
	// MethodHeaderExtendedDims ::= Dimsopt
979
	// MethodHeaderExtendedDims ::= Dimsopt
831
	// now we update the returnType of the method
980
	// now we update the returnType of the method
832
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
981
	MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
982
	// jsr308 -- consume receiver annotations
983
	md.receiverAnnotations = null;
984
	int length;
985
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
986
		System.arraycopy(
987
			this.typeAnnotationStack,
988
			(this.typeAnnotationPtr -= length) + 1,
989
			md.receiverAnnotations = new Annotation[length],
990
			0,
991
			length);
992
	}
833
	int extendedDims = this.intStack[this.intPtr--];
993
	int extendedDims = this.intStack[this.intPtr--];
834
	this.extendsDim = extendedDims;
994
	this.extendsDim = extendedDims;
835
	if (extendedDims != 0) {
995
	if (extendedDims != 0) {
836
		TypeReference returnType = md.returnType;
996
		TypeReference returnType = md.returnType;
837
		md.sourceEnd = this.endPosition;
997
		md.sourceEnd = this.endPosition;
838
		int dims = returnType.dimensions() + extendedDims;
998
		int dims = returnType.dimensions() + extendedDims;
839
		md.returnType = copyDims(returnType, dims);
999
		Annotation [][] annotationsOnDimensions = returnType.getAnnotationsOnDimensions();
1000
		Annotation [][] annotationsOnExtendedDimensions = getAnnotationsOnDimensions(extendedDims);
1001
		Annotation [][] annotationsOnAllDimensions = null;
1002
		if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
1003
			annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(returnType.dimensions(), annotationsOnDimensions, extendedDims, annotationsOnExtendedDimensions);
1004
		}	
1005
		md.returnType = copyDims(returnType, dims, annotationsOnAllDimensions);
1006
840
		if (this.currentToken == TokenNameLBRACE) {
1007
		if (this.currentToken == TokenNameLBRACE) {
841
			md.bodyStart = this.endPosition + 1;
1008
			md.bodyStart = this.endPosition + 1;
842
		}
1009
		}
Lines 1357-1363 Link Here
1357
	 * This variable is a type reference and dim will be its dimensions.
1524
	 * This variable is a type reference and dim will be its dimensions.
1358
	 * We don't have any side effect on the stacks' pointers.
1525
	 * We don't have any side effect on the stacks' pointers.
1359
	 */
1526
	 */
1360
1527
	Annotation [][] annotationsOnDimensions = dim == 0 ? null : getAnnotationsOnDimensions(dim);
1361
	int length;
1528
	int length;
1362
	TypeReference ref;
1529
	TypeReference ref;
1363
	if ((length = this.identifierLengthStack[localIdentifierLengthPtr]) == 1) {
1530
	if ((length = this.identifierLengthStack[localIdentifierLengthPtr]) == 1) {
Lines 1372-1383 Link Here
1372
				new ArrayTypeReference(
1539
				new ArrayTypeReference(
1373
					this.identifierStack[localIdentifierPtr],
1540
					this.identifierStack[localIdentifierPtr],
1374
					dim,
1541
					dim,
1542
					annotationsOnDimensions,
1375
					this.identifierPositionStack[localIdentifierPtr--]);
1543
					this.identifierPositionStack[localIdentifierPtr--]);
1376
			ref.sourceEnd = this.endPosition;
1544
			ref.sourceEnd = this.endPosition;
1377
		}
1545
		}
1378
	} else {
1546
	} else {
1379
		if (length < 0) { //flag for precompiled type reference on base types
1547
		if (length < 0) { //flag for precompiled type reference on base types
1380
			ref = TypeReference.baseTypeReference(-length, dim);
1548
			ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
1381
			ref.sourceStart = this.intStack[this.localIntPtr--];
1549
			ref.sourceStart = this.intStack[this.localIntPtr--];
1382
			if (dim == 0) {
1550
			if (dim == 0) {
1383
				ref.sourceEnd = this.intStack[this.localIntPtr--];
1551
				ref.sourceEnd = this.intStack[this.localIntPtr--];
Lines 1399-1405 Link Here
1399
			if (dim == 0)
1567
			if (dim == 0)
1400
				ref = new QualifiedTypeReference(tokens, positions);
1568
				ref = new QualifiedTypeReference(tokens, positions);
1401
			else
1569
			else
1402
				ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
1570
				ref = new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions);
1403
		}
1571
		}
1404
	}
1572
	}
1405
	return ref;
1573
	return ref;
(-)model/org/eclipse/jdt/internal/compiler/SourceElementParser.java (-19 / +20 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 721-733 Link Here
721
		return null;
721
		return null;
722
	}
722
	}
723
}
723
}
724
public TypeReference getTypeReference(int dim) {
724
public TypeReference getUnannotatedTypeReference(int dim) {
725
	/* build a Reference on a variable that may be qualified or not
725
	/* build a Reference on a variable that may be qualified or not
726
	 * This variable is a type reference and dim will be its dimensions
726
	 * This variable is a type reference and dim will be its dimensions
727
	 */
727
	 */
728
	Annotation [][] annotationsOnDimensions = null;
729
	TypeReference ref;
728
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
730
	int length = this.identifierLengthStack[this.identifierLengthPtr--];
729
	if (length < 0) { //flag for precompiled type reference on base types
731
	if (length < 0) { //flag for precompiled type reference on base types
730
		TypeReference ref = TypeReference.baseTypeReference(-length, dim);
732
		annotationsOnDimensions = getAnnotationsOnDimensions(dim);
733
		ref = TypeReference.baseTypeReference(-length, dim, annotationsOnDimensions);
731
		ref.sourceStart = this.intStack[this.intPtr--];
734
		ref.sourceStart = this.intStack[this.intPtr--];
732
		if (dim == 0) {
735
		if (dim == 0) {
733
			ref.sourceEnd = this.intStack[this.intPtr--];
736
			ref.sourceEnd = this.intStack[this.intPtr--];
Lines 738-749 Link Here
738
		if (this.reportReferenceInfo){
741
		if (this.reportReferenceInfo){
739
				this.requestor.acceptTypeReference(ref.getParameterizedTypeName(), ref.sourceStart, ref.sourceEnd);
742
				this.requestor.acceptTypeReference(ref.getParameterizedTypeName(), ref.sourceStart, ref.sourceEnd);
740
		}
743
		}
741
		return ref;
742
	} else {
744
	} else {
743
		int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
745
		int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
744
		if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
746
		if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
745
			// generic type
747
			// generic type
746
			TypeReference ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
748
			ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
747
			if (this.reportReferenceInfo) {
749
			if (this.reportReferenceInfo) {
748
				if (length == 1 && numberOfIdentifiers == 1) {
750
				if (length == 1 && numberOfIdentifiers == 1) {
749
					ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) ref;
751
					ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) ref;
Lines 753-782 Link Here
753
					this.requestor.acceptTypeReference(parameterizedQualifiedTypeReference.tokens, parameterizedQualifiedTypeReference.sourceStart, parameterizedQualifiedTypeReference.sourceEnd);
755
					this.requestor.acceptTypeReference(parameterizedQualifiedTypeReference.tokens, parameterizedQualifiedTypeReference.sourceStart, parameterizedQualifiedTypeReference.sourceEnd);
754
				}
756
				}
755
			}
757
			}
756
			return ref;
757
		} else if (length == 1) {
758
		} else if (length == 1) {
758
			// single variable reference
759
			// single variable reference
759
			this.genericsLengthPtr--; // pop the 0
760
			this.genericsLengthPtr--; // pop the 0
760
			if (dim == 0) {
761
			if (dim == 0) {
761
				SingleTypeReference ref =
762
				ref =
762
					new SingleTypeReference(
763
					new SingleTypeReference(
763
						this.identifierStack[this.identifierPtr],
764
						this.identifierStack[this.identifierPtr],
764
						this.identifierPositionStack[this.identifierPtr--]);
765
						this.identifierPositionStack[this.identifierPtr--]);
765
				if (this.reportReferenceInfo) {
766
				if (this.reportReferenceInfo) {
766
					this.requestor.acceptTypeReference(ref.token, ref.sourceStart);
767
					this.requestor.acceptTypeReference(((SingleTypeReference)ref).token, ref.sourceStart);
767
				}
768
				}
768
				return ref;
769
			} else {
769
			} else {
770
				ArrayTypeReference ref =
770
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
771
				ref =
771
					new ArrayTypeReference(
772
					new ArrayTypeReference(
772
						this.identifierStack[this.identifierPtr],
773
						this.identifierStack[this.identifierPtr],
773
						dim,
774
						dim,
775
						annotationsOnDimensions,
774
						this.identifierPositionStack[this.identifierPtr--]);
776
						this.identifierPositionStack[this.identifierPtr--]);
775
				ref.sourceEnd = this.endPosition;
777
				ref.sourceEnd = this.endPosition;
776
				if (this.reportReferenceInfo) {
778
				if (this.reportReferenceInfo) {
777
					this.requestor.acceptTypeReference(ref.token, ref.sourceStart);
779
					this.requestor.acceptTypeReference(((ArrayTypeReference)ref).token, ref.sourceStart);
778
				}
780
				}
779
				return ref;
780
			}
781
			}
781
		} else {//Qualified variable reference
782
		} else {//Qualified variable reference
782
			this.genericsLengthPtr--;
783
			this.genericsLengthPtr--;
Lines 791-812 Link Here
791
				0,
792
				0,
792
				length);
793
				length);
793
			if (dim == 0) {
794
			if (dim == 0) {
794
				QualifiedTypeReference ref = new QualifiedTypeReference(tokens, positions);
795
				ref = new QualifiedTypeReference(tokens, positions);
795
				if (this.reportReferenceInfo) {
796
				if (this.reportReferenceInfo) {
796
					this.requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd);
797
					this.requestor.acceptTypeReference(((QualifiedTypeReference)ref).tokens, ref.sourceStart, ref.sourceEnd);
797
				}
798
				}
798
				return ref;
799
			} else {
799
			} else {
800
				ArrayQualifiedTypeReference ref =
800
				annotationsOnDimensions = getAnnotationsOnDimensions(dim);
801
					new ArrayQualifiedTypeReference(tokens, dim, positions);
801
				ref =
802
					new ArrayQualifiedTypeReference(tokens, dim, annotationsOnDimensions, positions);
802
				ref.sourceEnd = this.endPosition;
803
				ref.sourceEnd = this.endPosition;
803
				if (this.reportReferenceInfo) {
804
				if (this.reportReferenceInfo) {
804
					this.requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd);
805
					this.requestor.acceptTypeReference(((ArrayQualifiedTypeReference)ref).tokens, ref.sourceStart, ref.sourceEnd);
805
				}
806
				}
806
				return ref;
807
			}
807
			}
808
		}
808
		}
809
	}
809
	}
810
	return ref;
810
}
811
}
811
public NameReference getUnspecifiedReference() {
812
public NameReference getUnspecifiedReference() {
812
	/* build a (unspecified) NameReference which may be qualified*/
813
	/* build a (unspecified) NameReference which may be qualified*/
(-)model/org/eclipse/jdt/internal/core/util/ClassFileReader.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 261-266 Link Here
261
							this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
261
							this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
262
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
262
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
263
							this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
263
							this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
264
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
265
							this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
266
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
267
							this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
264
						} else {
268
						} else {
265
							this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
269
							this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
266
						}
270
						}
(-)model/org/eclipse/jdt/internal/core/util/Disassembler.java (-8 / +475 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 259-264 Link Here
259
		buffer.append(Messages.disassembler_annotationentryend);
259
		buffer.append(Messages.disassembler_annotationentryend);
260
	}
260
	}
261
261
262
	private void disassemble(IExtendedAnnotation extendedAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
263
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
264
		final int typeIndex = extendedAnnotation.getTypeIndex();
265
		final char[] typeName = CharOperation.replaceOnCopy(extendedAnnotation.getTypeName(), '/', '.');
266
		buffer.append(
267
			Messages.bind(Messages.disassembler_extendedannotationentrystart, new String[] {
268
				Integer.toString(typeIndex),
269
				new String(returnClassName(Signature.toCharArray(typeName), '.', mode))
270
			}));
271
		final IAnnotationComponent[] components = extendedAnnotation.getComponents();
272
		for (int i = 0, max = components.length; i < max; i++) {
273
			disassemble(components[i], buffer, lineSeparator, tabNumber + 1, mode);
274
		}
275
		writeNewLine(buffer, lineSeparator, tabNumber + 2);
276
		int targetType = extendedAnnotation.getTargetType();
277
		buffer.append(
278
				Messages.bind(Messages.disassembler_extendedannotation_targetType, new String[] {
279
					Integer.toHexString(targetType),
280
					getTargetType(targetType),
281
				}));
282
		switch(targetType) {
283
			case IExtendedAnnotationConstants.METHOD_RECEIVER :
284
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE :
285
			case IExtendedAnnotationConstants.FIELD :
286
				break;
287
			default:
288
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
289
		}
290
		
291
		switch(targetType) {
292
			case IExtendedAnnotationConstants.WILDCARD_BOUND :
293
				int wildcardLocationType = extendedAnnotation.getWildcardLocationType();
294
				buffer.append(
295
						Messages.bind(Messages.disassembler_extendedannotation_wildcardlocationtype, new String[] {
296
							Integer.toString(wildcardLocationType),
297
							getTargetType(wildcardLocationType),
298
						}));
299
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
300
				disassembleTargetTypeContents(true, wildcardLocationType, extendedAnnotation, buffer, lineSeparator, tabNumber + 3, mode);
301
				break;
302
			case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
303
				wildcardLocationType = extendedAnnotation.getWildcardLocationType();
304
				buffer.append(
305
						Messages.bind(Messages.disassembler_extendedannotation_wildcardlocationtype, new String[] {
306
							Integer.toString(wildcardLocationType),
307
							getTargetType(wildcardLocationType),
308
						}));
309
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
310
				disassembleTargetTypeContents(true, wildcardLocationType, extendedAnnotation, buffer, lineSeparator, tabNumber + 3, mode);
311
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
312
				buffer.append(
313
						Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
314
							toString(extendedAnnotation.getLocations()),
315
						}));
316
				break;
317
			default:
318
				disassembleTargetTypeContents(false, targetType, extendedAnnotation, buffer, lineSeparator, tabNumber, mode);
319
		}
320
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
321
		buffer.append(Messages.disassembler_extendedannotationentryend);
322
	}
323
324
	private void disassembleTargetTypeContents(boolean insideWildcard, int targetType, IExtendedAnnotation extendedAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
325
		switch(targetType) {
326
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS :
327
				buffer.append(
328
					Messages.bind(Messages.disassembler_extendedannotation_classextendsimplements, new String[] {
329
						Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
330
					}));
331
				break;
332
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
333
				buffer.append(
334
						Messages.bind(Messages.disassembler_extendedannotation_classextendsimplements, new String[] {
335
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
336
						}));
337
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
338
				if (insideWildcard) {
339
					buffer.append(
340
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
341
								toString(extendedAnnotation.getWildcardLocations()),
342
							}));
343
				} else {
344
					buffer.append(
345
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
346
								toString(extendedAnnotation.getLocations()),
347
							}));
348
				}
349
				break;
350
			case IExtendedAnnotationConstants.TYPE_CAST :
351
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF :
352
			case IExtendedAnnotationConstants.OBJECT_CREATION :
353
			case IExtendedAnnotationConstants.CLASS_LITERAL :
354
				buffer.append(
355
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
356
							Integer.toString(extendedAnnotation.getOffset()),
357
						}));
358
				break;
359
			case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY :
360
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
361
			case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
362
			case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
363
				buffer.append(
364
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
365
							Integer.toString(extendedAnnotation.getOffset()),
366
						}));
367
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
368
				if (insideWildcard) {
369
					buffer.append(
370
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
371
								toString(extendedAnnotation.getWildcardLocations()),
372
							}));
373
				} else {
374
					buffer.append(
375
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
376
								toString(extendedAnnotation.getLocations()),
377
							}));
378
				}
379
				break;
380
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER :
381
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER :
382
				buffer.append(
383
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter, new String[] {
384
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
385
						}));
386
				break;
387
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY :
388
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY :
389
				buffer.append(
390
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter, new String[] {
391
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
392
						}));
393
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
394
				if (insideWildcard) {
395
					buffer.append(
396
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
397
								toString(extendedAnnotation.getWildcardLocations()),
398
							}));
399
				} else {
400
					buffer.append(
401
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
402
								toString(extendedAnnotation.getLocations()),
403
							}));
404
				}
405
				break;
406
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND :
407
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND :
408
				buffer.append(
409
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter_with_bound, new String[] {
410
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
411
							Integer.toString(extendedAnnotation.getTypeParameterBoundIndex()),
412
						}));
413
				break;
414
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
415
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
416
				buffer.append(
417
						Messages.bind(Messages.disassembler_extendedannotation_type_parameter_with_bound, new String[] {
418
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
419
							Integer.toString(extendedAnnotation.getTypeParameterBoundIndex()),
420
						}));
421
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
422
				if (insideWildcard) {
423
					buffer.append(
424
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
425
								toString(extendedAnnotation.getWildcardLocations()),
426
							}));
427
				} else {
428
					buffer.append(
429
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
430
								toString(extendedAnnotation.getLocations()),
431
							}));
432
				}
433
				break;
434
			case IExtendedAnnotationConstants.LOCAL_VARIABLE :
435
				buffer.append(Messages.disassembler_localvariabletargetheader);
436
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
437
				int localVariableTableSize = extendedAnnotation.getLocalVariableRefenceInfoLength();
438
				ILocalVariableReferenceInfo[] localVariableTable = extendedAnnotation.getLocalVariableTable();
439
				for (int i = 0; i < localVariableTableSize; i++) {
440
					if (i != 0) {
441
						writeNewLine(buffer, lineSeparator, tabNumber + 3);
442
					}
443
					ILocalVariableReferenceInfo info = localVariableTable[i];
444
					int index= info.getIndex();
445
					int startPC = info.getStartPC();
446
					int length  = info.getLength();
447
					buffer.append(Messages.bind(Messages.classfileformat_localvariablereferenceinfoentry,
448
						new String[] {
449
							Integer.toString(startPC),
450
							Integer.toString(startPC + length),
451
							Integer.toString(index),
452
						}));
453
				}
454
				break;
455
			case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
456
				buffer.append(Messages.disassembler_localvariabletargetheader);
457
				writeNewLine(buffer, lineSeparator, tabNumber + 3);
458
				localVariableTableSize = extendedAnnotation.getLocalVariableRefenceInfoLength();
459
				localVariableTable = extendedAnnotation.getLocalVariableTable();
460
				for (int i = 0; i < localVariableTableSize; i++) {
461
					if (i != 0) {
462
						writeNewLine(buffer, lineSeparator, tabNumber + 3);
463
					}
464
					ILocalVariableReferenceInfo info = localVariableTable[i];
465
					int index= info.getIndex();
466
					int startPC = info.getStartPC();
467
					int length  = info.getLength();
468
					buffer.append(Messages.bind(Messages.classfileformat_localvariablereferenceinfoentry,
469
						new String[] {
470
							Integer.toString(startPC),
471
							Integer.toString(startPC + length),
472
							Integer.toString(index),
473
						}));
474
				}
475
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
476
				if (insideWildcard) {
477
					buffer.append(
478
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
479
								toString(extendedAnnotation.getWildcardLocations()),
480
							}));
481
				} else {
482
					buffer.append(
483
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
484
								toString(extendedAnnotation.getLocations()),
485
							}));
486
				}
487
				break;
488
			case IExtendedAnnotationConstants.METHOD_PARAMETER :
489
				buffer.append(
490
						Messages.bind(Messages.disassembler_extendedannotation_method_parameter, new String[] {
491
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
492
						}));
493
				break;
494
			case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
495
				buffer.append(
496
						Messages.bind(Messages.disassembler_extendedannotation_method_parameter, new String[] {
497
							Integer.toString(extendedAnnotation.getTypeParameterIndex()),
498
						}));
499
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
500
				if (insideWildcard) {
501
					buffer.append(
502
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
503
								toString(extendedAnnotation.getWildcardLocations()),
504
							}));
505
				} else {
506
					buffer.append(
507
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
508
								toString(extendedAnnotation.getLocations()),
509
							}));
510
				}
511
				break;
512
			case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
513
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY :
514
			case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY :
515
				if (insideWildcard) {
516
					buffer.append(
517
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
518
								toString(extendedAnnotation.getWildcardLocations()),
519
							}));
520
				} else {
521
					buffer.append(
522
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
523
								toString(extendedAnnotation.getLocations()),
524
							}));
525
				}
526
				break;
527
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
528
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL :
529
				buffer.append(
530
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
531
							Integer.toString(extendedAnnotation.getOffset()),
532
						}));
533
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
534
				buffer.append(
535
						Messages.bind(Messages.disassembler_extendedannotation_type_argument, new String[] {
536
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
537
						}));
538
				break;
539
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
540
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
541
				buffer.append(
542
						Messages.bind(Messages.disassembler_extendedannotation_offset, new String[] {
543
							Integer.toString(extendedAnnotation.getOffset()),
544
						}));
545
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
546
				buffer.append(
547
						Messages.bind(Messages.disassembler_extendedannotation_type_argument, new String[] {
548
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
549
						}));
550
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
551
				if (insideWildcard) {
552
					buffer.append(
553
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
554
								toString(extendedAnnotation.getWildcardLocations()),
555
							}));
556
				} else {
557
					buffer.append(
558
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
559
								toString(extendedAnnotation.getLocations()),
560
							}));
561
				}
562
				break;
563
			case IExtendedAnnotationConstants.THROWS :
564
				buffer.append(
565
						Messages.bind(Messages.disassembler_extendedannotation_throws, new String[] {
566
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
567
						}));
568
				break;
569
			case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY :
570
				buffer.append(
571
						Messages.bind(Messages.disassembler_extendedannotation_throws, new String[] {
572
							Integer.toString(extendedAnnotation.getAnnotationTypeIndex()),
573
						}));
574
				writeNewLine(buffer, lineSeparator, tabNumber + 2);
575
				if (insideWildcard) {
576
					buffer.append(
577
							Messages.bind(Messages.disassembler_extendedannotation_wildcardlocations, new String[] {
578
								toString(extendedAnnotation.getWildcardLocations()),
579
							}));
580
				} else {
581
					buffer.append(
582
							Messages.bind(Messages.disassembler_extendedannotation_locations, new String[] {
583
								toString(extendedAnnotation.getLocations()),
584
							}));
585
				}
586
				break;
587
		}
588
	}
589
	private String getTargetType(int targetType) {
590
		switch(targetType) {
591
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS :
592
				return "CLASS_EXTENDS_IMPLEMENTS"; //$NON-NLS-1$
593
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
594
				return "CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY"; //$NON-NLS-1$
595
			case IExtendedAnnotationConstants.TYPE_CAST :
596
				return "TYPE_CAST"; //$NON-NLS-1$
597
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF :
598
				return "TYPE_INSTANCEOF"; //$NON-NLS-1$
599
			case IExtendedAnnotationConstants.OBJECT_CREATION :
600
				return "OBJECT_CREATION"; //$NON-NLS-1$
601
			case IExtendedAnnotationConstants.CLASS_LITERAL :
602
				return "CLASS_LITERAL"; //$NON-NLS-1$
603
			case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY :
604
				return "TYPE_CAST_GENERIC_OR_ARRAY"; //$NON-NLS-1$
605
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
606
				return "TYPE_INSTANCEOF_GENERIC_OR_ARRAY"; //$NON-NLS-1$
607
			case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
608
				return "OBJECT_CREATION_GENERIC_OR_ARRAY"; //$NON-NLS-1$
609
			case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
610
				return "CLASS_LITERAL_GENERIC_OR_ARRAY"; //$NON-NLS-1$
611
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER :
612
				return "CLASS_TYPE_PARAMETER"; //$NON-NLS-1$
613
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER :
614
				return "METHOD_TYPE_PARAMETER"; //$NON-NLS-1$
615
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY :
616
				return "CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
617
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY :
618
				return "METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
619
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND :
620
				return "METHOD_TYPE_PARAMETER_BOUND"; //$NON-NLS-1$
621
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND :
622
				return "CLASS_TYPE_PARAMETER_BOUND"; //$NON-NLS-1$
623
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
624
				return "METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$
625
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
626
				return "CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$
627
			case IExtendedAnnotationConstants.LOCAL_VARIABLE :
628
				return "LOCAL_VARIABLE"; //$NON-NLS-1$
629
			case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
630
				return "LOCAL_VARIABLE_GENERIC_OR_ARRAY"; //$NON-NLS-1$
631
			case IExtendedAnnotationConstants.METHOD_PARAMETER :
632
				return "METHOD_PARAMETER"; //$NON-NLS-1$
633
			case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
634
				return "METHOD_PARAMETER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
635
			case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
636
				return "METHOD_RECEIVER_GENERIC_OR_ARRAY"; //$NON-NLS-1$
637
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY :
638
				return "METHOD_RETURN_TYPE_GENERIC_OR_ARRAY"; //$NON-NLS-1$
639
			case IExtendedAnnotationConstants.METHOD_RECEIVER :
640
				return "METHOD_RECEIVER"; //$NON-NLS-1$
641
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE :
642
				return "METHOD_RETURN_TYPE"; //$NON-NLS-1$
643
			case IExtendedAnnotationConstants.FIELD :
644
				return "FIELD"; //$NON-NLS-1$
645
			case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY :
646
				return "FIELD_GENERIC_OR_ARRAY"; //$NON-NLS-1$
647
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
648
				return "TYPE_ARGUMENT_CONSTRUCTOR_CALL"; //$NON-NLS-1$
649
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL :
650
				return "TYPE_ARGUMENT_METHOD_CALL"; //$NON-NLS-1$
651
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
652
				return "TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY"; //$NON-NLS-1$
653
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
654
				return "TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY"; //$NON-NLS-1$
655
			case IExtendedAnnotationConstants.THROWS :
656
				return "THROWS"; //$NON-NLS-1$
657
			case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY :
658
				return "THROWS_GENERIC_OR_ARRAY"; //$NON-NLS-1$
659
			case IExtendedAnnotationConstants.WILDCARD_BOUND :
660
				return "WILDCARD_BOUND"; //$NON-NLS-1$
661
			case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
662
				return "WILDCARD_BOUND_GENERIC_OR_ARRAY"; //$NON-NLS-1$
663
			default:
664
				return "UNKNOWN"; //$NON-NLS-1$
665
		}
666
	}
667
262
	private void disassemble(IAnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
668
	private void disassemble(IAnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
263
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
669
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
264
		buffer.append(
670
		buffer.append(
Lines 465-470 Link Here
465
		final ISignatureAttribute signatureAttribute = (ISignatureAttribute) Util.getAttribute(methodInfo, IAttributeNamesConstants.SIGNATURE);
871
		final ISignatureAttribute signatureAttribute = (ISignatureAttribute) Util.getAttribute(methodInfo, IAttributeNamesConstants.SIGNATURE);
466
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
872
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
467
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
873
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
874
		final IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
875
		final IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
468
		final IClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS);
876
		final IClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS);
469
		final IClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS);
877
		final IClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS);
470
		final IClassFileAttribute annotationDefaultAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.ANNOTATION_DEFAULT);
878
		final IClassFileAttribute annotationDefaultAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.ANNOTATION_DEFAULT);
Lines 671-676 Link Here
671
							&& attribute != annotationDefaultAttribute
1079
							&& attribute != annotationDefaultAttribute
672
							&& attribute != runtimeInvisibleAnnotationsAttribute
1080
							&& attribute != runtimeInvisibleAnnotationsAttribute
673
							&& attribute != runtimeVisibleAnnotationsAttribute
1081
							&& attribute != runtimeVisibleAnnotationsAttribute
1082
							&& attribute != runtimeInvisibleTypeAnnotationsAttribute
1083
							&& attribute != runtimeVisibleTypeAnnotationsAttribute
674
							&& attribute != runtimeInvisibleParameterAnnotationsAttribute
1084
							&& attribute != runtimeInvisibleParameterAnnotationsAttribute
675
							&& attribute != runtimeVisibleParameterAnnotationsAttribute
1085
							&& attribute != runtimeVisibleParameterAnnotationsAttribute
676
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
1086
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
Lines 695-700 Link Here
695
			if (runtimeInvisibleParameterAnnotationsAttribute != null) {
1105
			if (runtimeInvisibleParameterAnnotationsAttribute != null) {
696
				disassemble((IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1106
				disassemble((IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
697
			}
1107
			}
1108
			if (runtimeVisibleTypeAnnotationsAttribute != null) {
1109
				disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1110
			}
1111
			if (runtimeInvisibleTypeAnnotationsAttribute != null) {
1112
				disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1113
			}
698
		}
1114
		}
699
	}
1115
	}
700
1116
Lines 786-791 Link Here
786
		IInnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute();
1202
		IInnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute();
787
		IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
1203
		IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
788
		IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
1204
		IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
1205
		IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
1206
		IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
789
1207
790
		if (checkMode(mode, DETAILED)) {
1208
		if (checkMode(mode, DETAILED)) {
791
			// disassemble compact version of annotations
1209
			// disassemble compact version of annotations
Lines 919-935 Link Here
919
				if (runtimeInvisibleAnnotationsAttribute != null) {
1337
				if (runtimeInvisibleAnnotationsAttribute != null) {
920
					disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
1338
					disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
921
				}
1339
				}
1340
				if (runtimeVisibleTypeAnnotationsAttribute != null) {
1341
					disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, 0, mode);
1342
				}
1343
				if (runtimeInvisibleTypeAnnotationsAttribute != null) {
1344
					disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, 0, mode);
1345
				}
922
				if (length != 0) {
1346
				if (length != 0) {
923
					for (int i = 0; i < length; i++) {
1347
					for (int i = 0; i < length; i++) {
924
						IClassFileAttribute attribute = attributes[i];
1348
						IClassFileAttribute attribute = attributes[i];
925
						if (attribute != innerClassesAttribute
1349
						if (attribute != innerClassesAttribute
926
							&& attribute != sourceAttribute
1350
								&& attribute != sourceAttribute
927
							&& attribute != signatureAttribute
1351
								&& attribute != signatureAttribute
928
							&& attribute != enclosingMethodAttribute
1352
								&& attribute != enclosingMethodAttribute
929
							&& attribute != runtimeInvisibleAnnotationsAttribute
1353
								&& attribute != runtimeInvisibleAnnotationsAttribute
930
							&& attribute != runtimeVisibleAnnotationsAttribute
1354
								&& attribute != runtimeVisibleAnnotationsAttribute
931
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
1355
								&& attribute != runtimeInvisibleTypeAnnotationsAttribute
932
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
1356
								&& attribute != runtimeVisibleTypeAnnotationsAttribute
1357
								&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
1358
								&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
933
							disassemble(attribute, buffer, lineSeparator, 0, mode);
1359
							disassemble(attribute, buffer, lineSeparator, 0, mode);
934
						}
1360
						}
935
					}
1361
					}
Lines 1491-1496 Link Here
1491
		}
1917
		}
1492
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
1918
		final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
1493
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
1919
		final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
1920
		final IClassFileAttribute runtimeVisibleTypeAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
1921
		final IClassFileAttribute runtimeInvisibleTypeAnnotationsAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
1494
		if (checkMode(mode, DETAILED)) {
1922
		if (checkMode(mode, DETAILED)) {
1495
			// disassemble compact version of annotations
1923
			// disassemble compact version of annotations
1496
			if (runtimeInvisibleAnnotationsAttribute != null) {
1924
			if (runtimeInvisibleAnnotationsAttribute != null) {
Lines 1577-1582 Link Here
1577
						&& attribute != signatureAttribute
2005
						&& attribute != signatureAttribute
1578
						&& attribute != runtimeInvisibleAnnotationsAttribute
2006
						&& attribute != runtimeInvisibleAnnotationsAttribute
1579
						&& attribute != runtimeVisibleAnnotationsAttribute
2007
						&& attribute != runtimeVisibleAnnotationsAttribute
2008
						&& attribute != runtimeInvisibleTypeAnnotationsAttribute
2009
						&& attribute != runtimeVisibleTypeAnnotationsAttribute
1580
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
2010
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
1581
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
2011
						&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
1582
						disassemble(attribute, buffer, lineSeparator, tabNumber, mode);
2012
						disassemble(attribute, buffer, lineSeparator, tabNumber, mode);
Lines 1589-1594 Link Here
1589
			if (runtimeInvisibleAnnotationsAttribute != null) {
2019
			if (runtimeInvisibleAnnotationsAttribute != null) {
1590
				disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
2020
				disassemble((IRuntimeInvisibleAnnotationsAttribute) runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
1591
			}
2021
			}
2022
			if (runtimeVisibleTypeAnnotationsAttribute != null) {
2023
				disassemble((IRuntimeVisibleTypeAnnotationsAttribute) runtimeVisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
2024
			}
2025
			if (runtimeInvisibleTypeAnnotationsAttribute != null) {
2026
				disassemble((IRuntimeInvisibleTypeAnnotationsAttribute) runtimeInvisibleTypeAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
2027
			}
1592
		}
2028
		}
1593
	}
2029
	}
1594
2030
Lines 1692-1697 Link Here
1692
		}
2128
		}
1693
	}
2129
	}
1694
2130
2131
	private void disassemble(IRuntimeInvisibleTypeAnnotationsAttribute runtimeInvisibleTypeAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
2132
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
2133
		buffer.append(Messages.disassembler_runtimeinvisibletypeannotationsattributeheader);
2134
		IExtendedAnnotation[] extendedAnnotations = runtimeInvisibleTypeAnnotationsAttribute.getExtendedAnnotations();
2135
		for (int i = 0, max = extendedAnnotations.length; i < max; i++) {
2136
			disassemble(extendedAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode);
2137
		}
2138
	}
2139
2140
	private void disassemble(IRuntimeVisibleTypeAnnotationsAttribute runtimeVisibleTypeAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
2141
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
2142
		buffer.append(Messages.disassembler_runtimevisibletypeannotationsattributeheader);
2143
		IExtendedAnnotation[] extendedAnnotations = runtimeVisibleTypeAnnotationsAttribute.getExtendedAnnotations();
2144
		for (int i = 0, max = extendedAnnotations.length; i < max; i++) {
2145
			disassemble(extendedAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode);
2146
		}
2147
	}
2148
1695
	private void disassemble(IRuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
2149
	private void disassemble(IRuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
1696
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
2150
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
1697
		buffer.append(Messages.disassembler_runtimevisibleparameterannotationsattributeheader);
2151
		buffer.append(Messages.disassembler_runtimevisibleparameterannotationsattributeheader);
Lines 2141-2144 Link Here
2141
		buffer.append(lineSeparator);
2595
		buffer.append(lineSeparator);
2142
		dumpTab(tabNumber, buffer);
2596
		dumpTab(tabNumber, buffer);
2143
	}
2597
	}
2598
	
2599
	private String toString(int[] tab) {
2600
		StringBuffer buffer = new StringBuffer();
2601
		buffer.append('{');
2602
		for (int i = 0, max = tab.length; i < max; i++) {
2603
			if (i > 0) {
2604
				buffer.append(',');
2605
			}
2606
			buffer.append(tab[i]);
2607
		}
2608
		buffer.append('}');
2609
		return String.valueOf(buffer);
2610
	}
2144
}
2611
}
(-)model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java (+358 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.ClassFormatException;
14
import org.eclipse.jdt.core.util.IAnnotationComponent;
15
import org.eclipse.jdt.core.util.IConstantPool;
16
import org.eclipse.jdt.core.util.IConstantPoolConstant;
17
import org.eclipse.jdt.core.util.IConstantPoolEntry;
18
import org.eclipse.jdt.core.util.IExtendedAnnotation;
19
import org.eclipse.jdt.core.util.IExtendedAnnotationConstants;
20
import org.eclipse.jdt.core.util.ILocalVariableReferenceInfo;
21
22
/**
23
 * Default implementation of IAnnotation
24
 */
25
public class ExtendedAnnotation extends ClassFileStruct implements IExtendedAnnotation {
26
27
	private static final IAnnotationComponent[] NO_ENTRIES = new IAnnotationComponent[0];
28
29
	private int typeIndex;
30
	private char[] typeName;
31
	private int componentsNumber;
32
	private IAnnotationComponent[] components;
33
	private int readOffset;
34
	private int targetType;
35
	private int annotationTypeIndex;
36
	private int offset;
37
	private int typeParameterIndex;
38
	private int typeParameterBoundIndex;
39
	private int parameterIndex;
40
	private int wildcardLocationType;
41
	private ILocalVariableReferenceInfo[] localVariableTable;
42
	private int[] locations;
43
	private int[] wildcardLocations;
44
	/**
45
	 * Constructor for Annotation.
46
	 *
47
	 * @param classFileBytes
48
	 * @param constantPool
49
	 * @param offset
50
	 * @throws ClassFormatException
51
	 */
52
	public ExtendedAnnotation(
53
			byte[] classFileBytes,
54
			IConstantPool constantPool,
55
			int offset) throws ClassFormatException {
56
57
		int index = u2At(classFileBytes, 0, offset);
58
		this.typeIndex = index;
59
		if (index != 0) {
60
			IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
61
			if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
62
				throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
63
			}
64
			this.typeName = constantPoolEntry.getUtf8Value();
65
		} else {
66
			throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
67
		}
68
		final int length = u2At(classFileBytes, 2, offset);
69
		this.componentsNumber = length;
70
		this.readOffset = 4;
71
		if (length != 0) {
72
			this.components = new IAnnotationComponent[length];
73
			for (int i = 0; i < length; i++) {
74
				AnnotationComponent component = new AnnotationComponent(classFileBytes, constantPool, offset + this.readOffset);
75
				this.components[i] = component;
76
				this.readOffset += component.sizeInBytes();
77
			}
78
		} else {
79
			this.components = NO_ENTRIES;
80
		}
81
		index = u1At(classFileBytes, this.readOffset, offset);
82
		this.readOffset++;
83
		this.targetType = index;
84
		switch(index) {
85
			case IExtendedAnnotationConstants.WILDCARD_BOUND :
86
				this.wildcardLocationType = u1At(classFileBytes, this.readOffset, offset);
87
				this.readOffset++;
88
				internalDecoding(this.wildcardLocationType, classFileBytes, constantPool, offset);
89
				// copy the location back into the wildcard location
90
				int size = this.locations.length;
91
				System.arraycopy(this.locations, 0, (this.wildcardLocations = new int[size]), 0, size);
92
				this.locations = null;
93
				break;
94
			case IExtendedAnnotationConstants.WILDCARD_BOUND_GENERIC_OR_ARRAY :
95
				this.wildcardLocationType = u1At(classFileBytes, this.readOffset, offset);
96
				this.readOffset++;
97
				internalDecoding(this.wildcardLocationType, classFileBytes, constantPool, offset);
98
				size = this.locations.length;
99
				System.arraycopy(this.locations, 0, (this.wildcardLocations = new int[size]), 0, size);
100
				int locationLength = u2At(classFileBytes, this.readOffset, offset);
101
				this.readOffset += 2;
102
				this.locations = new int[locationLength];
103
				for (int i = 0; i < locationLength; i++) {
104
					this.locations[i] = u1At(classFileBytes, this.readOffset, offset);
105
					this.readOffset++;
106
				}
107
				break;
108
			default:
109
				internalDecoding(index, classFileBytes, constantPool, offset);
110
		}
111
		if (this.annotationTypeIndex == 0xFFFF) {
112
			this.annotationTypeIndex = -1;
113
		}
114
	}
115
	
116
	private void internalDecoding(
117
			int localTargetType,
118
			byte[] classFileBytes,
119
			IConstantPool constantPool,
120
			int localOffset) throws ClassFormatException {
121
		switch(localTargetType) {
122
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS :
123
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
124
				this.readOffset+=2;
125
				break;
126
			case IExtendedAnnotationConstants.CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY :
127
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
128
				this.readOffset+=2;
129
				int locationLength = u2At(classFileBytes, this.readOffset, localOffset);
130
				this.readOffset += 2;
131
				this.locations = new int[locationLength];
132
				for (int i = 0; i < locationLength; i++) {
133
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
134
					this.readOffset++;
135
				}
136
				break;
137
			case IExtendedAnnotationConstants.TYPE_CAST :
138
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF :
139
			case IExtendedAnnotationConstants.OBJECT_CREATION :
140
			case IExtendedAnnotationConstants.CLASS_LITERAL :
141
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
142
				this.readOffset += 2;
143
				break;
144
			case IExtendedAnnotationConstants.TYPE_CAST_GENERIC_OR_ARRAY :
145
			case IExtendedAnnotationConstants.TYPE_INSTANCEOF_GENERIC_OR_ARRAY :
146
			case IExtendedAnnotationConstants.OBJECT_CREATION_GENERIC_OR_ARRAY :
147
			case IExtendedAnnotationConstants.CLASS_LITERAL_GENERIC_OR_ARRAY :
148
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
149
				this.readOffset += 2;
150
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
151
				this.readOffset += 2;
152
				this.locations = new int[locationLength];
153
				for (int i = 0; i < locationLength; i++) {
154
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
155
					this.readOffset++;
156
				}
157
				break;
158
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER :
159
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER :
160
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
161
				this.readOffset++;
162
				break;
163
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY :
164
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY :
165
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
166
				this.readOffset++;
167
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
168
				this.readOffset += 2;
169
				this.locations = new int[locationLength];
170
				for (int i = 0; i < locationLength; i++) {
171
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
172
					this.readOffset++;
173
				}
174
				break;
175
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND :
176
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND :
177
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
178
				this.readOffset++;
179
				this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset);
180
				this.readOffset++;
181
				break;
182
			case IExtendedAnnotationConstants.METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
183
			case IExtendedAnnotationConstants.CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY :
184
				this.typeParameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
185
				this.readOffset++;
186
				this.typeParameterBoundIndex = u1At(classFileBytes, this.readOffset, localOffset);
187
				this.readOffset++;
188
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
189
				this.readOffset += 2;
190
				this.locations = new int[locationLength];
191
				for (int i = 0; i < locationLength; i++) {
192
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
193
					this.readOffset++;
194
				}
195
				break;
196
			case IExtendedAnnotationConstants.LOCAL_VARIABLE :
197
				int tableLength = u2At(classFileBytes, this.readOffset, localOffset);
198
				this.readOffset += 2;
199
				this.localVariableTable = new LocalVariableReferenceInfo[tableLength];
200
				for (int i = 0; i < tableLength; i++) {
201
					this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset);
202
					this.readOffset += 6;
203
				}
204
				break;
205
			case IExtendedAnnotationConstants.LOCAL_VARIABLE_GENERIC_OR_ARRAY :
206
				tableLength = u2At(classFileBytes, this.readOffset, localOffset);
207
				this.readOffset += 2;
208
				this.localVariableTable = new LocalVariableReferenceInfo[tableLength];
209
				for (int i = 0; i < tableLength; i++) {
210
					this.localVariableTable[i] = new LocalVariableReferenceInfo(classFileBytes, constantPool, this.readOffset + localOffset);
211
					this.readOffset += 6;
212
				}
213
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
214
				this.readOffset += 2;
215
				this.locations = new int[locationLength];
216
				for (int i = 0; i < locationLength; i++) {
217
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
218
					this.readOffset++;
219
				}
220
				break;
221
			case IExtendedAnnotationConstants.METHOD_PARAMETER :
222
				this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
223
				this.readOffset++;
224
				break;
225
			case IExtendedAnnotationConstants.METHOD_PARAMETER_GENERIC_OR_ARRAY :
226
				this.parameterIndex = u1At(classFileBytes, this.readOffset, localOffset);
227
				this.readOffset++;
228
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
229
				this.readOffset += 2;
230
				this.locations = new int[locationLength];
231
				for (int i = 0; i < locationLength; i++) {
232
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
233
					this.readOffset++;
234
				}
235
				break;
236
			case IExtendedAnnotationConstants.METHOD_RECEIVER_GENERIC_OR_ARRAY :
237
			case IExtendedAnnotationConstants.METHOD_RETURN_TYPE_GENERIC_OR_ARRAY :
238
			case IExtendedAnnotationConstants.FIELD_GENERIC_OR_ARRAY :
239
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
240
				this.readOffset += 2;
241
				this.locations = new int[locationLength];
242
				for (int i = 0; i < locationLength; i++) {
243
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
244
					this.readOffset++;
245
				}
246
				break;
247
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL :
248
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL :
249
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
250
				this.readOffset += 2;
251
				this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);
252
				this.readOffset++;
253
				break;
254
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY :
255
			case IExtendedAnnotationConstants.TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY :
256
				this.offset = u2At(classFileBytes, this.readOffset, localOffset);
257
				this.readOffset += 2;
258
				this.annotationTypeIndex = u1At(classFileBytes, this.readOffset, localOffset);
259
				this.readOffset++;
260
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
261
				this.readOffset += 2;
262
				this.locations = new int[locationLength];
263
				for (int i = 0; i < locationLength; i++) {
264
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
265
					this.readOffset++;
266
				}
267
				break;
268
			case IExtendedAnnotationConstants.THROWS :
269
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
270
				this.readOffset+=2;
271
				break;
272
			case IExtendedAnnotationConstants.THROWS_GENERIC_OR_ARRAY :
273
				this.annotationTypeIndex = u2At(classFileBytes, this.readOffset, localOffset);
274
				this.readOffset+=2;
275
				locationLength = u2At(classFileBytes, this.readOffset, localOffset);
276
				this.readOffset += 2;
277
				this.locations = new int[locationLength];
278
				for (int i = 0; i < locationLength; i++) {
279
					this.locations[i] = u1At(classFileBytes, this.readOffset, localOffset);
280
					this.readOffset++;
281
				}
282
				break;
283
		}
284
	}
285
286
	/* (non-Javadoc)
287
	 * @see org.eclipse.jdt.core.util.IAnnotation#getTypeIndex()
288
	 */
289
	public int getTypeIndex() {
290
		return this.typeIndex;
291
	}
292
	/* (non-Javadoc)
293
	 * @see org.eclipse.jdt.core.util.IAnnotation#getComponentsNumber()
294
	 */
295
	public int getComponentsNumber() {
296
		return this.componentsNumber;
297
	}
298
	/* (non-Javadoc)
299
	 * @see org.eclipse.jdt.core.util.IAnnotation#getComponents()
300
	 */
301
	public IAnnotationComponent[] getComponents() {
302
		return this.components;
303
	}
304
305
	int sizeInBytes() {
306
		return this.readOffset;
307
	}
308
	/* (non-Javadoc)
309
	 * @see org.eclipse.jdt.core.util.IAnnotation#getTypeName()
310
	 */
311
	public char[] getTypeName() {
312
		return this.typeName;
313
	}
314
315
	public int getTargetType() {
316
		return this.targetType;
317
	}
318
319
	public int getOffset() {
320
		return this.offset;
321
	}
322
323
	public int getLocalVariableRefenceInfoLength() {
324
		return this.localVariableTable != null ? this.localVariableTable.length : 0;
325
	}
326
327
	public ILocalVariableReferenceInfo[] getLocalVariableTable() {
328
		return this.localVariableTable;
329
	}
330
331
	public int getParameterIndex() {
332
		return this.parameterIndex;
333
	}
334
335
	public int getTypeParameterIndex() {
336
		return this.typeParameterIndex;
337
	}
338
339
	public int getTypeParameterBoundIndex() {
340
		return this.typeParameterBoundIndex;
341
	}
342
343
	public int getWildcardLocationType() {
344
		return this.wildcardLocationType;
345
	}
346
347
	public int[] getWildcardLocations() {
348
		return this.wildcardLocations;
349
	}
350
351
	public int[] getLocations() {
352
		return this.locations;
353
	}
354
355
	public int getAnnotationTypeIndex() {
356
		return this.annotationTypeIndex;
357
	}
358
}
(-)model/org/eclipse/jdt/internal/core/util/FieldInfo.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 90-95 Link Here
90
				this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
90
				this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
91
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
91
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
92
				this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
92
				this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
93
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
94
				this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
95
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
96
				this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
93
			} else {
97
			} else {
94
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
98
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
95
			}
99
			}
(-)model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java (+63 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.ClassFormatException;
14
import org.eclipse.jdt.core.util.IConstantPool;
15
import org.eclipse.jdt.core.util.ILocalVariableReferenceInfo;
16
17
/**
18
 * Default implementation of ILocalVariableTableEntry
19
 */
20
public class LocalVariableReferenceInfo extends ClassFileStruct implements ILocalVariableReferenceInfo {
21
22
	private int startPC;
23
	private int length;
24
	private int index;
25
26
	/**
27
	 * Constructor for LocalVariableTableEntry.
28
	 *
29
	 * @param classFileBytes
30
	 * @param constantPool
31
	 * @param offset
32
	 * @throws ClassFormatException
33
	 */
34
	public LocalVariableReferenceInfo(
35
			byte[] classFileBytes,
36
			IConstantPool constantPool,
37
			int offset) throws ClassFormatException {
38
		this.startPC = u2At(classFileBytes, 0, offset);
39
		this.length = u2At(classFileBytes, 2, offset);
40
		this.index = u2At(classFileBytes, 4, offset);
41
	}
42
43
	/**
44
	 * @see ILocalVariableReferenceInfo#getStartPC()
45
	 */
46
	public int getStartPC() {
47
		return this.startPC;
48
	}
49
50
	/**
51
	 * @see ILocalVariableReferenceInfo#getLength()
52
	 */
53
	public int getLength() {
54
		return this.length;
55
	}
56
57
	/**
58
	 * @see ILocalVariableReferenceInfo#getIndex()
59
	 */
60
	public int getIndex() {
61
		return this.index;
62
	}
63
}
(-)model/org/eclipse/jdt/internal/core/util/Messages.java (+19 lines)
Lines 288-293 Link Here
288
	public static String disassembler_annotationentrystart;
288
	public static String disassembler_annotationentrystart;
289
	public static String disassembler_annotationentryend;
289
	public static String disassembler_annotationentryend;
290
	public static String disassembler_annotationcomponent;
290
	public static String disassembler_annotationcomponent;
291
	// jsr308
292
	public static String disassembler_extendedannotationentrystart;
293
	public static String disassembler_extendedannotationentryend;
294
	public static String disassembler_runtimevisibletypeannotationsattributeheader;
295
	public static String disassembler_runtimeinvisibletypeannotationsattributeheader;
296
	public static String disassembler_extendedannotation_classextendsimplements;
297
	public static String disassembler_extendedannotation_locations;
298
	public static String disassembler_extendedannotation_method_parameter;
299
	public static String disassembler_extendedannotation_offset;
300
	public static String disassembler_extendedannotation_throws;
301
	public static String disassembler_extendedannotation_type_argument;
302
	public static String disassembler_extendedannotation_type_parameter;
303
	public static String disassembler_extendedannotation_type_parameter_with_bound;
304
	public static String disassembler_extendedannotation_wildcardlocationtype;
305
	public static String disassembler_extendedannotation_targetType;
306
	public static String disassembler_extendedannotation_wildcardlocations;
307
	public static String disassembler_localvariabletargetheader;
308
	public static String classfileformat_localvariablereferenceinfoentry;
309
291
	public static String disassembler_runtimevisibleannotationsattributeheader;
310
	public static String disassembler_runtimevisibleannotationsattributeheader;
292
	public static String disassembler_runtimeinvisibleannotationsattributeheader;
311
	public static String disassembler_runtimeinvisibleannotationsattributeheader;
293
	public static String disassembler_runtimevisibleparameterannotationsattributeheader;
312
	public static String disassembler_runtimevisibleparameterannotationsattributeheader;
(-)model/org/eclipse/jdt/internal/core/util/MethodInfo.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 114-119 Link Here
114
				this.attributes[attributesIndex++] = new RuntimeInvisibleParameterAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
114
				this.attributes[attributesIndex++] = new RuntimeInvisibleParameterAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
115
			} else if (equals(attributeName, IAttributeNamesConstants.ANNOTATION_DEFAULT)) {
115
			} else if (equals(attributeName, IAttributeNamesConstants.ANNOTATION_DEFAULT)) {
116
				this.attributes[attributesIndex++] = new AnnotationDefaultAttribute(classFileBytes, constantPool, offset + readOffset);
116
				this.attributes[attributesIndex++] = new AnnotationDefaultAttribute(classFileBytes, constantPool, offset + readOffset);
117
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
118
				this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
119
			} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
120
				this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
117
			} else {
121
			} else {
118
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
122
				this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
119
			}
123
			}
(-)model/org/eclipse/jdt/internal/core/util/PublicScanner.java (-62 / +403 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 106-116 Link Here
106
106
107
	public static final String NULL_SOURCE_STRING = "Null_Source_String"; //$NON-NLS-1$
107
	public static final String NULL_SOURCE_STRING = "Null_Source_String"; //$NON-NLS-1$
108
	public static final String UNTERMINATED_STRING = "Unterminated_String"; //$NON-NLS-1$
108
	public static final String UNTERMINATED_STRING = "Unterminated_String"; //$NON-NLS-1$
109
	public static final String UNTERMINATED_EXOTIC_IDENTIFIER = "Unterminated_Exotic_Identifier"; //$NON-NLS-1$
109
	public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; //$NON-NLS-1$
110
	public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; //$NON-NLS-1$
110
	public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //$NON-NLS-1$
111
	public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //$NON-NLS-1$
112
	public static final String INVALID_CHAR_IN_EXOTIC_IDENTIFIER = "Invalid_Char_In_Exotic_Identifier"; //$NON-NLS-1$
113
	public static final String INVALID_EMPTY_EXOTIC_IDENTIFIER = "Invalid_Empty_Exotic_Identifier"; //$NON-NLS-1$
111
	public static final String INVALID_DIGIT = "Invalid_Digit"; //$NON-NLS-1$
114
	public static final String INVALID_DIGIT = "Invalid_Digit"; //$NON-NLS-1$
112
	private static final int[] EMPTY_LINE_ENDS = Util.EMPTY_INT_ARRAY;
115
	private static final int[] EMPTY_LINE_ENDS = Util.EMPTY_INT_ARRAY;
113
116
117
	public static final String INVALID_BINARY = "Invalid_Binary_Literal"; //$NON-NLS-1$
118
	public static final String ILLEGAL_BINARY_LITERAL = "Illegal_Binary_Literal"; //$NON-NLS-1$
119
	public static final String ILLEGAL_HEXA_LITERAL = "Illegal_Hexa_Literal"; //$NON-NLS-1$
120
	public static final String INVALID_UNDERSCORE = "Invalid_Underscore"; //$NON-NLS-1$
121
	public static final String INVALID_USAGE_OF_UNDERSCORE = "Invalid_Usage_Of_Underscore"; //$NON-NLS-1$`
122
	public static final String ILLEGAL_DANGEROUS_CHARACTER = "Illegal_Dangerous_Character"; //$NON-NLS-1$
123
	public static final String ILLEGAL_EXOTIC_IDENTIFIER = "Illegal_Exotic_Identifier"; //$NON-NLS-1$
124
114
	//----------------optimized identifier managment------------------
125
	//----------------optimized identifier managment------------------
115
	static final char[] charArray_a = new char[] {'a'},
126
	static final char[] charArray_a = new char[] {'a'},
116
		charArray_b = new char[] {'b'},
127
		charArray_b = new char[] {'b'},
Lines 208-227 Link Here
208
	this.complianceLevel = complianceLevel;
219
	this.complianceLevel = complianceLevel;
209
	this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
220
	this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
210
	if (taskTags != null) {
221
	if (taskTags != null) {
211
		int length = taskTags.length;
222
		int taskTagsLength = taskTags.length;
223
		int length = taskTagsLength;
212
		if (taskPriorities != null) {
224
		if (taskPriorities != null) {
225
			int taskPrioritiesLength = taskPriorities.length;
226
			if (taskPrioritiesLength != taskTagsLength) {
227
				if (taskPrioritiesLength > taskTagsLength) {
228
					System.arraycopy(taskPriorities, 0, (taskPriorities = new char[taskTagsLength][]), 0, taskTagsLength);
229
				} else {
230
					System.arraycopy(taskTags, 0, (taskTags = new char[taskPrioritiesLength][]), 0, taskPrioritiesLength);
231
					length = taskPrioritiesLength;
232
				}
233
			}
213
			int[] initialIndexes = new int[length];
234
			int[] initialIndexes = new int[length];
214
			for (int i = 0; i < length; i++) {
235
			for (int i = 0; i < length; i++) {
215
				initialIndexes[i] = i;
236
				initialIndexes[i] = i;
216
			}
237
			}
217
			Util.reverseQuickSort(taskTags, 0, taskTags.length - 1, initialIndexes);
238
			Util.reverseQuickSort(taskTags, 0, length - 1, initialIndexes);
218
			char[][] temp = new char[length][];
239
			char[][] temp = new char[length][];
219
			for (int i = 0; i < length; i++) {
240
			for (int i = 0; i < length; i++) {
220
				temp[i] = taskPriorities[initialIndexes[i]];
241
				temp[i] = taskPriorities[initialIndexes[i]];
221
			}
242
			}
222
			this.taskPriorities = temp;
243
			this.taskPriorities = temp;
223
		} else {
244
		} else {
224
			Util.reverseQuickSort(taskTags, 0, taskTags.length - 1);
245
			Util.reverseQuickSort(taskTags, 0, length - 1);
225
		}
246
		}
226
		this.taskTags = taskTags;
247
		this.taskTags = taskTags;
227
		this.isTaskCaseSensitive = isTaskCaseSensitive;
248
		this.isTaskCaseSensitive = isTaskCaseSensitive;
Lines 395-401 Link Here
395
	//return the token REAL source (aka unicodes are precomputed)
416
	//return the token REAL source (aka unicodes are precomputed)
396
417
397
	char[] result;
418
	char[] result;
398
	if (this.withoutUnicodePtr != 0) {
419
	if (this.source[this.startPosition] == '#') {
420
		// 1.7 exotic identifier
421
		if (this.withoutUnicodePtr != 0) {
422
			// unicode were used inside the string
423
			int length = this.withoutUnicodePtr - 3;
424
			System.arraycopy(
425
					this.withoutUnicodeBuffer,
426
					3,
427
					result = new char[length],
428
					0,
429
					length);
430
		} else {
431
			int length = this.currentPosition - this.startPosition - 3;
432
			System.arraycopy(this.source, this.startPosition + 2, result = new char[length], 0, length);
433
		}
434
	} else if (this.withoutUnicodePtr != 0) {
399
		//0 is used as a fast test flag so the real first char is in position 1
435
		//0 is used as a fast test flag so the real first char is in position 1
400
		System.arraycopy(
436
		System.arraycopy(
401
			this.withoutUnicodeBuffer,
437
			this.withoutUnicodeBuffer,
Lines 718-723 Link Here
718
		return -1;
754
		return -1;
719
	}
755
	}
720
}
756
}
757
/*
758
 * This method consumes digits as well as underscores if underscores are located between digits
759
 * @throws InvalidInputException if underscores are not located between digits or if underscores are used in source < 1.7 
760
 */
761
private final void consumeDigits(int radix) throws InvalidInputException {
762
	consumeDigits(radix, false);
763
}
764
/*
765
 * This method consumes digits as well as underscores if underscores are located between digits
766
 * @throws InvalidInputException if underscores are not located between digits or if underscores are used in source < 1.7 
767
 */
768
private final void consumeDigits(int radix, boolean expectingDigitFirst) throws InvalidInputException {
769
	final int USING_UNDERSCORE = 1;
770
	final int INVALID_POSITION = 2;
771
	switch(consumeDigits0(radix, USING_UNDERSCORE, INVALID_POSITION, expectingDigitFirst)) {
772
		case USING_UNDERSCORE :
773
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
774
				throw new InvalidInputException(INVALID_USAGE_OF_UNDERSCORE);
775
			}
776
			break;
777
		case INVALID_POSITION :
778
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
779
				throw new InvalidInputException(INVALID_USAGE_OF_UNDERSCORE);
780
			}
781
			throw new InvalidInputException(INVALID_UNDERSCORE);
782
	}
783
}
784
private final int consumeDigits0(int radix, int usingUnderscore, int invalidPosition, boolean expectingDigitFirst) throws InvalidInputException {
785
	int kind = 0;
786
	if (getNextChar('_')) {
787
		if (expectingDigitFirst) {
788
			return invalidPosition;
789
		}
790
		kind = usingUnderscore;
791
		while (getNextChar('_')) {/*empty */}
792
	}
793
	if (getNextCharAsDigit(radix)) {
794
		// continue to read digits or underscore
795
		while (getNextCharAsDigit(radix)) {/*empty */}
796
		int kind2 = consumeDigits0(radix, usingUnderscore, invalidPosition, false);
797
		if (kind2 == 0) {
798
			return kind;
799
		}
800
		return kind2;
801
	}
802
	if (kind == usingUnderscore) return invalidPosition;
803
	return kind;
804
}
721
public final boolean getNextCharAsDigit() throws InvalidInputException {
805
public final boolean getNextCharAsDigit() throws InvalidInputException {
722
	//BOOLEAN
806
	//BOOLEAN
723
	//handle the case of unicode.
807
	//handle the case of unicode.
Lines 1673-1678 Link Here
1673
						return TokenNameEOF;
1757
						return TokenNameEOF;
1674
					//the atEnd may not be <currentPosition == source.length> if source is only some part of a real (external) stream
1758
					//the atEnd may not be <currentPosition == source.length> if source is only some part of a real (external) stream
1675
					throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
1759
					throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
1760
				case '#' :
1761
					if (getNextChar('"')) {
1762
						// new exotic identifier
1763
						return scanExoticIdentifier();
1764
					}
1765
					return TokenNameERROR;
1676
				default :
1766
				default :
1677
					char c = this.currentCharacter;
1767
					char c = this.currentCharacter;
1678
					if (c < ScannerHelper.MAX_OBVIOUS) {
1768
					if (c < ScannerHelper.MAX_OBVIOUS) {
Lines 2626-2632 Link Here
2626
	this.foundTaskCount = 0;
2716
	this.foundTaskCount = 0;
2627
}
2717
}
2628
2718
2629
public final void scanEscapeCharacter() throws InvalidInputException {
2719
protected final void scanEscapeCharacter() throws InvalidInputException {
2630
	// the string with "\\u" is a legal string of two chars \ and u
2720
	// the string with "\\u" is a legal string of two chars \ and u
2631
	//thus we use a direct access to the source (for regular cases).
2721
	//thus we use a direct access to the source (for regular cases).
2632
	switch (this.currentCharacter) {
2722
	switch (this.currentCharacter) {
Lines 2694-2699 Link Here
2694
				throw new InvalidInputException(INVALID_ESCAPE);
2784
				throw new InvalidInputException(INVALID_ESCAPE);
2695
	}
2785
	}
2696
}
2786
}
2787
protected final void scanEscapeExoticCharacter() throws InvalidInputException {
2788
	// the string with "\\u" is a legal string of two chars \ and u
2789
	//thus we use a direct access to the source (for regular cases).
2790
	switch (this.currentCharacter) {
2791
		case '!' :
2792
		case '#' :
2793
		case '$' :
2794
		case '%' :
2795
		case '&' :
2796
		case '(' :
2797
		case ')' :
2798
		case '*' :
2799
		case '+' :
2800
		case ',' :
2801
		case '-' :
2802
		case ':' :
2803
		case '=' :
2804
		case '?' :
2805
		case '@' :
2806
		case '^' :
2807
		case '_' :
2808
		case '`' :
2809
		case '{' :
2810
		case '|' :
2811
		case '}' :
2812
		case '~' :
2813
			unicodeStore('\\');
2814
			unicodeStore();
2815
			break;
2816
		case '/' :
2817
		case '.' :
2818
		case ';' :
2819
		case '<' :
2820
		case '>' :
2821
		case '[' :
2822
		case ']' :
2823
			unicodeStore();
2824
			break;
2825
		default :
2826
			scanEscapeCharacter();
2827
			if (this.withoutUnicodePtr != 0) {
2828
				unicodeStore();
2829
			}
2830
	}
2831
}
2697
public int scanIdentifierOrKeywordWithBoundCheck() {
2832
public int scanIdentifierOrKeywordWithBoundCheck() {
2698
	//test keywords
2833
	//test keywords
2699
2834
Lines 2715-2721 Link Here
2715
			if (c < ScannerHelper.MAX_OBVIOUS) {
2850
			if (c < ScannerHelper.MAX_OBVIOUS) {
2716
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] &
2851
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] &
2717
						(ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_IDENT_PART | ScannerHelper.C_DIGIT)) != 0) {
2852
						(ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_IDENT_PART | ScannerHelper.C_DIGIT)) != 0) {
2718
		               if (this.withoutUnicodePtr != 0) {
2853
					if (this.withoutUnicodePtr != 0) {
2719
							this.currentCharacter = c;
2854
							this.currentCharacter = c;
2720
							unicodeStore();
2855
							unicodeStore();
2721
						}
2856
						}
Lines 2761-2767 Link Here
2761
2896
2762
	//first dispatch on the first char.
2897
	//first dispatch on the first char.
2763
	//then the length. If there are several
2898
	//then the length. If there are several
2764
	//keywors with the same length AND the same first char, then do another
2899
	//keywords with the same length AND the same first char, then do another
2765
	//dispatch on the second char
2900
	//dispatch on the second char
2766
	this.useAssertAsAnIndentifier = false;
2901
	this.useAssertAsAnIndentifier = false;
2767
	this.useEnumAsAnIndentifier = false;
2902
	this.useEnumAsAnIndentifier = false;
Lines 2777-2783 Link Here
2777
			if (c < ScannerHelper.MAX_OBVIOUS) {
2912
			if (c < ScannerHelper.MAX_OBVIOUS) {
2778
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] &
2913
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] &
2779
						(ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_IDENT_PART | ScannerHelper.C_DIGIT)) != 0) {
2914
						(ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_IDENT_PART | ScannerHelper.C_DIGIT)) != 0) {
2780
		               if (this.withoutUnicodePtr != 0) {
2915
					if (this.withoutUnicodePtr != 0) {
2781
							this.currentCharacter = c;
2916
							this.currentCharacter = c;
2782
							unicodeStore();
2917
							unicodeStore();
2783
						}
2918
						}
Lines 2818-2824 Link Here
2818
2953
2819
	return internalScanIdentifierOrKeyword(index, length, data);
2954
	return internalScanIdentifierOrKeyword(index, length, data);
2820
}
2955
}
2956
private int scanExoticIdentifier() throws InvalidInputException {
2957
	try {
2958
		// consume next character
2959
		this.unicodeAsBackSlash = false;
2960
		boolean isUnicode = false;
2961
		if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
2962
				&& (this.source[this.currentPosition] == 'u')) {
2963
			getNextUnicodeChar();
2964
			isUnicode = true;
2965
		} else {
2966
			if (this.withoutUnicodePtr != 0) {
2967
				unicodeStore();
2968
			}
2969
		}
2821
2970
2971
		int exoticIdentifierStart = this.currentPosition;
2972
		while (this.currentCharacter != '"') {
2973
			if (this.currentPosition >= this.eofPosition) {
2974
				throw new InvalidInputException(UNTERMINATED_EXOTIC_IDENTIFIER);
2975
			}
2976
			switch(this.currentCharacter) {
2977
				case '/' :
2978
				case '.' :
2979
				case ';' :
2980
				case '<' :
2981
				case '>' :
2982
				case '[' :
2983
				case ']' :
2984
					throw new InvalidInputException(ILLEGAL_DANGEROUS_CHARACTER);
2985
				case '\n' :
2986
				case '\r' :
2987
					/**** \r and \n are not valid in exotic identifier ****/
2988
					// relocate if finding another quote fairly close: thus
2989
					// unicode '/u000D' will be fully consumed
2990
					if (isUnicode) {
2991
						int start = this.currentPosition;
2992
						for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
2993
							if (this.currentPosition >= this.eofPosition) {
2994
								this.currentPosition = start;
2995
								break;
2996
							}
2997
							if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
2998
									&& (this.source[this.currentPosition] == 'u')) {
2999
								isUnicode = true;
3000
								getNextUnicodeChar();
3001
							} else {
3002
								isUnicode = false;
3003
							}
3004
							if (!isUnicode && this.currentCharacter == '\n') {
3005
								this.currentPosition--; // set current position
3006
														// on new line character
3007
								break;
3008
							}
3009
							if (this.currentCharacter == '\"') {
3010
								throw new InvalidInputException(
3011
										INVALID_CHAR_IN_EXOTIC_IDENTIFIER);
3012
							}
3013
						}
3014
					} else {
3015
						this.currentPosition--; // set current position on new
3016
												// line character
3017
					}
3018
					throw new InvalidInputException(INVALID_CHAR_IN_EXOTIC_IDENTIFIER);
3019
				case '\\' :
3020
					if (this.unicodeAsBackSlash) {
3021
						this.withoutUnicodePtr--;
3022
						// consume next character
3023
						this.unicodeAsBackSlash = false;
3024
						if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3025
								&& (this.source[this.currentPosition] == 'u')) {
3026
							getNextUnicodeChar();
3027
							isUnicode = true;
3028
							this.withoutUnicodePtr--;
3029
						} else {
3030
							isUnicode = false;
3031
						}
3032
					} else {
3033
						if (this.withoutUnicodePtr == 0) {
3034
							unicodeInitializeBuffer(this.currentPosition
3035
									- this.startPosition);
3036
						}
3037
						this.withoutUnicodePtr--;
3038
						this.currentCharacter = this.source[this.currentPosition++];
3039
					}
3040
					// we need to compute the escape character in a separate
3041
					// buffer
3042
					scanEscapeExoticCharacter();
3043
			}
3044
			this.unicodeAsBackSlash = false;
3045
			if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3046
					&& (this.source[this.currentPosition] == 'u')) {
3047
				getNextUnicodeChar();
3048
				isUnicode = true;
3049
			} else {
3050
				isUnicode = false;
3051
				if (this.withoutUnicodePtr != 0) {
3052
					unicodeStore();
3053
				}
3054
			}
3055
		}
3056
		if ((this.currentPosition - exoticIdentifierStart) == 0) {
3057
			throw new InvalidInputException(INVALID_EMPTY_EXOTIC_IDENTIFIER);
3058
		}
3059
	} catch (IndexOutOfBoundsException e) {
3060
		this.currentPosition--;
3061
		throw new InvalidInputException(UNTERMINATED_EXOTIC_IDENTIFIER);
3062
	} catch (InvalidInputException e) {
3063
		if (e.getMessage().equals(INVALID_ESCAPE)) {
3064
			// relocate if finding another quote fairly close: thus unicode
3065
			// '/u000D' will be fully consumed
3066
			for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
3067
				if (this.currentPosition + lookAhead == this.eofPosition)
3068
					break;
3069
				if (this.source[this.currentPosition + lookAhead] == '\n')
3070
					break;
3071
				if (this.source[this.currentPosition + lookAhead] == '\"') {
3072
					this.currentPosition += lookAhead + 1;
3073
					break;
3074
				}
3075
			}
3076
3077
		}
3078
		throw e; // rethrow
3079
	}
3080
	if (this.complianceLevel <= ClassFileConstants.JDK1_6) {
3081
		throw new InvalidInputException(ILLEGAL_EXOTIC_IDENTIFIER);
3082
	}
3083
	return TokenNameIdentifier;
3084
}
2822
private int internalScanIdentifierOrKeyword(int index, int length, char[] data) {
3085
private int internalScanIdentifierOrKeyword(int index, int length, char[] data) {
2823
	switch (data[index]) {
3086
	switch (data[index]) {
2824
		case 'a' :
3087
		case 'a' :
Lines 3380-3389 Link Here
3380
	//dotPrefix is true
3643
	//dotPrefix is true
3381
3644
3382
	boolean floating = dotPrefix;
3645
	boolean floating = dotPrefix;
3383
	if ((!dotPrefix) && (this.currentCharacter == '0')) {
3646
	if (!dotPrefix && (this.currentCharacter == '0')) {
3384
		if (getNextChar('x', 'X') >= 0) { //----------hexa-----------------
3647
		if (getNextChar('x', 'X') >= 0) { //----------hexa-----------------
3385
			int start = this.currentPosition;
3648
			int start = this.currentPosition;
3386
			while (getNextCharAsDigit(16)){/*empty*/}
3649
			consumeDigits(16, true);
3387
			int end = this.currentPosition;
3650
			int end = this.currentPosition;
3388
			if (getNextChar('l', 'L') >= 0) {
3651
			if (getNextChar('l', 'L') >= 0) {
3389
				if (end == start) {
3652
				if (end == start) {
Lines 3391-3417 Link Here
3391
				}
3654
				}
3392
				return TokenNameLongLiteral;
3655
				return TokenNameLongLiteral;
3393
			} else if (getNextChar('.')) {
3656
			} else if (getNextChar('.')) {
3394
				if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3395
					if (end == start) {
3396
						throw new InvalidInputException(INVALID_HEXA);
3397
					}
3398
					this.currentPosition = end;
3399
					return TokenNameIntegerLiteral;
3400
				}
3401
				// hexadecimal floating point literal
3657
				// hexadecimal floating point literal
3402
				// read decimal part
3658
				// read decimal part
3403
				boolean hasNoDigitsBeforeDot = end == start;
3659
				boolean hasNoDigitsBeforeDot = end == start;
3404
				start = this.currentPosition;
3660
				start = this.currentPosition;
3405
				while (getNextCharAsDigit(16)){/*empty*/}
3661
				consumeDigits(16, true);
3406
				end = this.currentPosition;
3662
				end = this.currentPosition;
3407
				if (hasNoDigitsBeforeDot && end == start) {
3663
				if (hasNoDigitsBeforeDot && end == start) {
3664
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3665
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3666
					}
3408
					throw new InvalidInputException(INVALID_HEXA);
3667
					throw new InvalidInputException(INVALID_HEXA);
3409
				}
3668
				}
3410
3669
3411
				if (getNextChar('p', 'P') >= 0) { // consume next character
3670
				if (getNextChar('p', 'P') >= 0) { // consume next character
3412
					this.unicodeAsBackSlash = false;
3671
					this.unicodeAsBackSlash = false;
3413
					if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3672
					if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3414
						&& (this.source[this.currentPosition] == 'u')) {
3673
							&& (this.source[this.currentPosition] == 'u')) {
3415
						getNextUnicodeChar();
3674
						getNextUnicodeChar();
3416
					} else {
3675
					} else {
3417
						if (this.withoutUnicodePtr != 0) {
3676
						if (this.withoutUnicodePtr != 0) {
Lines 3420-3429 Link Here
3420
					}
3679
					}
3421
3680
3422
					if ((this.currentCharacter == '-')
3681
					if ((this.currentCharacter == '-')
3423
						|| (this.currentCharacter == '+')) { // consume next character
3682
							|| (this.currentCharacter == '+')) { // consume next character
3424
						this.unicodeAsBackSlash = false;
3683
						this.unicodeAsBackSlash = false;
3425
						if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3684
						if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3426
							&& (this.source[this.currentPosition] == 'u')) {
3685
								&& (this.source[this.currentPosition] == 'u')) {
3427
							getNextUnicodeChar();
3686
							getNextUnicodeChar();
3428
						} else {
3687
						} else {
3429
							if (this.withoutUnicodePtr != 0) {
3688
							if (this.withoutUnicodePtr != 0) {
Lines 3432-3462 Link Here
3432
						}
3691
						}
3433
					}
3692
					}
3434
					if (!ScannerHelper.isDigit(this.currentCharacter)) {
3693
					if (!ScannerHelper.isDigit(this.currentCharacter)) {
3694
						if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3695
							throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3696
						}
3697
						if (this.currentCharacter == '_') {
3698
							// wrongly place '_'
3699
							consumeDigits(10);
3700
							throw new InvalidInputException(INVALID_UNDERSCORE);
3701
						}
3435
						throw new InvalidInputException(INVALID_HEXA);
3702
						throw new InvalidInputException(INVALID_HEXA);
3436
					}
3703
					}
3437
					while (getNextCharAsDigit()){/*empty*/}
3704
					consumeDigits(10, true);
3438
					if (getNextChar('f', 'F') >= 0) {
3705
					if (getNextChar('f', 'F') >= 0) {
3706
						if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3707
							throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3708
						}
3439
						return TokenNameFloatingPointLiteral;
3709
						return TokenNameFloatingPointLiteral;
3440
					}
3710
					}
3441
					if (getNextChar('d', 'D') >= 0) {
3711
					if (getNextChar('d', 'D') >= 0) {
3712
						if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3713
							throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3714
						}
3442
						return TokenNameDoubleLiteral;
3715
						return TokenNameDoubleLiteral;
3443
					}
3716
					}
3444
					if (getNextChar('l', 'L') >= 0) {
3717
					if (getNextChar('l', 'L') >= 0) {
3718
						if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3719
							throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3720
						}
3445
						throw new InvalidInputException(INVALID_HEXA);
3721
						throw new InvalidInputException(INVALID_HEXA);
3446
					}
3722
					}
3723
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3724
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3725
					}
3447
					return TokenNameDoubleLiteral;
3726
					return TokenNameDoubleLiteral;
3448
				} else {
3727
				} else {
3728
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3729
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3730
					}
3449
					throw new InvalidInputException(INVALID_HEXA);
3731
					throw new InvalidInputException(INVALID_HEXA);
3450
				}
3732
				}
3451
			} else if (getNextChar('p', 'P') >= 0) { // consume next character
3733
			} else if (getNextChar('p', 'P') >= 0) { // consume next character
3452
				if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3453
					// if we are in source level < 1.5 we report an integer literal
3454
					this.currentPosition = end;
3455
					return TokenNameIntegerLiteral;
3456
				}
3457
				this.unicodeAsBackSlash = false;
3734
				this.unicodeAsBackSlash = false;
3458
				if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3735
				if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3459
					&& (this.source[this.currentPosition] == 'u')) {
3736
						&& (this.source[this.currentPosition] == 'u')) {
3460
					getNextUnicodeChar();
3737
					getNextUnicodeChar();
3461
				} else {
3738
				} else {
3462
					if (this.withoutUnicodePtr != 0) {
3739
					if (this.withoutUnicodePtr != 0) {
Lines 3465-3474 Link Here
3465
				}
3742
				}
3466
3743
3467
				if ((this.currentCharacter == '-')
3744
				if ((this.currentCharacter == '-')
3468
					|| (this.currentCharacter == '+')) { // consume next character
3745
						|| (this.currentCharacter == '+')) { // consume next character
3469
					this.unicodeAsBackSlash = false;
3746
					this.unicodeAsBackSlash = false;
3470
					if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3747
					if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3471
						&& (this.source[this.currentPosition] == 'u')) {
3748
							&& (this.source[this.currentPosition] == 'u')) {
3472
						getNextUnicodeChar();
3749
						getNextUnicodeChar();
3473
					} else {
3750
					} else {
3474
						if (this.withoutUnicodePtr != 0) {
3751
						if (this.withoutUnicodePtr != 0) {
Lines 3476-3503 Link Here
3476
						}
3753
						}
3477
					}
3754
					}
3478
				}
3755
				}
3479
				if (!ScannerHelper.isDigit(this.currentCharacter))
3756
				if (!ScannerHelper.isDigit(this.currentCharacter)) {
3757
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3758
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3759
					}
3760
					if (this.currentCharacter == '_') {
3761
						// wrongly place '_'
3762
						consumeDigits(10);
3763
						throw new InvalidInputException(INVALID_UNDERSCORE);
3764
					}
3480
					throw new InvalidInputException(INVALID_FLOAT);
3765
					throw new InvalidInputException(INVALID_FLOAT);
3481
				while (getNextCharAsDigit()){/*empty*/}
3766
				}
3482
				if (getNextChar('f', 'F') >= 0)
3767
				consumeDigits(10, true);
3768
				if (getNextChar('f', 'F') >= 0) {
3769
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3770
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3771
					}
3483
					return TokenNameFloatingPointLiteral;
3772
					return TokenNameFloatingPointLiteral;
3484
				if (getNextChar('d', 'D') >= 0)
3773
				}
3774
				if (getNextChar('d', 'D') >= 0) {
3775
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3776
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3777
					}
3485
					return TokenNameDoubleLiteral;
3778
					return TokenNameDoubleLiteral;
3779
				}
3486
				if (getNextChar('l', 'L') >= 0) {
3780
				if (getNextChar('l', 'L') >= 0) {
3781
					if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3782
						throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3783
					}
3487
					throw new InvalidInputException(INVALID_HEXA);
3784
					throw new InvalidInputException(INVALID_HEXA);
3488
				}
3785
				}
3786
				if (this.sourceLevel < ClassFileConstants.JDK1_5) {
3787
					throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
3788
				}
3489
				return TokenNameDoubleLiteral;
3789
				return TokenNameDoubleLiteral;
3490
			} else {
3790
			} else {
3491
				if (end == start)
3791
				if (end == start)
3492
					throw new InvalidInputException(INVALID_HEXA);
3792
					throw new InvalidInputException(INVALID_HEXA);
3493
				return TokenNameIntegerLiteral;
3793
				return TokenNameIntegerLiteral;
3494
			}
3794
			}
3795
		} else if (getNextChar('b', 'B') >= 0) { //----------binary-----------------
3796
			int start = this.currentPosition;
3797
			consumeDigits(2, true);
3798
			int end = this.currentPosition;
3799
			if (end == start) {
3800
				if (this.sourceLevel < ClassFileConstants.JDK1_7) {
3801
					throw new InvalidInputException(ILLEGAL_BINARY_LITERAL);
3802
				}
3803
				throw new InvalidInputException(INVALID_BINARY);
3804
			}
3805
			if (getNextChar('l', 'L') >= 0) {
3806
				if (this.sourceLevel < ClassFileConstants.JDK1_7) {
3807
					throw new InvalidInputException(ILLEGAL_BINARY_LITERAL);
3808
				}
3809
				return TokenNameLongLiteral;
3810
			}
3811
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
3812
				throw new InvalidInputException(ILLEGAL_BINARY_LITERAL);
3813
			}
3814
			return TokenNameIntegerLiteral;
3495
		}
3815
		}
3496
3816
3497
		//there is x or X in the number
3817
		//there is no x or X nor b or B in the number
3498
		//potential octal ! ... some one may write 000099.0 ! thus 00100 < 00078.0 is true !!!!! crazy language
3818
		//potential octal
3499
		if (getNextCharAsDigit()) { //-------------potential octal-----------------
3819
		if (getNextCharAsDigit()) { //-------------potential octal-----------------
3500
			while (getNextCharAsDigit()){/*empty*/}
3820
			consumeDigits(10);
3501
3821
3502
			if (getNextChar('l', 'L') >= 0) {
3822
			if (getNextChar('l', 'L') >= 0) {
3503
				return TokenNameLongLiteral;
3823
				return TokenNameLongLiteral;
Lines 3513-3525 Link Here
3513
				boolean isInteger = true;
3833
				boolean isInteger = true;
3514
				if (getNextChar('.')) {
3834
				if (getNextChar('.')) {
3515
					isInteger = false;
3835
					isInteger = false;
3516
					while (getNextCharAsDigit()){/*empty*/}
3836
					consumeDigits(10);
3517
				}
3837
				}
3518
				if (getNextChar('e', 'E') >= 0) { // consume next character
3838
				if (getNextChar('e', 'E') >= 0) { // consume next character
3519
					isInteger = false;
3839
					isInteger = false;
3520
					this.unicodeAsBackSlash = false;
3840
					this.unicodeAsBackSlash = false;
3521
					if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3841
					if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3522
						&& (this.source[this.currentPosition] == 'u')) {
3842
							&& (this.source[this.currentPosition] == 'u')) {
3523
						getNextUnicodeChar();
3843
						getNextUnicodeChar();
3524
					} else {
3844
					} else {
3525
						if (this.withoutUnicodePtr != 0) {
3845
						if (this.withoutUnicodePtr != 0) {
Lines 3528-3537 Link Here
3528
					}
3848
					}
3529
3849
3530
					if ((this.currentCharacter == '-')
3850
					if ((this.currentCharacter == '-')
3531
						|| (this.currentCharacter == '+')) { // consume next character
3851
							|| (this.currentCharacter == '+')) { // consume next character
3532
						this.unicodeAsBackSlash = false;
3852
						this.unicodeAsBackSlash = false;
3533
						if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3853
						if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3534
							&& (this.source[this.currentPosition] == 'u')) {
3854
								&& (this.source[this.currentPosition] == 'u')) {
3535
							getNextUnicodeChar();
3855
							getNextUnicodeChar();
3536
						} else {
3856
						} else {
3537
							if (this.withoutUnicodePtr != 0) {
3857
							if (this.withoutUnicodePtr != 0) {
Lines 3539-3547 Link Here
3539
							}
3859
							}
3540
						}
3860
						}
3541
					}
3861
					}
3542
					if (!ScannerHelper.isDigit(this.currentCharacter))
3862
					if (!ScannerHelper.isDigit(this.currentCharacter)) {
3863
						if (this.currentCharacter == '_') {
3864
							// wrongly place '_'
3865
							consumeDigits(10);
3866
							throw new InvalidInputException(INVALID_UNDERSCORE);
3867
						}
3543
						throw new InvalidInputException(INVALID_FLOAT);
3868
						throw new InvalidInputException(INVALID_FLOAT);
3544
					while (getNextCharAsDigit()){/*empty*/}
3869
					}
3870
					consumeDigits(10, true);
3545
				}
3871
				}
3546
				if (getNextChar('f', 'F') >= 0)
3872
				if (getNextChar('f', 'F') >= 0)
3547
					return TokenNameFloatingPointLiteral;
3873
					return TokenNameFloatingPointLiteral;
Lines 3554-3566 Link Here
3554
		}
3880
		}
3555
	}
3881
	}
3556
3882
3557
	while (getNextCharAsDigit()){/*empty*/}
3883
	consumeDigits(10);
3558
3884
3559
	if ((!dotPrefix) && (getNextChar('l', 'L') >= 0))
3885
	if ((!dotPrefix) && (getNextChar('l', 'L') >= 0))
3560
		return TokenNameLongLiteral;
3886
		return TokenNameLongLiteral;
3561
3887
3562
	if ((!dotPrefix) && (getNextChar('.'))) { //decimal part that can be empty
3888
	if ((!dotPrefix) && (getNextChar('.'))) { //decimal part that can be empty
3563
		while (getNextCharAsDigit()){/*empty*/}
3889
		consumeDigits(10, true);
3564
		floating = true;
3890
		floating = true;
3565
	}
3891
	}
3566
3892
Lines 3571-3577 Link Here
3571
		// consume next character
3897
		// consume next character
3572
		this.unicodeAsBackSlash = false;
3898
		this.unicodeAsBackSlash = false;
3573
		if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3899
		if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3574
			&& (this.source[this.currentPosition] == 'u')) {
3900
				&& (this.source[this.currentPosition] == 'u')) {
3575
			getNextUnicodeChar();
3901
			getNextUnicodeChar();
3576
		} else {
3902
		} else {
3577
			if (this.withoutUnicodePtr != 0) {
3903
			if (this.withoutUnicodePtr != 0) {
Lines 3580-3589 Link Here
3580
		}
3906
		}
3581
3907
3582
		if ((this.currentCharacter == '-')
3908
		if ((this.currentCharacter == '-')
3583
			|| (this.currentCharacter == '+')) { // consume next character
3909
				|| (this.currentCharacter == '+')) { // consume next character
3584
			this.unicodeAsBackSlash = false;
3910
			this.unicodeAsBackSlash = false;
3585
			if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3911
			if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
3586
				&& (this.source[this.currentPosition] == 'u')) {
3912
					&& (this.source[this.currentPosition] == 'u')) {
3587
				getNextUnicodeChar();
3913
				getNextUnicodeChar();
3588
			} else {
3914
			} else {
3589
				if (this.withoutUnicodePtr != 0) {
3915
				if (this.withoutUnicodePtr != 0) {
Lines 3591-3599 Link Here
3591
				}
3917
				}
3592
			}
3918
			}
3593
		}
3919
		}
3594
		if (!ScannerHelper.isDigit(this.currentCharacter))
3920
		if (!ScannerHelper.isDigit(this.currentCharacter)) {
3921
			if (this.currentCharacter == '_') {
3922
				// wrongly place '_'
3923
				consumeDigits(10);
3924
				throw new InvalidInputException(INVALID_UNDERSCORE);
3925
			}
3595
			throw new InvalidInputException(INVALID_FLOAT);
3926
			throw new InvalidInputException(INVALID_FLOAT);
3596
		while (getNextCharAsDigit()){/*empty*/}
3927
		}
3928
		consumeDigits(10, true);
3597
	}
3929
	}
3598
3930
3599
	if (getNextChar('d', 'D') >= 0)
3931
	if (getNextChar('d', 'D') >= 0)
Lines 3668-3674 Link Here
3668
		buffer.append(this.source, 0, this.startPosition);
4000
		buffer.append(this.source, 0, this.startPosition);
3669
	} else {
4001
	} else {
3670
		buffer.append("<source beginning>\n...\n"); //$NON-NLS-1$
4002
		buffer.append("<source beginning>\n...\n"); //$NON-NLS-1$
3671
		int line = Util.getLineNumber(this.startPosition-1000, this.lineEnds, 0, this.linePtr);
4003
		int line = Util.getLineNumber(this.startPosition-1000, this.lineEnds, 0, this.lineEnds.length);
3672
		int lineStart = getLineStart(line);
4004
		int lineStart = getLineStart(line);
3673
		buffer.append(this.source, lineStart, this.startPosition-lineStart);
4005
		buffer.append(this.source, lineStart, this.startPosition-lineStart);
3674
	}
4006
	}
Lines 3900-3919 Link Here
3900
}
4232
}
3901
public void unicodeInitializeBuffer(int length) {
4233
public void unicodeInitializeBuffer(int length) {
3902
	this.withoutUnicodePtr = length;
4234
	this.withoutUnicodePtr = length;
3903
    if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[length+(1+10)];
4235
	if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[length+(1+10)];
3904
    int bLength = this.withoutUnicodeBuffer.length;
4236
	int bLength = this.withoutUnicodeBuffer.length;
3905
    if (1+length >= bLength) {
4237
	if (1+length >= bLength) {
3906
        System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length + (1+10)], 0, bLength);
4238
		System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length + (1+10)], 0, bLength);
3907
    }
4239
	}
3908
	System.arraycopy(this.source, this.startPosition, this.withoutUnicodeBuffer, 1, length);
4240
	System.arraycopy(this.source, this.startPosition, this.withoutUnicodeBuffer, 1, length);
3909
}
4241
}
3910
public void unicodeStore() {
4242
public void unicodeStore() {
3911
	int pos = ++this.withoutUnicodePtr;
4243
	int pos = ++this.withoutUnicodePtr;
3912
    if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[10];
4244
	if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[10];
3913
    int length = this.withoutUnicodeBuffer.length;
4245
	int length = this.withoutUnicodeBuffer.length;
3914
    if (pos == length) {
4246
	if (pos == length) {
3915
        System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length * 2], 0, length);
4247
		System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length * 2], 0, length);
3916
    }
4248
	}
3917
	this.withoutUnicodeBuffer[pos] = this.currentCharacter;
4249
	this.withoutUnicodeBuffer[pos] = this.currentCharacter;
3918
}
4250
}
4251
public void unicodeStore(char character) {
4252
	int pos = ++this.withoutUnicodePtr;
4253
	if (this.withoutUnicodeBuffer == null) this.withoutUnicodeBuffer = new char[10];
4254
	int length = this.withoutUnicodeBuffer.length;
4255
	if (pos == length) {
4256
		System.arraycopy(this.withoutUnicodeBuffer, 0, this.withoutUnicodeBuffer = new char[length * 2], 0, length);
4257
	}
4258
	this.withoutUnicodeBuffer[pos] = character;
4259
}
3919
}
4260
}
(-)model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java (+70 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.ClassFormatException;
14
import org.eclipse.jdt.core.util.IConstantPool;
15
import org.eclipse.jdt.core.util.IExtendedAnnotation;
16
import org.eclipse.jdt.core.util.IRuntimeInvisibleTypeAnnotationsAttribute;
17
18
/**
19
 * Default implementation of IRuntimeInvisibleTypeAnnotations
20
 */
21
public class RuntimeInvisibleTypeAnnotationsAttribute
22
	extends ClassFileAttribute
23
	implements IRuntimeInvisibleTypeAnnotationsAttribute {
24
25
	private static final IExtendedAnnotation[] NO_ENTRIES = new IExtendedAnnotation[0];
26
	private int extendedAnnotationsNumber;
27
	private IExtendedAnnotation[] extendedAnnotations;
28
29
	/**
30
	 * Constructor for RuntimeInvisibleTypeAnnotations.
31
	 * @param classFileBytes
32
	 * @param constantPool
33
	 * @param offset
34
	 * @throws ClassFormatException
35
	 */
36
	public RuntimeInvisibleTypeAnnotationsAttribute(
37
			byte[] classFileBytes,
38
			IConstantPool constantPool,
39
			int offset)
40
			throws ClassFormatException {
41
		super(classFileBytes, constantPool, offset);
42
		// read extended annotations
43
		final int length = u2At(classFileBytes, 6, offset);
44
		this.extendedAnnotationsNumber = length;
45
		if (length != 0) {
46
			int readOffset = 8;
47
			this.extendedAnnotations = new IExtendedAnnotation[length];
48
			for (int i = 0; i < length; i++) {
49
				ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset);
50
				this.extendedAnnotations[i] = extendedAnnotation;
51
				readOffset += extendedAnnotation.sizeInBytes();
52
			}
53
		} else {
54
			this.extendedAnnotations = NO_ENTRIES;
55
		}
56
	}
57
58
	/* (non-Javadoc)
59
	 * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotations()
60
	 */
61
	public IExtendedAnnotation[] getExtendedAnnotations() {
62
		return this.extendedAnnotations;
63
	}
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotationsNumber()
66
	 */
67
	public int getExtendedAnnotationsNumber() {
68
		return this.extendedAnnotationsNumber;
69
	}
70
}
(-)model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java (+67 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.ClassFormatException;
14
import org.eclipse.jdt.core.util.IConstantPool;
15
import org.eclipse.jdt.core.util.IExtendedAnnotation;
16
import org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotationsAttribute;
17
18
/**
19
 * Default implementation of IRuntimeVisibleTypeAnnotations
20
 */
21
public class RuntimeVisibleTypeAnnotationsAttribute
22
	extends ClassFileAttribute
23
	implements IRuntimeVisibleTypeAnnotationsAttribute {
24
25
	private static final IExtendedAnnotation[] NO_ENTRIES = new IExtendedAnnotation[0];
26
	private int extendedAnnotationsNumber;
27
	private IExtendedAnnotation[] extendedAnnotations;
28
29
	/**
30
	 * Constructor for RuntimeVisibleTypeAnnotations.
31
	 * @param classFileBytes
32
	 * @param constantPool
33
	 * @param offset
34
	 * @throws ClassFormatException
35
	 */
36
	public RuntimeVisibleTypeAnnotationsAttribute(
37
			byte[] classFileBytes,
38
			IConstantPool constantPool,
39
			int offset) throws ClassFormatException {
40
		super(classFileBytes, constantPool, offset);
41
		final int length = u2At(classFileBytes, 6, offset);
42
		this.extendedAnnotationsNumber = length;
43
		if (length != 0) {
44
			int readOffset = 8;
45
			this.extendedAnnotations = new IExtendedAnnotation[length];
46
			for (int i = 0; i < length; i++) {
47
				ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset);
48
				this.extendedAnnotations[i] = extendedAnnotation;
49
				readOffset += extendedAnnotation.sizeInBytes();
50
			}
51
		} else {
52
			this.extendedAnnotations = NO_ENTRIES;
53
		}
54
	}
55
	/* (non-Javadoc)
56
	 * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotations#getAnnotations()
57
	 */
58
	public IExtendedAnnotation[] getExtendedAnnotations() {
59
		return this.extendedAnnotations;
60
	}
61
	/* (non-Javadoc)
62
	 * @see org.eclipse.jdt.core.util.IRuntimeVisibleTypeAnnotations#getAnnotationsNumber()
63
	 */
64
	public int getExtendedAnnotationsNumber() {
65
		return this.extendedAnnotationsNumber;
66
	}
67
}
(-)model/org/eclipse/jdt/internal/core/util/messages.properties (-1 / +23 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2000, 2010 IBM Corporation and others.
2
# Copyright (c) 2000, 2011 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 313-321 Link Here
313
disassembler_annotationarrayvalueend = ]
313
disassembler_annotationarrayvalueend = ]
314
disassembler_annotationentrystart = #{0} @{1}(
314
disassembler_annotationentrystart = #{0} @{1}(
315
disassembler_annotationentryend = )
315
disassembler_annotationentryend = )
316
# jsr308
317
disassembler_extendedannotationentrystart=#{0} @{1}(
318
disassembler_extendedannotationentryend= )
316
disassembler_annotationcomponent = #{0} {1}=
319
disassembler_annotationcomponent = #{0} {1}=
317
disassembler_runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\ 
320
disassembler_runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\ 
318
disassembler_runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\ 
321
disassembler_runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\ 
322
disassembler_runtimevisibletypeannotationsattributeheader= RuntimeVisibleTypeAnnotations:\ 
323
disassembler_runtimeinvisibletypeannotationsattributeheader= RuntimeInvisibleTypeAnnotations:\ 
319
disassembler_runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\ 
324
disassembler_runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\ 
320
disassembler_runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\ 
325
disassembler_runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\ 
321
disassembler_parameterannotationentrystart=Number of annotations for parameter {0}: {1}
326
disassembler_parameterannotationentrystart=Number of annotations for parameter {0}: {1}
Lines 332-337 Link Here
332
disassembler_frame_full_frame=[pc: {0}, full, stack: {4}, locals: {2}]
337
disassembler_frame_full_frame=[pc: {0}, full, stack: {4}, locals: {2}]
333
disassembler_frame_same_frame=[pc: {0}, same]
338
disassembler_frame_same_frame=[pc: {0}, same]
334
disassembler_frame_same_locals_1_stack_item=[pc: {0}, same_locals_1_stack_item, stack: {1}]
339
disassembler_frame_same_locals_1_stack_item=[pc: {0}, same_locals_1_stack_item, stack: {1}]
340
341
# jsr 308
342
disassembler_extendedannotation_targetType=target type = 0x{0} {1}
343
disassembler_extendedannotation_classextendsimplements=type index = {0}
344
disassembler_extendedannotation_locations=locations = {0}
345
disassembler_extendedannotation_method_parameter=method parameter index = {0}
346
disassembler_extendedannotation_offset=offset = {0}
347
disassembler_extendedannotation_throws=throws index = {0}
348
disassembler_extendedannotation_type_argument=type argument index = {0}
349
disassembler_extendedannotation_type_parameter=type parameter index = {0}
350
disassembler_extendedannotation_type_parameter_with_bound=type parameter index = {0} type parameter bound index = {1}
351
disassembler_extendedannotation_wildcardlocationtype=wildcard location type = 0x{0} {1}
352
disassembler_extendedannotation_wildcardlocations=wildcard locations = {0}
353
disassembler_localvariabletargetheader=local variable entries:
354
335
### classfileformat decoding
355
### classfileformat decoding
336
classfileformat_versiondetails =\ (version {0} : {1}.{2}, {3})
356
classfileformat_versiondetails =\ (version {0} : {1}.{2}, {3})
337
classfileformat_methoddescriptor = // Method descriptor #{0} {1}
357
classfileformat_methoddescriptor = // Method descriptor #{0} {1}
Lines 379-384 Link Here
379
classfileformat_exceptiontableentry = [pc: {0}, pc: {1}] -> {2} when : {3}
399
classfileformat_exceptiontableentry = [pc: {0}, pc: {1}] -> {2} when : {3}
380
classfileformat_linenumbertableentry = [pc: {0}, line: {1}]
400
classfileformat_linenumbertableentry = [pc: {0}, line: {1}]
381
classfileformat_localvariabletableentry = [pc: {0}, pc: {1}] local: {2} index: {3} type: {4}
401
classfileformat_localvariabletableentry = [pc: {0}, pc: {1}] local: {2} index: {3} type: {4}
402
# jsr 308
403
classfileformat_localvariablereferenceinfoentry=[pc: {0}, pc: {1}] index: {2}
382
404
383
### Eclipse Java Core completion messages.
405
### Eclipse Java Core completion messages.
384
engine_completing = Computing proposals...
406
engine_completing = Computing proposals...
(-)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
(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java (-19 / +17 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 213-257 Link Here
213
	super.consumeCastExpressionLL1();
213
	super.consumeCastExpressionLL1();
214
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
214
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
215
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
215
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
216
		if (castExpression.type instanceof TypeReference) {
216
		this.patternLocator.match(castExpression.type, this.nodeSet);
217
			this.patternLocator.match((TypeReference) castExpression.type, this.nodeSet);
218
        }
219
	}
217
	}
220
}
218
}
221
protected void consumeCastExpressionWithGenericsArray() {
219
protected void consumeCastExpressionWithGenericsArray() {
222
	super.consumeCastExpressionWithGenericsArray();
220
	super.consumeCastExpressionWithGenericsArray();
223
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
221
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
224
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
222
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
225
		if (castExpression.type instanceof Reference) {
223
		this.patternLocator.match(castExpression.type, this.nodeSet);
226
			this.patternLocator.match((Reference) castExpression.type, this.nodeSet);
227
        }
228
	}
224
	}
229
}
225
}
230
protected void consumeCastExpressionWithNameArray() {
226
protected void consumeCastExpressionWithNameArray() {
231
	super.consumeCastExpressionWithNameArray();
227
	super.consumeCastExpressionWithNameArray();
232
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
228
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
233
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
229
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
234
		if (castExpression.type instanceof Reference) {
230
		this.patternLocator.match(castExpression.type, this.nodeSet);
235
			this.patternLocator.match((Reference) castExpression.type, this.nodeSet);
231
 	}
236
        }
237
	}
238
}
232
}
239
protected void consumeCastExpressionWithPrimitiveType() {
233
protected void consumeCastExpressionWithPrimitiveType() {
240
	super.consumeCastExpressionWithPrimitiveType();
234
	super.consumeCastExpressionWithPrimitiveType();
241
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
235
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
242
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
236
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
243
		if (castExpression.type instanceof Reference) {
237
		this.patternLocator.match(castExpression.type, this.nodeSet);
244
			this.patternLocator.match((Reference) castExpression.type, this.nodeSet);
245
        }
246
	}
238
	}
247
}
239
}
248
protected void consumeCastExpressionWithQualifiedGenericsArray() {
240
protected void consumeCastExpressionWithQualifiedGenericsArray() {
249
	super.consumeCastExpressionWithQualifiedGenericsArray();
241
	super.consumeCastExpressionWithQualifiedGenericsArray();
250
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
242
	if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) {
251
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
243
		CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr];
252
		if (castExpression.type instanceof Reference) {
244
		this.patternLocator.match(castExpression.type, this.nodeSet);
253
			this.patternLocator.match((Reference) castExpression.type, this.nodeSet);
254
        }
255
	}
245
	}
256
}
246
}
257
247
Lines 739-746 Link Here
739
		this.nodeSet.addTrustedMatch(result, true);
729
		this.nodeSet.addTrustedMatch(result, true);
740
	return result;
730
	return result;
741
}
731
}
742
protected TypeReference getTypeReference(int dim) {
732
protected TypeReference copyDims(TypeReference typeRef, int dim, Annotation [][] annotationsOnDimensions) {
743
	TypeReference typeRef = super.getTypeReference(dim);
733
	TypeReference result = super.copyDims(typeRef, dim, annotationsOnDimensions);
734
	 if (this.nodeSet.removePossibleMatch(typeRef) != null)
735
		this.nodeSet.addPossibleMatch(result);
736
	 else if (this.nodeSet.removeTrustedMatch(typeRef) != null)
737
		this.nodeSet.addTrustedMatch(result, true);
738
	return result;
739
}
740
protected TypeReference getUnannotatedTypeReference(int dim) {
741
	TypeReference typeRef = super.getUnannotatedTypeReference(dim);
744
	if (this.patternFineGrain == 0) {
742
	if (this.patternFineGrain == 0) {
745
		this.patternLocator.match(typeRef, this.nodeSet); // NB: Don't check container since type reference can happen anywhere
743
		this.patternLocator.match(typeRef, this.nodeSet); // NB: Don't check container since type reference can happen anywhere
746
	}
744
	}
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-21 / +26 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 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 2172-2182 Link Here
2172
			"  public static final x;\n" +
2172
			"  public static final x;\n" +
2173
			"}",
2173
			"}",
2174
		},
2174
		},
2175
		"----------\n" +
2175
		"----------\n" + 
2176
		"1. ERROR in p\\X.java (at line 3)\n" +
2176
		"1. ERROR in p\\X.java (at line 3)\n" + 
2177
		"	public static final x;\n" +
2177
		"	public static final x;\n" + 
2178
		"	              ^^^^^\n" +
2178
		"	                    ^\n" + 
2179
		"Syntax error on token \"final\", invalid Type\n" +
2179
		"Syntax error, insert \"Identifier (\" to complete MethodHeaderName\n" + 
2180
		"----------\n" + 
2181
		"2. ERROR in p\\X.java (at line 3)\n" + 
2182
		"	public static final x;\n" + 
2183
		"	                    ^\n" + 
2184
		"Syntax error, insert \")\" to complete MethodDeclaration\n" + 
2180
		"----------\n"
2185
		"----------\n"
2181
	);
2186
	);
2182
}
2187
}
Lines 4812-4832 Link Here
4812
			"  }\n" +
4817
			"  }\n" +
4813
			"}",
4818
			"}",
4814
		},
4819
		},
4815
		"----------\n" +
4820
		"----------\n" + 
4816
		"1. ERROR in p\\NA.java (at line 7)\n" +
4821
		"1. ERROR in p\\NA.java (at line 7)\n" + 
4817
		"	(new Class1).run();\n" +
4822
		"	(new Class1).run();\n" + 
4818
		"	 ^^^\n" +
4823
		"	     ^^^^^^\n" + 
4819
		"Syntax error on token \"new\", delete this token\n" +
4824
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
4820
		"----------\n" +
4825
		"----------\n" + 
4821
		"2. ERROR in p\\NA.java (at line 8)\n" +
4826
		"2. ERROR in p\\NA.java (at line 8)\n" + 
4822
		"	(new Class2).run();\n" +
4827
		"	(new Class2).run();\n" + 
4823
		"	 ^^^\n" +
4828
		"	     ^^^^^^\n" + 
4824
		"Syntax error on token \"new\", delete this token\n" +
4829
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
4825
		"----------\n" +
4830
		"----------\n" + 
4826
		"3. ERROR in p\\NA.java (at line 9)\n" +
4831
		"3. ERROR in p\\NA.java (at line 9)\n" + 
4827
		"	(new Class3).run();\n" +
4832
		"	(new Class3).run();\n" + 
4828
		"	 ^^^\n" +
4833
		"	     ^^^^^^\n" + 
4829
		"Syntax error on token \"new\", delete this token\n" +
4834
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
4830
		"----------\n"
4835
		"----------\n"
4831
	);
4836
	);
4832
}
4837
}
(-)src/org/eclipse/jdt/core/tests/compiler/parser/AbstractTypeAnnotationSyntaxTest.java (+643 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.compiler.parser;
12
13
import java.io.BufferedReader;
14
import java.io.File;
15
import java.io.FileInputStream;
16
import java.io.FileOutputStream;
17
import java.io.IOException;
18
import java.io.InputStreamReader;
19
import java.io.OutputStreamWriter;
20
import java.util.HashMap;
21
import java.util.Locale;
22
import java.util.Map;
23
24
import org.eclipse.jdt.core.compiler.CategorizedProblem;
25
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
26
import org.eclipse.jdt.core.tests.util.CompilerTestSetup;
27
import org.eclipse.jdt.core.tests.util.Util;
28
import org.eclipse.jdt.internal.codeassist.complete.CompletionParser;
29
import org.eclipse.jdt.internal.codeassist.select.SelectionParser;
30
import org.eclipse.jdt.internal.compiler.ASTVisitor;
31
import org.eclipse.jdt.internal.compiler.CompilationResult;
32
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
33
import org.eclipse.jdt.internal.compiler.DocumentElementParser;
34
import org.eclipse.jdt.internal.compiler.IDocumentElementRequestor;
35
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
36
import org.eclipse.jdt.internal.compiler.SourceElementParser;
37
import org.eclipse.jdt.internal.compiler.ast.Annotation;
38
import org.eclipse.jdt.internal.compiler.ast.Argument;
39
import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
40
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
41
import org.eclipse.jdt.internal.compiler.ast.Expression;
42
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
43
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
44
import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
45
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
46
import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
47
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
48
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
49
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
50
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
51
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
52
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
53
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
54
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
55
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
56
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
57
import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
58
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
59
import org.eclipse.jdt.internal.compiler.parser.Parser;
60
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
61
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
62
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
63
import org.eclipse.jdt.internal.core.search.indexing.IndexingParser;
64
import org.eclipse.jdt.internal.core.util.CommentRecorderParser;
65
66
public abstract class AbstractTypeAnnotationSyntaxTest extends AbstractCompilerTest implements IDocumentElementRequestor, ISourceElementRequestor {
67
	static final class LocationPrinterVisitor extends ASTVisitor {
68
		Annotation[] primaryAnnotations;
69
		TypeReference enclosingReference;
70
		Map locations;
71
72
		public LocationPrinterVisitor() {
73
			this.locations = new HashMap();
74
		}
75
76
		public Map getLocations() {
77
			return this.locations;
78
		}
79
		public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
80
			Annotation[] annotations = fieldDeclaration.annotations;
81
			this.enclosingReference = fieldDeclaration.type;
82
			this.primaryAnnotations = annotations;
83
			return true;
84
		}
85
		public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
86
			this.primaryAnnotations = methodDeclaration.annotations;
87
			TypeReference returnType = methodDeclaration.returnType;
88
			if (returnType != null) {
89
				this.enclosingReference = returnType;
90
				returnType.traverse(this, scope);
91
			}
92
			if (methodDeclaration.thrownExceptions != null) {
93
				int thrownExceptionsLength = methodDeclaration.thrownExceptions.length;
94
				for (int i = 0; i < thrownExceptionsLength; i++) {
95
					TypeReference typeReference = methodDeclaration.thrownExceptions[i];
96
					this.enclosingReference = typeReference;
97
					this.primaryAnnotations = null;
98
					typeReference.traverse(this, scope);
99
				}
100
			}
101
			return false;
102
		}
103
		public boolean visit(Argument argument, ClassScope scope) {
104
			Annotation[] annotations = argument.annotations;
105
			this.enclosingReference = argument.type;
106
			this.primaryAnnotations = annotations;
107
			return true;
108
		}
109
		public boolean visit(Argument argument, BlockScope scope) {
110
			Annotation[] annotations = argument.annotations;
111
			this.enclosingReference = argument.type;
112
			this.primaryAnnotations = annotations;
113
			return true;
114
		}
115
		public boolean visit(MarkerAnnotation annotation, BlockScope scope) {
116
			if (this.enclosingReference != null) {
117
				storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null));
118
			}
119
			return false;
120
		}
121
		public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
122
			if (this.enclosingReference != null) {
123
				storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null));
124
			}
125
			return false;
126
		}
127
		public boolean visit(NormalAnnotation annotation, BlockScope scope) {
128
			if (this.enclosingReference != null) {
129
				storeLocations(annotation, Annotation.getLocations(this.enclosingReference, this.primaryAnnotations, annotation, null));
130
			}
131
			return false;
132
		}
133
		public void storeLocations(Annotation annotation, int[] tab) {
134
			String key = String.valueOf(annotation);
135
			if (this.locations.get(key) != null) {
136
				return;
137
			}
138
			if (tab == null) {
139
				this.locations.put(key, null);
140
				return;
141
			}
142
			StringBuffer buffer = new StringBuffer("{");
143
			for (int i = 0, max = tab.length; i < max; i++) {
144
				if (i > 0) {
145
					buffer.append(',');
146
				}
147
				buffer.append(tab[i]);
148
			}
149
			buffer.append('}');
150
			this.locations.put(key, String.valueOf(buffer));
151
		}
152
153
		public boolean visit(ArrayTypeReference arrayReference, BlockScope scope) {
154
			if (this.enclosingReference == null) return false;
155
			return true;
156
		}
157
		public boolean visit(ParameterizedSingleTypeReference typeReference, BlockScope scope) {
158
			if (this.enclosingReference == null) return false;
159
			return true;
160
		}
161
		public boolean visit(SingleTypeReference typeReference, BlockScope scope) {
162
			if (this.enclosingReference == null) return false;
163
			return true;
164
		}
165
	}
166
	protected static String  jsr308TestScratchArea = "c:\\Jsr308TestScratchArea";
167
	protected static final int CHECK_PARSER = 0x1;
168
	protected static final int CHECK_COMPLETION_PARSER = 0x2;
169
	protected static final int CHECK_SELECTION_PARSER = 0x4;
170
	protected static final int CHECK_DOCUMENT_ELEMENT_PARSER = 0x8;
171
	protected static final int CHECK_COMMENT_RECORDER_PARSER = 0x10;
172
	protected static final int CHECK_SOURCE_ELEMENT_PARSER = 0x20;
173
	protected static final int CHECK_INDEXING_PARSER = 0x40;
174
	protected static final int CHECK_JAVAC_PARSER = 0x80;
175
	protected static int CHECK_ALL = (CHECK_PARSER | CHECK_COMPLETION_PARSER | CHECK_SELECTION_PARSER |
176
											CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER |
177
											CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER);
178
	public static final String compiler = "C:\\jdk-7-ea-bin-b75-windows-i586-30_oct_2009\\jdk7\\bin\\javac.exe";
179
	public static boolean optimizeStringLiterals = false;
180
181
182
183
public void initialize(CompilerTestSetup setUp) {
184
	super.initialize(setUp);
185
}
186
public AbstractTypeAnnotationSyntaxTest(String testName){
187
	super(testName);
188
	if ((new File(compiler).exists())) {
189
		File f = new File(jsr308TestScratchArea);
190
		if (!f.exists()) {
191
			f.mkdir();
192
		}
193
		if (f.exists()) {
194
			try {
195
				OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Marker.java")));
196
				w.write("@interface Marker {}\n".toCharArray());
197
				w.close();
198
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Normal.java")));
199
				w.write("@interface Normal {\n\tint value() default 10;\n}\n".toCharArray());
200
				w.close();
201
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "SingleMember.java")));
202
				w.write("@interface SingleMember {\n\tint value() default 10;\n}\n".toCharArray());
203
				w.close();
204
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Positive.java")));
205
				w.write("@interface Positive {}\n".toCharArray());
206
				w.close();
207
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Negative.java")));
208
				w.write("@interface Negative{}\n".toCharArray());
209
				w.close();
210
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "Readonly.java")));
211
				w.write("@interface Readonly {}\n".toCharArray());
212
				w.close();
213
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "NonNull.java")));
214
				w.write("@interface NonNull {}\n".toCharArray());
215
				w.close();
216
				w = new OutputStreamWriter(new FileOutputStream(new File(jsr308TestScratchArea + File.separator + "HashMap.java")));
217
				w.write("class HashMap<X,Y> {\n class Iterator {}; \n}\n".toCharArray());
218
				w.close();
219
				CHECK_ALL |= CHECK_JAVAC_PARSER;
220
			} catch (IOException e) {
221
				// ignore
222
			}
223
		}
224
	}
225
}
226
public void checkParse(
227
		int parserToCheck,
228
		char[] source,
229
		String expectedSyntaxErrorDiagnosis,
230
		String testName, String expectedUnitToString,
231
		ASTVisitor visitor) throws IOException {
232
233
	CompilerOptions options = new CompilerOptions(getCompilerOptions());
234
	options.complianceLevel = ClassFileConstants.JDK1_7;
235
	options.sourceLevel = ClassFileConstants.JDK1_7;
236
	options.targetJDK = ClassFileConstants.JDK1_7;
237
238
	ICompilationUnit sourceUnit = null;
239
	CompilationResult compilationResult = null;
240
	CompilationUnitDeclaration unit = null;
241
242
	if ((parserToCheck & CHECK_JAVAC_PARSER) != 0) {
243
		String javaFilePath = jsr308TestScratchArea + "\\Xyz.java";
244
		File f = new File(javaFilePath);
245
		FileOutputStream o = new FileOutputStream(f);
246
		OutputStreamWriter w = new OutputStreamWriter(o);
247
		w.write(source);
248
		w.close();
249
		Process p = Runtime.getRuntime().exec (new String[] { compiler, "-sourcepath", jsr308TestScratchArea, javaFilePath }, null, new File(jsr308TestScratchArea));
250
		try {
251
			BufferedReader stdout  = new BufferedReader(new InputStreamReader(p.getInputStream()));
252
			BufferedReader stderr  = new BufferedReader(new InputStreamReader(p.getErrorStream()));
253
			String line;
254
			while ((line = stderr.readLine())!= null)
255
				System.out.println(line);
256
			while ((line = stdout.readLine())!= null)
257
				System.out.println(line);
258
			assertTrue("javac unhappy", p.waitFor() == 0);
259
		} catch (InterruptedException e) {
260
			System.err.println("Skipped javac behavior check due to interrupt...");
261
		}
262
	}
263
	if ((parserToCheck & CHECK_PARSER) != 0) {
264
		Parser parser1 =
265
			new Parser(
266
					new ProblemReporter(
267
							DefaultErrorHandlingPolicies.proceedWithAllProblems(),
268
							options,
269
							new DefaultProblemFactory(Locale.getDefault())),
270
							optimizeStringLiterals);
271
		sourceUnit = new CompilationUnit(source, testName, null);
272
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
273
		unit = parser1.parse(sourceUnit, compilationResult);
274
		parser1.getMethodBodies(unit);
275
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
276
		assertParseTreeEquals(expectedUnitToString, unit.toString());
277
		if (visitor != null) {
278
			unit.traverse(visitor, (CompilationUnitScope) null);
279
		}
280
		parser1 = null;
281
	}
282
283
	if ((parserToCheck & CHECK_COMPLETION_PARSER) != 0) {
284
		CompletionParser parser2 = new CompletionParser(
285
				new ProblemReporter(
286
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
287
						options,
288
						new DefaultProblemFactory(Locale.getDefault())),
289
						false);
290
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
291
		unit = parser2.parse(sourceUnit, compilationResult, Integer.MAX_VALUE);
292
		parser2.getMethodBodies(unit);
293
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
294
		assertParseTreeEquals(expectedUnitToString, unit.toString());
295
		parser2 = null;
296
	}
297
	if ((parserToCheck & CHECK_SELECTION_PARSER) != 0) {
298
		SelectionParser parser3 = new SelectionParser(
299
				new ProblemReporter(
300
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
301
						options,
302
						new DefaultProblemFactory(Locale.getDefault())));
303
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
304
		unit = parser3.parse(sourceUnit, compilationResult, Integer.MAX_VALUE, Integer.MAX_VALUE);
305
		parser3.getMethodBodies(unit);
306
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
307
		assertParseTreeEquals(expectedUnitToString, unit.toString());
308
		parser3 = null;
309
	}
310
	if ((parserToCheck & CHECK_DOCUMENT_ELEMENT_PARSER) != 0) {
311
		DocumentElementParser parser4 = new DocumentElementParser(
312
				this,
313
				new DefaultProblemFactory(Locale.getDefault()),
314
				options);
315
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
316
		unit = parser4.parse(sourceUnit, compilationResult);
317
		parser4.getMethodBodies(unit);
318
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
319
		assertParseTreeEquals(expectedUnitToString, unit.toString());
320
		parser4 = null;
321
	}
322
	if ((parserToCheck & CHECK_COMMENT_RECORDER_PARSER) != 0) {
323
		CommentRecorderParser parser5 = new CommentRecorderParser(
324
				new ProblemReporter(
325
						DefaultErrorHandlingPolicies.proceedWithAllProblems(),
326
						options,
327
						new DefaultProblemFactory(Locale.getDefault())),
328
						optimizeStringLiterals);
329
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
330
		unit = parser5.parse(sourceUnit, compilationResult);
331
		parser5.getMethodBodies(unit);
332
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
333
		assertParseTreeEquals(expectedUnitToString, unit.toString());
334
		parser5 = null;
335
	}
336
	if ((parserToCheck & CHECK_SOURCE_ELEMENT_PARSER) != 0) {
337
		SourceElementParser parser6 = new SourceElementParser(this,
338
				new DefaultProblemFactory(Locale.getDefault()),
339
				options,
340
				true,
341
				optimizeStringLiterals);
342
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
343
		unit = parser6.parse(sourceUnit, compilationResult);
344
		parser6.getMethodBodies(unit);
345
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
346
		assertParseTreeEquals(expectedUnitToString, unit.toString());
347
		parser6 = null;
348
	}
349
	if ((parserToCheck & CHECK_INDEXING_PARSER) != 0) {
350
		IndexingParser parser7 = new IndexingParser(this,
351
				new DefaultProblemFactory(Locale.getDefault()),
352
				options,
353
				true,
354
				optimizeStringLiterals, false);
355
		compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
356
		unit = parser7.parse(sourceUnit, compilationResult);
357
		parser7.getMethodBodies(unit);
358
		assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult);
359
		assertParseTreeEquals(expectedUnitToString, unit.toString());
360
		parser7 = null;
361
	}
362
}
363
public void checkParse(
364
		int parserToCheck,
365
		char[] source,
366
		String expectedSyntaxErrorDiagnosis,
367
		String testName,
368
		String expectedUnitToString) throws IOException {
369
	checkParse(parserToCheck, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, null);
370
}
371
public void checkParse(
372
		char[] source,
373
		String expectedSyntaxErrorDiagnosis,
374
		String testName, String expectedUnitToString) throws IOException {
375
	checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString);
376
}
377
public void checkParse(
378
		char[] source,
379
		String expectedSyntaxErrorDiagnosis,
380
		String testName, String expectedUnitToString,
381
		ASTVisitor visitor) throws IOException {
382
	checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, visitor);
383
}
384
private void assertParseTreeEquals(String expectedUnitToString, String computedUnitToString) {
385
		if (expectedUnitToString == null) {  // just checking that we are able to digest.
386
			return;
387
		}
388
		if (!expectedUnitToString.equals(computedUnitToString)) {
389
			System.out.println(Util.displayString(computedUnitToString));
390
		}
391
		assertEquals("Parse Tree is wrong",
392
				Util.convertToIndependantLineDelimiter(expectedUnitToString),
393
				Util.convertToIndependantLineDelimiter(computedUnitToString));
394
}
395
private void assertDianosticEquals(String expectedSyntaxErrorDiagnosis,
396
		String testName, CompilationResult compilationResult) {
397
	String computedSyntaxErrorDiagnosis = getCompilerMessages(compilationResult);
398
	assertEquals(
399
		"Invalid syntax error diagnosis" + testName,
400
		Util.convertToIndependantLineDelimiter(expectedSyntaxErrorDiagnosis),
401
		Util.convertToIndependantLineDelimiter(computedSyntaxErrorDiagnosis));
402
}
403
private String getCompilerMessages(CompilationResult compilationResult) {
404
	StringBuffer buffer = new StringBuffer(100);
405
	if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
406
		CategorizedProblem[] problems = compilationResult.getAllProblems();
407
		int count = problems.length;
408
		int problemCount = 0;
409
		char[] unitSource = compilationResult.compilationUnit.getContents();
410
		for (int i = 0; i < count; i++) {
411
			if (problems[i] != null) {
412
				if (problemCount == 0)
413
					buffer.append("----------\n");
414
				problemCount++;
415
				buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING"));
416
				buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\'));
417
				try {
418
					buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource));
419
					buffer.append("\n");
420
					buffer.append(problems[i].getMessage());
421
					buffer.append("\n");
422
				} catch (Exception e) {
423
				}
424
				buffer.append("----------\n");
425
			}
426
		}
427
	}
428
	String computedSyntaxErrorDiagnosis = buffer.toString();
429
	return computedSyntaxErrorDiagnosis;
430
}
431
432
void traverse (File f) throws IOException {
433
if (f.isDirectory()) {
434
	File [] files = f.listFiles();
435
	for (int i = 0; i < files.length; i++) {
436
		traverse(files[i]);
437
	}
438
} else {
439
	if (f.getName().endsWith(".java")) {
440
		System.out.println(f.getCanonicalPath());
441
		char [] contents = new char[(int) f.length()];
442
		FileInputStream fs = new FileInputStream(f);
443
		InputStreamReader isr = new InputStreamReader(fs);
444
		isr.read(contents);
445
		checkParse(contents, null, f.getCanonicalPath(), null);
446
	}
447
}
448
}
449
public void _test000() throws IOException {
450
traverse(new File("C:\\jsr308tests"));
451
}
452
453
public void acceptImport(int declarationStart, int declarationEnd,
454
		int[] javaDocPositions, char[] name, int nameStartPosition,
455
		boolean onDemand, int modifiers) {
456
457
458
}
459
public void acceptInitializer(int declarationStart, int declarationEnd,
460
		int[] javaDocPositions, int modifiers, int modifiersStart,
461
		int bodyStart, int bodyEnd) {
462
463
464
}
465
public void acceptLineSeparatorPositions(int[] positions) {
466
467
468
}
469
public void acceptPackage(int declarationStart, int declarationEnd,
470
		int[] javaDocPositions, char[] name, int nameStartPosition) {
471
472
473
}
474
public void acceptProblem(CategorizedProblem problem) {
475
476
477
}
478
public void enterClass(int declarationStart, int[] javaDocPositions,
479
		int modifiers, int modifiersStart, int classStart, char[] name,
480
		int nameStart, int nameEnd, char[] superclass, int superclassStart,
481
		int superclassEnd, char[][] superinterfaces,
482
		int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
483
484
485
}
486
public void enterCompilationUnit() {
487
488
489
}
490
public void enterConstructor(int declarationStart, int[] javaDocPositions,
491
		int modifiers, int modifiersStart, char[] name, int nameStart,
492
		int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts,
493
		int[] parameterTypeEnds, char[][] parameterNames,
494
		int[] parameterNameStarts, int[] parameterNameEnds, int parametersEnd,
495
		char[][] exceptionTypes, int[] exceptionTypeStarts,
496
		int[] exceptionTypeEnds, int bodyStart) {
497
498
499
}
500
public void enterField(int declarationStart, int[] javaDocPositions,
501
		int modifiers, int modifiersStart, char[] type, int typeStart,
502
		int typeEnd, int typeDimensionCount, char[] name, int nameStart,
503
		int nameEnd, int extendedTypeDimensionCount,
504
		int extendedTypeDimensionEnd) {
505
506
507
}
508
public void enterInterface(int declarationStart, int[] javaDocPositions,
509
		int modifiers, int modifiersStart, int interfaceStart, char[] name,
510
		int nameStart, int nameEnd, char[][] superinterfaces,
511
		int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
512
513
514
}
515
public void enterMethod(int declarationStart, int[] javaDocPositions,
516
		int modifiers, int modifiersStart, char[] returnType,
517
		int returnTypeStart, int returnTypeEnd, int returnTypeDimensionCount,
518
		char[] name, int nameStart, int nameEnd, char[][] parameterTypes,
519
		int[] parameterTypeStarts, int[] parameterTypeEnds,
520
		char[][] parameterNames, int[] parameterNameStarts,
521
		int[] parameterNameEnds, int parametersEnd,
522
		int extendedReturnTypeDimensionCount,
523
		int extendedReturnTypeDimensionEnd, char[][] exceptionTypes,
524
		int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart) {
525
526
527
}
528
public void exitClass(int bodyEnd, int declarationEnd) {
529
530
531
}
532
public void exitCompilationUnit(int declarationEnd) {
533
534
535
}
536
public void exitConstructor(int bodyEnd, int declarationEnd) {
537
538
539
}
540
public void exitField(int bodyEnd, int declarationEnd) {
541
542
543
}
544
public void exitInterface(int bodyEnd, int declarationEnd) {
545
546
547
}
548
public void exitMethod(int bodyEnd, int declarationEnd) {
549
550
551
}
552
public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart,
553
		int sourceEnd) {
554
555
556
}
557
public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) {
558
559
560
}
561
public void acceptConstructorReference(char[] typeName, int argCount,
562
		int sourcePosition) {
563
564
565
}
566
public void acceptFieldReference(char[] fieldName, int sourcePosition) {
567
568
569
}
570
public void acceptImport(int declarationStart, int declarationEnd,
571
		int nameStart, int nameEnd,
572
		char[][] tokens, boolean onDemand, int modifiers) {
573
574
575
}
576
public void acceptMethodReference(char[] methodName, int argCount,
577
		int sourcePosition) {
578
579
580
}
581
public void acceptPackage(ImportReference importReference) {
582
583
584
}
585
public void acceptTypeReference(char[][] typeName, int sourceStart,
586
		int sourceEnd) {
587
588
589
}
590
public void acceptTypeReference(char[] typeName, int sourcePosition) {
591
592
593
}
594
public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {
595
596
597
}
598
public void acceptUnknownReference(char[] name, int sourcePosition) {
599
600
601
}
602
public void enterConstructor(MethodInfo methodInfo) {
603
604
605
}
606
public void enterField(FieldInfo fieldInfo) {
607
608
609
}
610
public void enterInitializer(int declarationStart, int modifiers) {
611
612
613
}
614
public void enterMethod(MethodInfo methodInfo) {
615
616
617
}
618
public void enterType(TypeInfo typeInfo) {
619
620
621
}
622
public void exitConstructor(int declarationEnd) {
623
624
625
}
626
public void exitField(int initializationStart, int declarationEnd,
627
		int declarationSourceEnd) {
628
629
630
}
631
public void exitInitializer(int declarationEnd) {
632
633
634
}
635
public void exitMethod(int declarationEnd, Expression defaultValue) {
636
637
638
}
639
public void exitType(int declarationEnd) {
640
641
642
}
643
}
(-)src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java (-27 / +72 lines)
Lines 33-48 Link Here
33
	return ComplianceDiagnoseTest.class;
33
	return ComplianceDiagnoseTest.class;
34
}
34
}
35
public void runComplianceParserTest(
35
public void runComplianceParserTest(
36
	String[] testFiles,
36
		String[] testFiles,
37
	String expected13ProblemLog,
37
		String expected13ProblemLog,
38
	String expected14ProblemLog,
38
		String expected14ProblemLog,
39
	String expected15ProblemLog){
39
		String expected15ProblemLog){
40
	runComplianceParserTest(
41
			testFiles,
42
			expected13ProblemLog,
43
			expected14ProblemLog,
44
			expected15ProblemLog,
45
			expected15ProblemLog,
46
			expected15ProblemLog);
47
}
48
public void runComplianceParserTest(
49
		String[] testFiles,
50
		String expected13ProblemLog,
51
		String expected14ProblemLog,
52
		String expected15ProblemLog,
53
		String expected16ProblemLog,
54
		String expected17ProblemLog){
40
	if(this.complianceLevel == ClassFileConstants.JDK1_3) {
55
	if(this.complianceLevel == ClassFileConstants.JDK1_3) {
41
		this.runNegativeTest(testFiles, expected13ProblemLog);
56
		this.runNegativeTest(testFiles, expected13ProblemLog);
42
	} else if(this.complianceLevel == ClassFileConstants.JDK1_4) {
57
	} else if(this.complianceLevel == ClassFileConstants.JDK1_4) {
43
		this.runNegativeTest(testFiles, expected14ProblemLog);
58
		this.runNegativeTest(testFiles, expected14ProblemLog);
44
	} else if(this.complianceLevel >= ClassFileConstants.JDK1_5) {
59
	} else if(this.complianceLevel == ClassFileConstants.JDK1_5) {
45
		this.runNegativeTest(testFiles, expected15ProblemLog);
60
		this.runNegativeTest(testFiles, expected15ProblemLog);
61
	} else if(this.complianceLevel == ClassFileConstants.JDK1_6) {
62
		this.runNegativeTest(testFiles, expected16ProblemLog);
63
	} else if(this.complianceLevel >= ClassFileConstants.JDK1_7) {
64
		this.runNegativeTest(testFiles, expected17ProblemLog);
46
	}
65
	}
47
}
66
}
48
public void test0001() {
67
public void test0001() {
Lines 1461-1481 Link Here
1461
		expected13ProblemLog;
1480
		expected13ProblemLog;
1462
1481
1463
	String expected15ProblemLog =
1482
	String expected15ProblemLog =
1464
		"----------\n" +
1483
		"----------\n" + 
1465
		"1. WARNING in X.java (at line 1)\n" +
1484
		"1. WARNING in X.java (at line 1)\n" + 
1466
		"	public class X <T1 extends String, T2 extends Y {\n" +
1485
		"	public class X <T1 extends String, T2 extends Y {\n" + 
1467
		"	                           ^^^^^^\n" +
1486
		"	                           ^^^^^^\n" + 
1468
		"The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" +
1487
		"The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + 
1469
		"----------\n" +
1488
		"----------\n" + 
1470
		"2. ERROR in X.java (at line 1)\n" +
1489
		"2. ERROR in X.java (at line 1)\n" + 
1471
		"	public class X <T1 extends String, T2 extends Y {\n" +
1490
		"	public class X <T1 extends String, T2 extends Y {\n" + 
1472
		"	                                              ^\n" +
1491
		"	                                              ^\n" + 
1473
		"Syntax error, insert \">\" to complete ReferenceType1\n" +
1492
		"Syntax error, insert \"AdditionalBoundList1\" to complete TypeParameter1\n" + 
1474
		"----------\n" +
1493
		"----------\n" + 
1475
		"3. ERROR in X.java (at line 1)\n" +
1494
		"3. ERROR in X.java (at line 1)\n" + 
1476
		"	public class X <T1 extends String, T2 extends Y {\n" +
1495
		"	public class X <T1 extends String, T2 extends Y {\n" + 
1477
		"	                                              ^\n" +
1496
		"	                                              ^\n" + 
1478
		"Y cannot be resolved to a type\n" +
1497
		"Y cannot be resolved to a type\n" + 
1479
		"----------\n";
1498
		"----------\n";
1480
1499
1481
	runComplianceParserTest(
1500
	runComplianceParserTest(
Lines 1738-1749 Link Here
1738
		"	                          ^^\n" +
1757
		"	                          ^^\n" +
1739
		"Syntax error on token \"T2\", delete this token\n" +
1758
		"Syntax error on token \"T2\", delete this token\n" +
1740
		"----------\n";
1759
		"----------\n";
1760
	
1761
	String expected16ProblemLog =
1762
		expected15ProblemLog;
1763
	
1764
	String expected17ProblemLog =
1765
		"----------\n" + 
1766
		"1. ERROR in X.java (at line 2)\n" + 
1767
		"	public <T1 extends String T2> int foo(){\n" + 
1768
		"	                   ^^^^^^\n" + 
1769
		"Syntax error on token \"String\", strictfp expected\n" + 
1770
		"----------\n";
1741
1771
1742
	runComplianceParserTest(
1772
	runComplianceParserTest(
1743
		testFiles,
1773
		testFiles,
1744
		expected13ProblemLog,
1774
		expected13ProblemLog,
1745
		expected14ProblemLog,
1775
		expected14ProblemLog,
1746
		expected15ProblemLog
1776
		expected15ProblemLog,
1777
		expected16ProblemLog,
1778
		expected17ProblemLog
1747
	);
1779
	);
1748
}
1780
}
1749
public void test0039() {
1781
public void test0039() {
Lines 1801-1807 Link Here
1801
		"----------\n" +
1833
		"----------\n" +
1802
		"1. ERROR in X.java (at line 2)\n" +
1834
		"1. ERROR in X.java (at line 2)\n" +
1803
		"	Z <Y1, Y2 var;\n" +
1835
		"	Z <Y1, Y2 var;\n" +
1804
		"	  ^^^^^^^\n" +
1836
		"	^^^^^^\n" +
1805
		"Syntax error on token(s), misplaced construct(s)\n" +
1837
		"Syntax error on token(s), misplaced construct(s)\n" +
1806
		"----------\n" +
1838
		"----------\n" +
1807
		"2. ERROR in X.java (at line 2)\n" +
1839
		"2. ERROR in X.java (at line 2)\n" +
Lines 1844-1851 Link Here
1844
		"----------\n" +
1876
		"----------\n" +
1845
		"1. ERROR in X.java (at line 2)\n" +
1877
		"1. ERROR in X.java (at line 2)\n" +
1846
		"	Z <Y1, for Y2> var;\n" +
1878
		"	Z <Y1, for Y2> var;\n" +
1847
		"	  ^^^^^^^^^^^^\n" +
1879
		"	^^^^^^^^^^^^^^\n" +
1848
		"Syntax error on tokens, delete these tokens\n" +
1880
		"Syntax error on tokens, Type expected instead\n" +
1849
		"----------\n";
1881
		"----------\n";
1850
	String expected14ProblemLog =
1882
	String expected14ProblemLog =
1851
		expected13ProblemLog;
1883
		expected13ProblemLog;
Lines 1857-1868 Link Here
1857
		"	       ^^^\n" +
1889
		"	       ^^^\n" +
1858
		"Syntax error on token \"for\", delete this token\n" +
1890
		"Syntax error on token \"for\", delete this token\n" +
1859
		"----------\n";
1891
		"----------\n";
1860
1892
	
1893
	String expected16ProblemLog =
1894
		expected15ProblemLog;
1895
	
1896
	String expected17ProblemLog =
1897
		"----------\n" + 
1898
		"1. ERROR in X.java (at line 2)\n" + 
1899
		"	Z <Y1, for Y2> var;\n" + 
1900
		"	       ^^^\n" + 
1901
		"Syntax error on token \"for\", final expected\n" + 
1902
		"----------\n";
1903
		
1861
	runComplianceParserTest(
1904
	runComplianceParserTest(
1862
		testFiles,
1905
		testFiles,
1863
		expected13ProblemLog,
1906
		expected13ProblemLog,
1864
		expected14ProblemLog,
1907
		expected14ProblemLog,
1865
		expected15ProblemLog
1908
		expected15ProblemLog,
1909
		expected16ProblemLog,
1910
		expected17ProblemLog
1866
	);
1911
	);
1867
}
1912
}
1868
public void test0042() {
1913
public void test0042() {
Lines 2238-2244 Link Here
2238
		"2. ERROR in X.java (at line 6)\n" +
2283
		"2. ERROR in X.java (at line 6)\n" +
2239
		"	public @MyAnn(\"\",\"\") class Test {		\n" +
2284
		"	public @MyAnn(\"\",\"\") class Test {		\n" +
2240
		"	                ^\n" +
2285
		"	                ^\n" +
2241
		"Syntax error on token \",\", < expected\n" +
2286
		"Syntax error on token \",\", > expected\n" +
2242
		"----------\n" +
2287
		"----------\n" +
2243
		"3. ERROR in X.java (at line 6)\n" +
2288
		"3. ERROR in X.java (at line 6)\n" +
2244
		"	public @MyAnn(\"\",\"\") class Test {		\n" +
2289
		"	public @MyAnn(\"\",\"\") class Test {		\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java (-36 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 2527-2546 Link Here
2527
		"}\n";
2527
		"}\n";
2528
2528
2529
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString;
2529
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString;
2530
	if (this.complianceLevel <= ClassFileConstants.JDK1_4) {
2530
	
2531
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
2531
	expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
2532
			"public class WB2 {\n" +
2532
			"public class WB2 {\n" +
2533
			"  public WB2() {\n" +
2533
			"  public WB2() {\n" +
2534
			"    super();\n" +
2534
			"    super();\n" +
2535
			"  }\n" +
2535
			"  }\n" +
2536
			"  public void foo() {\n" +
2536
			"  public void foo() {\n" +
2537
			"    java.util.Locale.java.util.Vector $missing$;\n" +
2537
			"    java.util.Locale $missing$;\n" + 
2538
			"    java.util.Locale java;\n" +
2538
			"  }\n" +
2539
			"  }\n" +
2539
			"}\n";
2540
			"}\n";
2540
	} else {
2541
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
2542
			expectedDietPlusBodyUnitToString;
2543
	}
2544
2541
2545
	String expectedFullUnitToString = expectedDietUnitToString;
2542
	String expectedFullUnitToString = expectedDietUnitToString;
2546
2543
Lines 4642-4655 Link Here
4642
		"        super();\n" +
4639
		"        super();\n" +
4643
		"      }\n" +
4640
		"      }\n" +
4644
		"      int hello() {\n" +
4641
		"      int hello() {\n" +
4645
		"        fo = $missing$;\n" +
4642
		"        fo $missing$;\n" + 
4646
		"      }\n" +
4643
		"      }\n" +
4647
		"      int world() {\n" +
4644
		"      int world() {\n" +
4648
		"      }\n" +
4645
		"      }\n" +
4649
		"      void foo() {\n" +
4646
		"      void foo() {\n" +
4650
		"      }\n" +
4647
		"      }\n" +
4651
		"    }\n" +
4648
		"    }\n" +
4652
		"    ba = $missing$;\n" +
4649
		"    ba $missing$;\n" + 
4653
		"  }\n" +
4650
		"  }\n" +
4654
		"}\n";
4651
		"}\n";
4655
4652
Lines 4831-4845 Link Here
4831
		"  public Hanoi(int numberOfDisks) {\n" +
4828
		"  public Hanoi(int numberOfDisks) {\n" +
4832
		"  }\n" +
4829
		"  }\n" +
4833
		"  private void solve(int depth, Post start, Post free, Post end) {\n" +
4830
		"  private void solve(int depth, Post start, Post free, Post end) {\n" +
4834
		"    if ((depth == 1))\n" +
4831
		"    if ((depth == 1))\n" + 
4835
		"        moveDisk(start, end);\n" +
4832
		"        moveDisk(start, end);\n" + 
4836
		"    else\n" +
4833
		"    else\n" + 
4837
		"        if ((depth > 1))\n" +
4834
		"        if ((depth > 1))\n" + 
4838
		"            {\n" +
4835
		"            {\n" + 
4839
		"              sol = $missing$;\n" +
4836
		"              sol $missing$;\n" + 
4840
		"            }\n" +
4837
		"            }\n" + 
4841
		"        else\n" +
4838
		"        else\n" + 
4842
		"            ;\n" +
4839
		"            ;\n" + 
4843
		"  }\n" +
4840
		"  }\n" +
4844
		"}\n";
4841
		"}\n";
4845
4842
Lines 5991-5997 Link Here
5991
		"    restricts breakpoint;\n" +
5988
		"    restricts breakpoint;\n" +
5992
		"    given thread;\n" +
5989
		"    given thread;\n" +
5993
		"    any other;\n" +
5990
		"    any other;\n" +
5994
		"    specified = $missing$;\n" +
5991
		"    specified $missing$;\n" + 
5995
		"  }\n" +
5992
		"  }\n" +
5996
		"  public void removeThreadFilter(IJavaThread thread) {\n" +
5993
		"  public void removeThreadFilter(IJavaThread thread) {\n" +
5997
		"    removes the;\n" +
5994
		"    removes the;\n" +
Lines 6000-6006 Link Here
6000
		"    request as;\n" +
5997
		"    request as;\n" +
6001
		"    does not;\n" +
5998
		"    does not;\n" +
6002
		"    the removal;\n" +
5999
		"    the removal;\n" +
6003
		"    thread = $missing$;\n" +
6000
		"    thread $missing$;\n" + 
6004
		"  }\n" +
6001
		"  }\n" +
6005
		"  public IJavaThread[] getThreadFilters() {\n" +
6002
		"  public IJavaThread[] getThreadFilters() {\n" +
6006
		"    return the;\n" +
6003
		"    return the;\n" +
Lines 7598-7615 Link Here
7598
		"}\n";
7595
		"}\n";
7599
7596
7600
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null;
7597
	String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null;
7601
	if(this.complianceLevel <= ClassFileConstants.JDK1_4) {
7598
	if(this.complianceLevel <= ClassFileConstants.JDK1_6) {
7602
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
7599
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
7603
			"public class Test {\n" +
7600
			"public class Test {\n" +
7604
			"  public Test() {\n" +
7601
			"  public Test() {\n" +
7605
			"    super();\n" +
7602
			"    super();\n" +
7606
			"  }\n" +
7603
			"  }\n" +
7607
			"  void aMethod() {\n" +
7604
			"  void aMethod() {\n" +
7605
			"    public static void $missing$;\n" + 
7608
			"    m1();\n" +
7606
			"    m1();\n" +
7609
			"    {\n" +
7607
			"    {\n" +
7610
			"      int a;\n" +
7608
			"      int a;\n" +
7611
			"      int b;\n" +
7609
			"      int b;\n" +
7612
			"    }\n" +
7610
			"    }\n" +
7611
			"    public static void $missing$;\n" + 
7613
			"    m2();\n" +
7612
			"    m2();\n" +
7614
			"    {\n" +
7613
			"    {\n" +
7615
			"      int c;\n" +
7614
			"      int c;\n" +
Lines 7619-7640 Link Here
7619
			"}\n";
7618
			"}\n";
7620
	} else {
7619
	} else {
7621
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
7620
		expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
7622
			"public class Test {\n" +
7621
			"public class Test {\n" + 
7623
			"  public Test() {\n" +
7622
			"  public Test() {\n" + 
7624
			"    super();\n" +
7623
			"    super();\n" + 
7625
			"  }\n" +
7624
			"  }\n" + 
7626
			"  void aMethod() {\n" +
7625
			"  void aMethod() {\n" + 
7627
			"    public static @m1() enum $missing$ {\n" +
7626
			"    public static void @$missing$() [] m1;\n" + 
7628
			"      public $missing$() {\n" +
7627
			"    {\n" + 
7629
			"        super();\n" +
7628
			"      int a;\n" + 
7630
			"      }\n" +
7629
			"      int b;\n" + 
7631
			"      <clinit>() {\n" +
7630
			"    }\n" + 
7632
			"      }\n" +
7631
			"    public static void @$missing$() [] m2;\n" + 
7633
			"    }\n" +
7632
			"    {\n" + 
7634
			"  }\n" +
7633
			"      int c;\n" + 
7634
			"      int d;\n" + 
7635
			"    }\n" + 
7636
			"  }\n" + 
7635
			"}\n";
7637
			"}\n";
7636
	}
7638
	}
7637
7639
	
7638
	String expectedFullUnitToString =
7640
	String expectedFullUnitToString =
7639
		"public class Test {\n" +
7641
		"public class Test {\n" +
7640
		"  public Test() {\n" +
7642
		"  public Test() {\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java (-25 / +35 lines)
Lines 71-86 Link Here
71
			"	}\n" +
71
			"	}\n" +
72
			"}\n"
72
			"}\n"
73
		},
73
		},
74
		"----------\n" +
74
		"----------\n" + 
75
		"1. ERROR in X.java (at line 3)\n" +
75
		"1. ERROR in X.java (at line 3)\n" + 
76
		"	throws new X\n" +
76
		"	throws new X\n" + 
77
		"	^^^^^^\n" +
77
		"	^^^^^^\n" + 
78
		"Syntax error on token \"throws\", throw expected\n" +
78
		"Syntax error on token \"throws\", throw expected\n" + 
79
		"----------\n" +
79
		"----------\n" + 
80
		"2. ERROR in X.java (at line 3)\n" +
80
		"2. ERROR in X.java (at line 3)\n" + 
81
		"	throws new X\n" +
81
		"	throws new X\n" + 
82
		"	           ^\n" +
82
		"	           ^\n" + 
83
		"Syntax error, unexpected end of method\n" +
83
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
84
		"----------\n" + 
85
		"3. ERROR in X.java (at line 3)\n" + 
86
		"	throws new X\n" + 
87
		"	           ^\n" + 
88
		"Syntax error, insert \";\" to complete BlockStatements\n" + 
84
		"----------\n"
89
		"----------\n"
85
	);
90
	);
86
}
91
}
Lines 130-145 Link Here
130
			"	}\n" +
135
			"	}\n" +
131
			"}\n"
136
			"}\n"
132
		},
137
		},
133
		"----------\n" +
138
		"----------\n" + 
134
		"1. ERROR in X.java (at line 3)\n" +
139
		"1. ERROR in X.java (at line 3)\n" + 
135
		"	throws new X\n" +
140
		"	throws new X\n" + 
136
		"	^^^^^^\n" +
141
		"	^^^^^^\n" + 
137
		"Syntax error on token \"throws\", throw expected\n" +
142
		"Syntax error on token \"throws\", throw expected\n" + 
138
		"----------\n" +
143
		"----------\n" + 
139
		"2. ERROR in X.java (at line 3)\n" +
144
		"2. ERROR in X.java (at line 3)\n" + 
140
		"	throws new X\n" +
145
		"	throws new X\n" + 
141
		"	           ^\n" +
146
		"	           ^\n" + 
142
		"Syntax error, unexpected end of initializer\n" +
147
		"Syntax error, insert \"Dimensions\" to complete Expression\n" + 
148
		"----------\n" + 
149
		"3. ERROR in X.java (at line 3)\n" + 
150
		"	throws new X\n" + 
151
		"	           ^\n" + 
152
		"Syntax error, insert \";\" to complete BlockStatements\n" + 
143
		"----------\n"
153
		"----------\n"
144
	);
154
	);
145
}
155
}
Lines 238-248 Link Here
238
			"   public void bar(){}\n" +
248
			"   public void bar(){}\n" +
239
			"}\n"
249
			"}\n"
240
		},
250
		},
241
		"----------\n" +
251
		"----------\n" + 
242
		"1. ERROR in X.java (at line 2)\n" +
252
		"1. ERROR in X.java (at line 2)\n" + 
243
		"	public void foo(X, Object o, String s) {\n" +
253
		"	public void foo(X, Object o, String s) {\n" + 
244
		"	                 ^\n" +
254
		"	                ^\n" + 
245
		"Syntax error on token \",\", . expected\n" +
255
		"Syntax error, insert \"VariableDeclaratorId\" to complete FormalParameterList\n" + 
246
		"----------\n"
256
		"----------\n"
247
	);
257
	);
248
}
258
}
(-)src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java (-17 / +22 lines)
Lines 166-182 Link Here
166
		"1. ERROR in <parenthesis mismatch> (at line 3)\n" +
166
		"1. ERROR in <parenthesis mismatch> (at line 3)\n" +
167
		"	[ arg1, 						\n" +
167
		"	[ arg1, 						\n" +
168
		"	^\n" +
168
		"	^\n" +
169
		"Syntax error on token \"[\", invalid Type\n" +
169
		"Syntax error on token \"[\", float expected\n" +
170
		"----------\n" +
170
		"----------\n" +
171
		"2. ERROR in <parenthesis mismatch> (at line 4)\n" +
171
		"2. ERROR in <parenthesis mismatch> (at line 4)\n" +
172
		"	{ arg2, ]						\n" +
172
		"	{ arg2, ]						\n" +
173
		"	^\n" +
173
		"	^\n" +
174
		"Syntax error on token \"{\", invalid Type\n" +
174
		"Syntax error on token \"{\", float expected\n" +
175
		"----------\n" +
175
		"----------\n" +
176
		"3. ERROR in <parenthesis mismatch> (at line 4)\n" +
176
		"3. ERROR in <parenthesis mismatch> (at line 4)\n" +
177
		"	{ arg2, ]						\n" +
177
		"	{ arg2, ]						\n" +
178
		"	        ^\n" +
178
		"	        ^\n" +
179
		"Syntax error on token \"]\", invalid Type\n" +
179
		"Syntax error on token \"]\", float expected\n" +
180
		"----------\n" +
180
		"----------\n" +
181
		"4. ERROR in <parenthesis mismatch> (at line 5)\n" +
181
		"4. ERROR in <parenthesis mismatch> (at line 5)\n" +
182
		"	arg3, 						\n" +
182
		"	arg3, 						\n" +
Lines 273-279 Link Here
273
		"1. ERROR in <test> (at line 3)\n"+
273
		"1. ERROR in <test> (at line 3)\n"+
274
		"	i; 									\n"+
274
		"	i; 									\n"+
275
		"	^\n"+
275
		"	^\n"+
276
		"Syntax error, insert \"AssignmentOperator Expression\" to complete Expression\n"+
276
		"Syntax error, insert \"VariableDeclarators\" to complete LocalVariableDeclaration\n" +
277
		"----------\n";
277
		"----------\n";
278
278
279
	String testName = "<test>";
279
	String testName = "<test>";
Lines 399-405 Link Here
399
}
399
}
400
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339
400
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339
401
public void test12() {
401
public void test12() {
402
403
	String s =
402
	String s =
404
		"package a;										\n"+
403
		"package a;										\n"+
405
		"public interface Test {						\n"+
404
		"public interface Test {						\n"+
Lines 407-424 Link Here
407
		"    System.out.println();						\n"+
406
		"    System.out.println();						\n"+
408
		"}												\n";
407
		"}												\n";
409
408
410
	String expectedSyntaxErrorDiagnosis =
409
	String expectedSyntaxErrorDiagnosis = this.complianceLevel < ClassFileConstants.JDK1_7
411
		"----------\n"+
410
		? 	"----------\n"+
412
		"1. ERROR in <test> (at line 3)\n"+
411
			"1. ERROR in <test> (at line 3)\n"+
413
		"	public void myMethod()						\n"+
412
			"	public void myMethod()						\n"+
414
		"	                     ^\n"+
413
			"	                     ^\n"+
415
		"Syntax error on token \")\", { expected after this token\n"+
414
			"Syntax error on token \")\", { expected after this token\n"+
416
		"----------\n"+
415
			"----------\n"+
417
		"2. ERROR in <test> (at line 5)\n"+
416
			"2. ERROR in <test> (at line 5)\n"+
418
		"	}												\n"+
417
			"	}												\n"+
419
		"	^\n"+
418
			"	^\n"+
420
		"Syntax error, insert \"}\" to complete InterfaceBody\n"+
419
			"Syntax error, insert \"}\" to complete InterfaceBody\n"+
421
		"----------\n";
420
			"----------\n"
421
		: 	"----------\n" + 
422
			"1. ERROR in <test> (at line 3)\n"+
423
			"	public void myMethod()						\n"+
424
			"	                     ^\n"+
425
			"Syntax error on token \")\", @ expected after this token\n"+
426
			"----------\n";
422
427
423
	String testName = "<test>";
428
	String testName = "<test>";
424
	checkParse(
429
	checkParse(
(-)src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java (+3629 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.compiler.parser;
12
13
import java.io.IOException;
14
import java.util.Map;
15
import junit.framework.Test;
16
import org.eclipse.jdt.core.tests.util.CompilerTestSetup;
17
18
public class TypeAnnotationSyntaxTest extends AbstractTypeAnnotationSyntaxTest {
19
20
	public static Class testClass() {
21
		return TypeAnnotationSyntaxTest.class;
22
	}
23
	public void initialize(CompilerTestSetup setUp) {
24
		super.initialize(setUp);
25
	}
26
	public static Test suite() {
27
		return buildMinimalComplianceTestSuite(testClass(), F_1_7);
28
	}
29
public TypeAnnotationSyntaxTest(String testName){
30
	super(testName);
31
}
32
33
static {
34
//	TESTS_NAMES = new String[] { "test0038", "test0039", "test0040a" };
35
//	TESTS_NUMBERS = new int[] { 133, 134, 135 };
36
}
37
38
public void test0001() throws IOException {
39
	String source = "@Marker class A extends String {}\n;" +
40
					"@Marker class B extends @Marker String {}\n" +
41
					"@Marker class C extends @Marker @SingleMember(0) String {}\n" +
42
					"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
43
					"@Marker class E extends String {}\n;";
44
45
	String expectedUnitToString = 
46
		"@Marker class A extends String {\n" + 
47
		"  A() {\n" + 
48
		"    super();\n" + 
49
		"  }\n" + 
50
		"}\n" + 
51
		"@Marker class B extends @Marker String {\n" + 
52
		"  B() {\n" + 
53
		"    super();\n" + 
54
		"  }\n" + 
55
		"}\n" + 
56
		"@Marker class C extends @Marker @SingleMember(0) String {\n" + 
57
		"  C() {\n" + 
58
		"    super();\n" + 
59
		"  }\n" + 
60
		"}\n" + 
61
		"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + 
62
		"  D() {\n" + 
63
		"    super();\n" + 
64
		"  }\n" + 
65
		"}\n" + 
66
		"@Marker class E extends String {\n" + 
67
		"  E() {\n" + 
68
		"    super();\n" + 
69
		"  }\n" + 
70
		"}\n";
71
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString);
72
}
73
public void test0002() throws IOException {
74
	String source = "class A extends String {}\n;" +
75
					"class B extends @Marker String {}\n" +
76
					"class C extends @Marker @SingleMember(0) String {}\n" +
77
					"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
78
					"class E extends String {}\n;";
79
    
80
	String expectedUnitToString = 
81
		"class A extends String {\n" + 
82
		"  A() {\n" + 
83
		"    super();\n" + 
84
		"  }\n" + 
85
		"}\n" + 
86
		"class B extends @Marker String {\n" + 
87
		"  B() {\n" + 
88
		"    super();\n" + 
89
		"  }\n" + 
90
		"}\n" + 
91
		"class C extends @Marker @SingleMember(0) String {\n" + 
92
		"  C() {\n" + 
93
		"    super();\n" + 
94
		"  }\n" + 
95
		"}\n" + 
96
		"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" + 
97
		"  D() {\n" + 
98
		"    super();\n" + 
99
		"  }\n" + 
100
		"}\n" + 
101
		"class E extends String {\n" + 
102
		"  E() {\n" + 
103
		"    super();\n" + 
104
		"  }\n" + 
105
		"}\n";
106
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0002", expectedUnitToString);
107
}
108
public void test0003() throws IOException {
109
	String source = "@Marker class A implements Comparable, " +
110
					"                   @Marker Serializable," +
111
					"                   Cloneable {\n" +
112
					"}\n";
113
	String expectedUnitToString = 
114
		"@Marker class A implements Comparable, @Marker Serializable, Cloneable {\n" + 
115
		"  A() {\n" + 
116
		"    super();\n" + 
117
		"  }\n" + 
118
		"}\n";
119
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0003", expectedUnitToString);
120
}
121
public void test0004() throws IOException {
122
	String source = "@Marker class A implements Comparable, " +
123
					"                   @Marker @SingleMember(0) Serializable," +
124
					"                   Cloneable {\n" +
125
					"}\n";
126
	String expectedUnitToString = 
127
		"@Marker class A implements Comparable, @Marker @SingleMember(0) Serializable, Cloneable {\n" + 
128
		"  A() {\n" + 
129
		"    super();\n" + 
130
		"  }\n" + 
131
		"}\n";
132
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0004", expectedUnitToString);
133
}
134
public void test0005() throws IOException {
135
	String source = "@Marker class A implements Comparable, " +
136
					"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
137
					"                   Cloneable {\n" +
138
					"}\n";
139
	String expectedUnitToString = 
140
		"@Marker class A implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
141
		"  A() {\n" + 
142
		"    super();\n" + 
143
		"  }\n" + 
144
		"}\n";
145
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0005", expectedUnitToString);
146
}
147
public void test0006() throws IOException {
148
	String source = "@Marker class A implements @Marker Comparable, " +
149
					"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
150
					"                   @Marker Cloneable {\n" +
151
					"}\n";
152
	String expectedUnitToString = 
153
		"@Marker class A implements @Marker Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, @Marker Cloneable {\n" +
154
		"  A() {\n" + 
155
		"    super();\n" + 
156
		"  }\n" + 
157
		"}\n";
158
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0006", expectedUnitToString);
159
}
160
public void test007() throws IOException {
161
	String source = "@Marker class A extends Object implements Comparable, " +
162
					"                   @Marker @SingleMember(10) @Normal(Value=0) Serializable," +
163
					"                   Cloneable {\n" +
164
					"}\n";
165
	String expectedUnitToString = 
166
		"@Marker class A extends Object implements Comparable, @Marker @SingleMember(10) @Normal(Value = 0) Serializable, Cloneable {\n" +
167
		"  A() {\n" + 
168
		"    super();\n" + 
169
		"  }\n" + 
170
		"}\n";
171
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0007", expectedUnitToString);
172
}
173
public void test0008() throws IOException {
174
	String source = "@Marker class A extends @Marker Object implements Comparable, " +
175
					"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
176
					"                   Cloneable {\n" +
177
					"}\n";
178
	String expectedUnitToString = 
179
		"@Marker class A extends @Marker Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
180
		"  A() {\n" + 
181
		"    super();\n" + 
182
		"  }\n" + 
183
		"}\n";
184
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0008", expectedUnitToString);
185
}
186
public void test0009() throws IOException {
187
	String source = "@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, " +
188
	"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
189
	"                   Cloneable {\n" +
190
	"}\n";
191
	String expectedUnitToString = 
192
		"@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
193
		"  A() {\n" + 
194
		"    super();\n" + 
195
		"  }\n" + 
196
		"}\n";
197
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0009", expectedUnitToString);
198
}
199
public void test0010() throws IOException {
200
	String source = "@Marker class A extends @Marker @SingleMember(0) @Normal(Value=0) Object implements Comparable, " +
201
	"                   @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
202
	"                   Cloneable {\n" +
203
	"}\n";
204
	String expectedUnitToString = 
205
		"@Marker class A extends @Marker @SingleMember(0) @Normal(Value = 0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
206
		"  A() {\n" + 
207
		"    super();\n" + 
208
		"  }\n" + 
209
		"}\n";
210
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0010", expectedUnitToString);
211
}
212
public void test0011() throws IOException {
213
	String source = "public class A {\n" +
214
					"    int[] f[];\n" +
215
					"    @Marker String[] @Marker[][] s[] @SingleMember(0)[][] @Normal(Value = 0)[][];\n" +
216
					"    float[] p[];\n" +
217
					"}\n";
218
	String expectedUnitToString = 
219
		"public class A {\n" + 
220
		"  int[][] f;\n" + 
221
		"  @Marker String[] @Marker [][][] @SingleMember(0) [][] @Normal(Value = 0) [][] s;\n" + 
222
		"  float[][] p;\n" + 
223
		"  public A() {\n" + 
224
		"    super();\n" + 
225
		"  }\n" + 
226
		"}\n";
227
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0011", expectedUnitToString);
228
}
229
public void test0012() throws IOException {
230
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
231
					"    int[] f[];\n" +
232
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
233
					"    float[] p[];\n" +
234
					"public static void main(String args[]) {\n" +
235
					"    @Readonly String @Nullable[] @NonNull[] s;\n" +
236
					"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
237
					"}\n" +
238
					"}\n";
239
	String expectedUnitToString = 
240
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
241
		"  int[][] f;\n" + 
242
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
243
		"  float[][] p;\n" + 
244
		"  public A() {\n" + 
245
		"    super();\n" + 
246
		"  }\n" + 
247
		"  public static void main(String[] args) {\n" + 
248
		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
249
		"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
250
		"  }\n" + 
251
		"}\n";
252
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0012", expectedUnitToString);
253
}
254
public void test0013() throws IOException {
255
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
256
					"    int[] f[];\n" +
257
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
258
					"    float[] p[];\n" +
259
					"public static void main(String args[]) {\n" +
260
					"    @Readonly String s;\n" +
261
					"	 s = new @Readonly String @NonNull[] @Nullable[] { {\"Hello\"}, {\"World\"}} [0][0];\n" +
262
					"}\n" +
263
					"}\n";
264
	String expectedUnitToString = 
265
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
266
		"  int[][] f;\n" + 
267
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
268
		"  float[][] p;\n" + 
269
		"  public A() {\n" + 
270
		"    super();\n" + 
271
		"  }\n" + 
272
		"  public static void main(String[] args) {\n" + 
273
		"    @Readonly String s;\n" + 
274
		"    s = new @Readonly String @NonNull [] @Nullable []{{\"Hello\"}, {\"World\"}}[0][0];\n" + 
275
		"  }\n" + 
276
		"}\n";
277
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0013", expectedUnitToString);
278
}
279
public void test0014() throws IOException {
280
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
281
					"    int[] f[];\n" +
282
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
283
					"    float[] p[];\n" +
284
					"public static int main(String args[])[] @Marker[][] @Marker @SingleMember(0) @Normal(Value=0)[][] @Marker {\n" +
285
					"    @Readonly String @Nullable[] @NonNull[] s;\n" +
286
					"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
287
					"}\n" +
288
					"}\n";
289
	String expectedUnitToString = 
290
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
291
		"  int[][] f;\n" + 
292
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
293
		"  float[][] p;\n" + 
294
		"  public A() {\n" + 
295
		"    super();\n" + 
296
		"  }\n" + 
297
		"  public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker {\n" +
298
		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
299
		"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
300
		"  }\n" + 
301
		"}\n";
302
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0014", expectedUnitToString);
303
304
}
305
public void test0015() throws IOException {
306
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
307
					"    int[] f[];\n" +
308
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
309
					"    float[] p[];\n" +
310
					"public static int main(String args[])[] @Marker[][] @Marker @SingleMember(0) @Normal(Value=0)[][] @Marker {\n" +
311
					"    @Readonly String @Nullable[] @NonNull[] s;\n" +
312
					"    s = new @Readonly String @NonNull[5] @Nullable[];\n" +
313
					"}\n" +
314
					"@Marker public A () @Marker @SingleMember(0) @Normal(Value=10) {}\n" +
315
					"}\n";
316
	String expectedUnitToString = 
317
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
318
		"  int[][] f;\n" + 
319
		"  @English String[] @NonNull [][] @Nullable [][] s;\n" + 
320
		"  float[][] p;\n" + 
321
		"  public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) @Marker {\n" + 
322
		"    @Readonly String @Nullable [] @NonNull [] s;\n" + 
323
		"    s = new @Readonly String @NonNull [5] @Nullable [];\n" + 
324
		"  }\n" + 
325
		"  public @Marker A() @Marker @SingleMember(0) @Normal(Value = 10) {\n" + 
326
		"    super();\n" + 
327
		"  }\n" + 
328
		"}\n";
329
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0015", expectedUnitToString);
330
}
331
// parameters
332
public void test0016() throws IOException {
333
	String source = "public class A {\n" +
334
					"@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" +
335
					"}\n" +
336
					"}";
337
	String expectedUnitToString = 
338
		"public class A {\n" + 
339
		"  public A() {\n" + 
340
		"    super();\n" + 
341
		"  }\n" + 
342
		"  public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
343
		"  }\n" + 
344
		"}\n";
345
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0016", expectedUnitToString);
346
}
347
public void test0017() throws IOException  {
348
	String source = "public class A {\n" +
349
					"@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" +
350
					"}\n" +
351
					"}";
352
	String expectedUnitToString = 
353
		"public class A {\n" + 
354
		"  public A() {\n" + 
355
		"    super();\n" + 
356
		"  }\n" + 
357
		"  public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
358
		"  }\n" + 
359
		"}\n";
360
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0017", expectedUnitToString);
361
}
362
public void test0018() throws IOException {
363
	String source = "public class A {\n" +
364
					"@Marker public int[] @Marker[][] main(HashMap<String, Object>[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] @Marker {\n" +
365
					"}\n" +
366
					"}";
367
	String expectedUnitToString = 
368
		"public class A {\n" + 
369
		"  public A() {\n" + 
370
		"    super();\n" + 
371
		"  }\n" + 
372
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
373
		"  }\n" + 
374
		"}\n";
375
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0018", expectedUnitToString);
376
}
377
public void test0019() throws IOException {
378
	String source = "public class A {\n" +
379
					"@Marker public int[] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][] args[] @Normal(Value = 10) [][])[] @Marker [][] @Marker {\n" +
380
					"}\n" +
381
					"}";
382
	String expectedUnitToString = 
383
		"public class A {\n" + 
384
		"  public A() {\n" + 
385
		"    super();\n" + 
386
		"  }\n" + 
387
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) @Marker {\n" + 
388
		"  }\n" + 
389
		"}\n";
390
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0019", expectedUnitToString);
391
}
392
// varargs annotation
393
public void test0020() throws IOException {
394
	String source = "public class A {\n" +
395
					"@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
396
					"}\n" +
397
					"}";
398
	String expectedUnitToString = 
399
		"public class A {\n" + 
400
		"  public A() {\n" + 
401
		"    super();\n" + 
402
		"  }\n" + 
403
		"  public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
404
		"  }\n" + 
405
		"}\n";
406
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0020", expectedUnitToString);
407
}
408
public void test0021() throws IOException {
409
	String source = "public class A {\n" +
410
					"@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
411
					"}\n" +
412
					"}";
413
	String expectedUnitToString = 
414
		"public class A {\n" + 
415
		"  public A() {\n" + 
416
		"    super();\n" + 
417
		"  }\n" + 
418
		"  public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
419
		"  }\n" + 
420
		"}\n";
421
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0021", expectedUnitToString);
422
}
423
public void test0022() throws IOException {
424
	String source = "public class A {\n" +
425
					"@Marker public int[] @Marker[][] main(HashMap<Integer,String>[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
426
					"}\n" +
427
					"}";
428
	String expectedUnitToString = 
429
		"public class A {\n" + 
430
		"  public A() {\n" + 
431
		"    super();\n" + 
432
		"  }\n" + 
433
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
434
		"  }\n" + 
435
		"}\n";
436
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0022", expectedUnitToString);
437
}
438
public void test0023() throws IOException {
439
	String source = "public class A {\n" +
440
					"@Marker public int[] @Marker[][] main(HashMap<Integer,String>.Iterator[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] @Marker {\n" +
441
					"}\n" +
442
					"}";
443
	String expectedUnitToString = 
444
		"public class A {\n" + 
445
		"  public A() {\n" + 
446
		"    super();\n" + 
447
		"  }\n" + 
448
		"  public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>.Iterator[] @SingleMember(10) [][] @Marker ... args) @Marker {\n" + 
449
		"  }\n" + 
450
		"}\n";
451
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0023", expectedUnitToString);
452
}
453
// local variables
454
public void test0024() throws IOException {
455
	String source = "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
456
					"public static void main(String args[]) {\n" +
457
					"    int[] f[];\n" +
458
					"    @English String[] @NonNull[] s[] @Nullable[][];\n" +
459
					"    float[] p[];\n" +
460
					"}\n" +
461
					"}\n";
462
	String expectedUnitToString = 
463
		"public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" + 
464
		"  public A() {\n" + 
465
		"    super();\n" + 
466
		"  }\n" + 
467
		"  public static void main(String[] args) {\n" + 
468
		"    int[][] f;\n" + 
469
		"    @English String[] @NonNull [][] @Nullable [][] s;\n" + 
470
		"    float[][] p;\n" + 
471
		"  }\n" + 
472
		"}\n";
473
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0024", expectedUnitToString);
474
}
475
// type parameter
476
public void test0025() throws IOException {
477
	String source = "class A {\n" +
478
					"public <Integer, @Positive Integer, @Negative Integer, Integer> void foo() {\n" +
479
					"}\n" +
480
					"}\n";
481
	String expectedUnitToString = 
482
		"class A {\n" + 
483
		"  A() {\n" + 
484
		"    super();\n" + 
485
		"  }\n" +
486
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>void foo() {\n" + 
487
		"  }\n" + 
488
		"}\n";
489
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0025", expectedUnitToString);
490
}
491
// Type
492
public void test0026() throws IOException {
493
	String source = "class A {\n" +
494
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int foo() @Marker {\n" +
495
					"    return 0;\n" +
496
					"}\n" +
497
					"public <Integer, @Positive Integer, @Negative Integer, Integer> int bar() @Marker{\n" +
498
					"    return 0;\n" +
499
					"}\n" +
500
					"}\n";
501
	String expectedUnitToString = 
502
		"class A {\n" + 
503
		"  A() {\n" + 
504
		"    super();\n" + 
505
		"  }\n" + 
506
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int foo() @Marker {\n" + 
507
		"    return 0;\n" +
508
		"  }\n" + 
509
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>int bar() @Marker {\n" + 
510
		"    return 0;\n" +
511
		"  }\n" + 
512
		"}\n";
513
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0026", expectedUnitToString);
514
}
515
// Type
516
public void test0027() throws IOException {
517
	String source = "class A {\n" +
518
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String foo() @Marker {\n" +
519
					"    return null;\n" +
520
					"}\n" +
521
					"public <Integer, @Positive Integer, @Negative Integer, Integer> String bar () @Marker {\n" +
522
					"    return null;\n" +
523
					"}\n" +
524
					"}\n";
525
	String expectedUnitToString = 
526
		"class A {\n" + 
527
		"  A() {\n" + 
528
		"    super();\n" + 
529
		"  }\n" + 
530
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String foo() @Marker {\n" + 
531
		"    return null;\n" +
532
		"  }\n" + 
533
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>String bar() @Marker {\n" + 
534
		"    return null;\n" +
535
		"  }\n" + 
536
		"}\n";
537
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0027", expectedUnitToString);
538
}
539
//Type
540
public void test0028() throws IOException {
541
	String source = "class A {\n" +
542
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object> foo() @Marker {\n" +
543
					"    return null;\n" +
544
					"}\n" +
545
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object> bar () @Marker {\n" +
546
					"    return null;\n" +
547
					"}\n" +
548
					"}\n";
549
	String expectedUnitToString = 
550
		"class A {\n" + 
551
		"  A() {\n" + 
552
		"    super();\n" + 
553
		"  }\n" + 
554
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object> foo() @Marker {\n" + 
555
		"    return null;\n" +
556
		"  }\n" + 
557
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object> bar() @Marker {\n" + 
558
		"    return null;\n" +
559
		"  }\n" + 
560
		"}\n";
561
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0028", expectedUnitToString);
562
}
563
// Type
564
public void test0029() throws IOException {
565
	String source = "class A {\n" +
566
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" +
567
					"    return null;\n" +
568
					"}\n" +
569
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator bar () @Marker {\n" +
570
					"    return null;\n" +
571
					"}\n" +
572
					"}\n";
573
	String expectedUnitToString = 
574
		"class A {\n" + 
575
		"  A() {\n" + 
576
		"    super();\n" + 
577
		"  }\n" + 
578
		"  public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator foo() @Marker {\n" + 
579
		"    return null;\n" +
580
		"  }\n" + 
581
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator bar() @Marker {\n" + 
582
		"    return null;\n" +
583
		"  }\n" + 
584
		"}\n";
585
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0029", expectedUnitToString);
586
}
587
//Type
588
public void test0030() throws IOException {
589
	String source = "class A {\n" +
590
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty[][] foo() @Marker {\n" +
591
					"    return null;\n" +
592
					"}\n" +
593
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>.Iterator[] @NonEmpty[][] bar () @Marker {\n" +
594
					"    return null;\n" +
595
					"}\n" +
596
					"}\n";
597
	String expectedUnitToString = 
598
		"class A {\n" + 
599
		"  A() {\n" + 
600
		"    super();\n" + 
601
		"  }\n" + 
602
		"  public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>.Iterator[] @NonEmpty [][] foo() @Marker {\n" + 
603
		"    return null;\n" +
604
		"  }\n" + 
605
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>.Iterator[] @NonEmpty [][] bar() @Marker {\n" + 
606
		"    return null;\n" +
607
		"  }\n" + 
608
		"}\n";
609
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0030", expectedUnitToString);
610
}
611
//Type
612
public void test0031() throws IOException {
613
	String source = "class A {\n" +
614
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker int[] @NonEmpty[][] foo() @Marker {\n" +
615
					"    return 0;\n" +
616
					"}\n" +
617
					"public <Integer, @Positive Integer, @Negative Integer, Integer> int[] @NonEmpty[][] bar() @Marker{\n" +
618
					"    return 0;\n" +
619
					"}\n" +
620
					"}\n";
621
	String expectedUnitToString = 
622
		"class A {\n" + 
623
		"  A() {\n" + 
624
		"    super();\n" + 
625
		"  }\n" + 
626
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker int[] @NonEmpty [][] foo() @Marker {\n" + 
627
		"    return 0;\n" +
628
		"  }\n" + 
629
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>int[] @NonEmpty [][] bar() @Marker {\n" + 
630
		"    return 0;\n" +
631
		"  }\n" + 
632
		"}\n";
633
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0031", expectedUnitToString);
634
}
635
// Type
636
public void test0032() throws IOException {
637
	String source = "class A {\n" +
638
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker String[]@NonEmpty[][] foo() @Marker {\n" +
639
					"    return null;\n" +
640
					"}\n" +
641
					"public <Integer, @Positive Integer, @Negative Integer, Integer> String[]@NonEmpty[][] bar () @Marker {\n" +
642
					"    return null;\n" +
643
					"}\n" +
644
					"}\n";
645
	String expectedUnitToString = 
646
		"class A {\n" + 
647
		"  A() {\n" + 
648
		"    super();\n" + 
649
		"  }\n" + 
650
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker String[] @NonEmpty [][] foo() @Marker {\n" + 
651
		"    return null;\n" +
652
		"  }\n" + 
653
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>String[] @NonEmpty [][] bar() @Marker {\n" + 
654
		"    return null;\n" +
655
		"  }\n" + 
656
		"}\n";
657
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0032", expectedUnitToString);
658
}
659
//Type
660
public void test0033() throws IOException {
661
	String source = "class A {\n" +
662
					"public <Integer, @Positive Integer, @Negative Integer, Integer> @Marker HashMap<@Readonly String, Object>[] @NonEmpty[][] foo() @Marker {\n" +
663
					"    return null;\n" +
664
					"}\n" +
665
					"public <Integer, @Positive Integer, @Negative Integer, Integer> HashMap<String, @NonNull Object>[]@NonEmpty[][] bar () @Marker {\n" +
666
					"    return null;\n" +
667
					"}\n" +
668
					"}\n";
669
	String expectedUnitToString = 
670
		"class A {\n" + 
671
		"  A() {\n" + 
672
		"    super();\n" + 
673
		"  }\n" + 
674
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>@Marker HashMap<@Readonly String, Object>[] @NonEmpty [][] foo() @Marker {\n" + 
675
		"    return null;\n" +
676
		"  }\n" + 
677
		"  public <Integer, @Positive Integer, @Negative Integer, Integer>HashMap<String, @NonNull Object>[] @NonEmpty [][] bar() @Marker {\n" + 
678
		"    return null;\n" +
679
		"  }\n" + 
680
		"}\n";
681
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0033", expectedUnitToString);
682
}
683
// Type0 field declaration.
684
public void test0034() throws IOException {
685
	String source = "public class A {\n" +
686
					"    int[] f[];\n" +
687
					"    @Marker int k;\n" +
688
					"    float[] p[];\n" +
689
					"}\n";
690
	String expectedUnitToString = 
691
		"public class A {\n" + 
692
		"  int[][] f;\n" + 
693
		"  @Marker int k;\n" + 
694
		"  float[][] p;\n" + 
695
		"  public A() {\n" + 
696
		"    super();\n" + 
697
		"  }\n" + 
698
		"}\n";
699
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0034", expectedUnitToString);
700
}
701
//Type0 field declaration.
702
public void test0035() throws IOException {
703
	String source = "public class A {\n" +
704
					"    int[] f[];\n" +
705
					"    @Marker String k;\n" +
706
					"    float[] p[];\n" +
707
					"}\n";
708
	String expectedUnitToString = 
709
		"public class A {\n" + 
710
		"  int[][] f;\n" + 
711
		"  @Marker String k;\n" + 
712
		"  float[][] p;\n" + 
713
		"  public A() {\n" + 
714
		"    super();\n" + 
715
		"  }\n" + 
716
		"}\n";
717
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0035", expectedUnitToString);
718
}
719
//Type0 field declaration.
720
public void test0036() throws IOException {
721
	String source = "public class A {\n" +
722
					"    int[] f[];\n" +
723
					"    @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" +
724
					"    float[] p[];\n" +
725
					"}\n";
726
	String expectedUnitToString = 
727
		"public class A {\n" + 
728
		"  int[][] f;\n" + 
729
		"  @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" + 
730
		"  float[][] p;\n" + 
731
		"  public A() {\n" + 
732
		"    super();\n" + 
733
		"  }\n" + 
734
		"}\n";
735
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0036", expectedUnitToString);
736
}
737
//Type0 field declaration.
738
public void test0037() throws IOException {
739
	String source = "public class A {\n" +
740
					"    int[] f[];\n" +
741
					"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" +
742
					"    float[] p[];\n" +
743
					"}\n";
744
	String expectedUnitToString = 
745
		"public class A {\n" + 
746
		"  int[][] f;\n" + 
747
		"  @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" + 
748
		"  float[][] p;\n" + 
749
		"  public A() {\n" + 
750
		"    super();\n" + 
751
		"  }\n" + 
752
		"}\n";
753
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0037", expectedUnitToString);
754
}
755
//Type0 field declaration.
756
public void test0038() throws IOException {
757
	String source = "public class A {\n" +
758
					"    int[] f[];\n" +
759
					"    @Marker int[] @NonEmpty[][] k;\n" +
760
					"    float[] p[];\n" +
761
					"}\n";
762
	String expectedUnitToString = 
763
		"public class A {\n" + 
764
		"  int[][] f;\n" + 
765
		"  @Marker int[] @NonEmpty [][] k;\n" + 
766
		"  float[][] p;\n" + 
767
		"  public A() {\n" + 
768
		"    super();\n" + 
769
		"  }\n" + 
770
		"}\n";
771
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0038", expectedUnitToString);
772
}
773
//Type0 field declaration.
774
public void test0039() throws IOException {
775
	String source = "public class A {\n" +
776
					"    int[] f[];\n" +
777
					"    @Marker String[] @NonEmpty[][]k;\n" +
778
					"    float[] p[];\n" +
779
					"}\n";
780
	String expectedUnitToString = 
781
		"public class A {\n" + 
782
		"  int[][] f;\n" + 
783
		"  @Marker String[] @NonEmpty [][] k;\n" + 
784
		"  float[][] p;\n" + 
785
		"  public A() {\n" + 
786
		"    super();\n" + 
787
		"  }\n" + 
788
		"}\n";
789
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0039", expectedUnitToString);
790
}
791
//Type0 field declaration.
792
public void test0040() throws IOException {
793
	String source = "public class A {\n" +
794
					"    int[] f[];\n" +
795
					"    @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty[][] k;\n" +
796
					"    float[] p[];\n" +
797
					"}\n";
798
	String expectedUnitToString = 
799
		"public class A {\n" + 
800
		"  int[][] f;\n" + 
801
		"  @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] k;\n" + 
802
		"  float[][] p;\n" + 
803
		"  public A() {\n" + 
804
		"    super();\n" + 
805
		"  }\n" + 
806
		"}\n";
807
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0040", expectedUnitToString);
808
}
809
//Type0 field declaration.
810
public void test0041() throws IOException {
811
	String source = "public class A {\n" +
812
					"    int[] f[];\n" +
813
					"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] k;\n" +
814
					"    float[] p[];\n" +
815
					"}\n";
816
	String expectedUnitToString = 
817
		"public class A {\n" + 
818
		"  int[][] f;\n" + 
819
		"  @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] k;\n" + 
820
		"  float[][] p;\n" + 
821
		"  public A() {\n" + 
822
		"    super();\n" + 
823
		"  }\n" + 
824
		"}\n";
825
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0041", expectedUnitToString);
826
}
827
//Type0 MethodHeaderName.
828
public void test0042() throws IOException {
829
	String source = "public class A {\n" +
830
					"    public @Marker int foo() { return 0; }\n" +
831
					"    public int bar() { return 0; }\n" +
832
					"}\n";
833
	String expectedUnitToString = 
834
		"public class A {\n" + 
835
		"  public A() {\n" + 
836
		"    super();\n" + 
837
		"  }\n" + 
838
		"  public @Marker int foo() {\n" + 
839
		"    return 0;\n" + 
840
		"  }\n" + 
841
		"  public int bar() {\n" + 
842
		"    return 0;\n" + 
843
		"  }\n" + 
844
		"}\n";
845
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0042", expectedUnitToString);
846
}
847
//Type0 MethodHeaderName.
848
public void test0043() throws IOException {
849
	String source = "public class A {\n" +
850
					"    public @Marker String foo() { return null; }\n" +
851
					"    public String bar() { return null; }\n" +
852
					"}\n";
853
	String expectedUnitToString = 
854
		"public class A {\n" + 
855
		"  public A() {\n" + 
856
		"    super();\n" + 
857
		"  }\n" + 
858
		"  public @Marker String foo() {\n" + 
859
		"    return null;\n" + 
860
		"  }\n" + 
861
		"  public String bar() {\n" + 
862
		"    return null;\n" + 
863
		"  }\n" + 
864
		"}\n";
865
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0043", expectedUnitToString);
866
}
867
//Type0 MethodHeaderName.
868
public void test0044() throws IOException {
869
	String source = "public class A {\n" +
870
					"    public @Marker HashMap<@Positive Integer, @Negative Integer> foo() { return null; }\n" +
871
					"    public HashMap<@Positive Integer, @Negative Integer>  bar() { return null; }\n" +
872
					"}\n";
873
	String expectedUnitToString = 
874
		"public class A {\n" + 
875
		"  public A() {\n" + 
876
		"    super();\n" + 
877
		"  }\n" + 
878
		"  public @Marker HashMap<@Positive Integer, @Negative Integer> foo() {\n" + 
879
		"    return null;\n" + 
880
		"  }\n" + 
881
		"  public HashMap<@Positive Integer, @Negative Integer> bar() {\n" + 
882
		"    return null;\n" + 
883
		"  }\n" + 
884
		"}\n";
885
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0044", expectedUnitToString);
886
}
887
//Type0 MethodHeaderName.
888
public void test0045() throws IOException {
889
	String source = "public class A {\n" +
890
					"    public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() { return null; }\n" +
891
					"    public HashMap<@Positive Integer, @Negative Integer>.Iterator  bar() { return null; }\n" +
892
					"}\n";
893
	String expectedUnitToString = 
894
		"public class A {\n" + 
895
		"  public A() {\n" + 
896
		"    super();\n" + 
897
		"  }\n" + 
898
		"  public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() {\n" + 
899
		"    return null;\n" + 
900
		"  }\n" + 
901
		"  public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() {\n" + 
902
		"    return null;\n" + 
903
		"  }\n" + 
904
		"}\n";
905
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0045", expectedUnitToString);
906
}
907
//Type0 MethodHeaderName.
908
public void test0046() throws IOException {
909
	String source = "public class A {\n" +
910
					"    public @Marker int[] foo() @NonEmpty[][] { return 0; }\n" +
911
					"    public int[] @NonEmpty[][] bar() { return 0; }\n" +
912
					"}\n";
913
	String expectedUnitToString = 
914
		"public class A {\n" + 
915
		"  public A() {\n" + 
916
		"    super();\n" + 
917
		"  }\n" + 
918
		"  public @Marker int[] @NonEmpty [][] foo() {\n" + 
919
		"    return 0;\n" + 
920
		"  }\n" + 
921
		"  public int[] @NonEmpty [][] bar() {\n" + 
922
		"    return 0;\n" + 
923
		"  }\n" + 
924
		"}\n";
925
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0046", expectedUnitToString);
926
}
927
//Type0 MethodHeaderName.
928
public void test0047() throws IOException {
929
	String source = "public class A {\n" +
930
					"    public @Marker String[]  foo() @NonEmpty[][] { return null; }\n" +
931
					"    public String[] @NonEmpty[][] bar() { return null; }\n" +
932
					"}\n";
933
	String expectedUnitToString = 
934
		"public class A {\n" + 
935
		"  public A() {\n" + 
936
		"    super();\n" + 
937
		"  }\n" + 
938
		"  public @Marker String[] @NonEmpty [][] foo() {\n" + 
939
		"    return null;\n" + 
940
		"  }\n" + 
941
		"  public String[] @NonEmpty [][] bar() {\n" + 
942
		"    return null;\n" + 
943
		"  }\n" + 
944
		"}\n";
945
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0047", expectedUnitToString);
946
}
947
//Type0 MethodHeaderName.
948
public void test0048() throws IOException {
949
	String source = "public class A {\n" +
950
					"    public @Marker HashMap<@Positive Integer, @Negative Integer>[] foo() @NonEmpty[][] { return null; }\n" +
951
					"    public HashMap<@Positive Integer, @Negative Integer> [] @NonEmpty[][] bar() { return null; }\n" +
952
					"}\n";
953
	String expectedUnitToString = 
954
		"public class A {\n" + 
955
		"  public A() {\n" + 
956
		"    super();\n" + 
957
		"  }\n" + 
958
		"  public @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] foo() {\n" + 
959
		"    return null;\n" + 
960
		"  }\n" + 
961
		"  public HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] bar() {\n" + 
962
		"    return null;\n" + 
963
		"  }\n" + 
964
		"}\n";
965
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0048", expectedUnitToString);
966
}
967
//Type0 MethodHeaderName.
968
public void test0049() throws IOException {
969
	String source = "public class A {\n" +
970
					"    public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[]  foo() @NonEmpty[][] { return null; }\n" +
971
					"    public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] bar() { return null; }\n" +
972
					"}\n";
973
	String expectedUnitToString = 
974
		"public class A {\n" + 
975
		"  public A() {\n" + 
976
		"    super();\n" + 
977
		"  }\n" + 
978
		"  public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] foo() {\n" + 
979
		"    return null;\n" + 
980
		"  }\n" + 
981
		"  public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] bar() {\n" + 
982
		"    return null;\n" + 
983
		"  }\n" + 
984
		"}\n";
985
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0049", expectedUnitToString);
986
}
987
//Type0 local variable declaration
988
public void test0050() throws IOException {
989
	String source = "public class A {\n" +
990
					"    public void foo() {\n" +
991
					"        @Marker int p;\n" +
992
					"        int q;\n" + 
993
					"    }\n" +
994
					"}\n";
995
	String expectedUnitToString = 
996
		"public class A {\n" + 
997
		"  public A() {\n" + 
998
		"    super();\n" + 
999
		"  }\n" + 
1000
		"  public void foo() {\n" + 
1001
		"    @Marker int p;\n" + 
1002
		"    int q;\n" + 
1003
		"  }\n" + 
1004
		"}\n";
1005
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0050", expectedUnitToString);
1006
}
1007
//Type0 local variable declaration
1008
public void test0051() throws IOException {
1009
	String source = "public class A {\n" +
1010
					"    public void foo() {\n" +
1011
					"        @Marker String p;\n" +
1012
					"        String q;\n" + 
1013
					"    }\n" +
1014
					"}\n";
1015
	String expectedUnitToString = 
1016
		"public class A {\n" + 
1017
		"  public A() {\n" + 
1018
		"    super();\n" + 
1019
		"  }\n" + 
1020
		"  public void foo() {\n" + 
1021
		"    @Marker String p;\n" + 
1022
		"    String q;\n" + 
1023
		"  }\n" + 
1024
		"}\n";
1025
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0051", expectedUnitToString);
1026
}
1027
//Type0 local variable declaration
1028
public void test0052() throws IOException {
1029
	String source = "public class A {\n" +
1030
					"    public void foo() {\n" +
1031
					"        @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" +
1032
					"        HashMap<@Positive Integer, @Negative Integer> q;\n" + 
1033
					"    }\n" +
1034
					"}\n";
1035
	String expectedUnitToString = 
1036
		"public class A {\n" + 
1037
		"  public A() {\n" + 
1038
		"    super();\n" + 
1039
		"  }\n" + 
1040
		"  public void foo() {\n" + 
1041
		"    @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" + 
1042
		"    HashMap<@Positive Integer, @Negative Integer> q;\n" + 
1043
		"  }\n" + 
1044
		"}\n";
1045
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0052", expectedUnitToString);
1046
}
1047
//Type0 local variable declaration
1048
public void test0053() throws IOException {
1049
	String source = "public class A {\n" +
1050
					"    public void foo() {\n" +
1051
					"        @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" +
1052
					"        HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + 
1053
					"    }\n" +
1054
					"}\n";
1055
	String expectedUnitToString = 
1056
		"public class A {\n" + 
1057
		"  public A() {\n" + 
1058
		"    super();\n" + 
1059
		"  }\n" + 
1060
		"  public void foo() {\n" + 
1061
		"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" + 
1062
		"    HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" + 
1063
		"  }\n" + 
1064
		"}\n";
1065
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0053", expectedUnitToString);
1066
}
1067
//Type0 local variable declaration
1068
public void test0054() throws IOException {
1069
	String source = "public class A {\n" +
1070
					"    public void foo() {\n" +
1071
					"        @Marker int[] @NonNull[] p @NonEmpty[][];\n" +
1072
					"        int[] @NonNull[] q @NonEmpty[][];\n" + 
1073
					"    }\n" +
1074
					"}\n";
1075
	String expectedUnitToString = 
1076
		"public class A {\n" + 
1077
		"  public A() {\n" + 
1078
		"    super();\n" + 
1079
		"  }\n" + 
1080
		"  public void foo() {\n" + 
1081
		"    @Marker int[] @NonNull [] @NonEmpty [][] p;\n" + 
1082
		"    int[] @NonNull [] @NonEmpty [][] q;\n" + 
1083
		"  }\n" + 
1084
		"}\n";
1085
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0054", expectedUnitToString);
1086
}
1087
//Type0 local variable declaration
1088
public void test0055() throws IOException {
1089
	String source = "public class A {\n" +
1090
					"    public void foo() {\n" +
1091
					"        @Marker String[] @NonNull[] p @NonEmpty[][];\n" +
1092
					"        String[] @NonNull[] q @NonEmpty[][];\n" + 
1093
					"    }\n" +
1094
					"}\n";
1095
	String expectedUnitToString = 
1096
		"public class A {\n" + 
1097
		"  public A() {\n" + 
1098
		"    super();\n" + 
1099
		"  }\n" + 
1100
		"  public void foo() {\n" + 
1101
		"    @Marker String[] @NonNull [] @NonEmpty [][] p;\n" + 
1102
		"    String[] @NonNull [] @NonEmpty [][] q;\n" + 
1103
		"  }\n" + 
1104
		"}\n";
1105
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0055", expectedUnitToString);
1106
}
1107
//Type0 local variable declaration
1108
public void test0056() throws IOException {
1109
	String source = "public class A {\n" +
1110
					"    public void foo() {\n" +
1111
					"        @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] p @NonEmpty[][];\n" +
1112
					"        HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] q @NonEmpty[][];\n" + 
1113
					"    }\n" +
1114
					"}\n";
1115
	String expectedUnitToString = 
1116
		"public class A {\n" + 
1117
		"  public A() {\n" + 
1118
		"    super();\n" + 
1119
		"  }\n" + 
1120
		"  public void foo() {\n" + 
1121
		"    @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] p;\n" + 
1122
		"    HashMap<@Positive Integer, @Negative Integer>[] @NonNull [] @NonEmpty [][] q;\n" + 
1123
		"  }\n" + 
1124
		"}\n";
1125
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0056", expectedUnitToString);
1126
}
1127
//Type0 local variable declaration
1128
public void test0057() throws IOException {
1129
	String source = "public class A {\n" +
1130
					"    public void foo() {\n" +
1131
					"        @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] p @NonEmpty[][];\n" +
1132
					"        HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] @NonEmpty[][] q;\n" + 
1133
					"    }\n" +
1134
					"}\n";
1135
	String expectedUnitToString = 
1136
		"public class A {\n" + 
1137
		"  public A() {\n" + 
1138
		"    super();\n" + 
1139
		"  }\n" + 
1140
		"  public void foo() {\n" + 
1141
		"    @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] p;\n" + 
1142
		"    HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] q;\n" + 
1143
		"  }\n" + 
1144
		"}\n";
1145
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0057", expectedUnitToString);
1146
}
1147
//Type0 foreach
1148
public void test0058() throws IOException {
1149
	String source = "public class A {\n" +
1150
					"    public void foo() {\n" +
1151
					"        String @NonNull[] @Marker[] s @Readonly[];\n" +
1152
					"    	 for (@Readonly String @NonNull[] si @Marker[] : s) {}\n" +
1153
					"    	 for (String @NonNull[] sii @Marker[] : s) {}\n" +
1154
					"    }\n" +
1155
					"}\n";
1156
	String expectedUnitToString = 
1157
		"public class A {\n" + 
1158
		"  public A() {\n" + 
1159
		"    super();\n" + 
1160
		"  }\n" + 
1161
		"  public void foo() {\n" + 
1162
		"    String @NonNull [] @Marker [] @Readonly [] s;\n" + 
1163
		"    for (@Readonly String @NonNull [] @Marker [] si : s) \n" + 
1164
		"      {\n" + 
1165
		"      }\n" + 
1166
		"    for (String @NonNull [] @Marker [] sii : s) \n" + 
1167
		"      {\n" + 
1168
		"      }\n" + 
1169
		"  }\n" + 
1170
		"}\n";
1171
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0058", expectedUnitToString);
1172
}
1173
//Type0 foreach
1174
public void test0059() throws IOException {
1175
	String source = "public class A {\n" +
1176
					"    public void foo() {\n" +
1177
					"        int @NonNull[] @Marker[] s @Readonly[];\n" +
1178
					"    	 for (@Readonly int @NonNull[] si @Marker[] : s) {}\n" +
1179
					"    	 for (int @NonNull[] sii @Marker[] : s) {}\n" +
1180
					"    }\n" +
1181
					"}\n";
1182
	String expectedUnitToString = 
1183
		"public class A {\n" + 
1184
		"  public A() {\n" + 
1185
		"    super();\n" + 
1186
		"  }\n" + 
1187
		"  public void foo() {\n" + 
1188
		"    int @NonNull [] @Marker [] @Readonly [] s;\n" + 
1189
		"    for (@Readonly int @NonNull [] @Marker [] si : s) \n" + 
1190
		"      {\n" + 
1191
		"      }\n" + 
1192
		"    for (int @NonNull [] @Marker [] sii : s) \n" + 
1193
		"      {\n" + 
1194
		"      }\n" + 
1195
		"  }\n" + 
1196
		"}\n";
1197
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0059", expectedUnitToString);
1198
}
1199
// cast expression
1200
public void test0060() throws IOException {
1201
	String source = "public class Clazz {\n" +
1202
					"public static void main(String[] args) {\n" +
1203
					"int x;\n" +
1204
					"x = (Integer)\n" +
1205
					"(@Readonly Object)\n" +
1206
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value=0)[][] )\n" +
1207
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0)[][] )\n" +
1208
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker[][] )\n" +
1209
					"(@Readonly Object)\n" +
1210
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value=0)[][] )\n" +
1211
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0)[][] )\n" +
1212
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker[][] )\n" +
1213
					"(@Readonly Object)\n" +
1214
					"(@Readonly String[] @Normal(Value=0)[][] )\n" +
1215
					"(@Readonly String[] @SingleMember(0)[][] )\n" +
1216
					"(@Readonly String[] @Marker[][] )\n" +
1217
					"(@Readonly Object)\n" +
1218
					"(@Readonly int[] @Normal(Value=0)[][] )\n" +
1219
					"(@Readonly int[] @SingleMember(0)[][] )\n" +
1220
					"(@Readonly int[] @Marker[][] )\n" +
1221
					"(@Readonly Object)\n" +
1222
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator)\n" +
1223
					"(@Readonly Object)\n" +
1224
					"(@Readonly HashMap<@Positive Integer, @Negative Integer>)\n" +
1225
					"(@Readonly Object)\n" +
1226
					"(@ReadOnly String)\n" +
1227
					"(@Readonly Object)\n" +
1228
					"(@Readonly int) 10;\n" +
1229
					"}\n" +
1230
					"}\n";
1231
	String expectedUnitToString = 
1232
		"public class Clazz {\n" + 
1233
		"  public Clazz() {\n" + 
1234
		"    super();\n" + 
1235
		"  }\n" + 
1236
		"  public static void main(String[] args) {\n" + 
1237
		"    int x;\n" + 
1238
		"    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" + 
1239
		"  }\n" + 
1240
		"}\n";
1241
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0060", expectedUnitToString);
1242
}
1243
//cast expression
1244
public void test0061() throws IOException {
1245
	String source = "public class Clazz {\n" +
1246
					"public static void main(String[] args) {\n" +
1247
					"int x;\n" +
1248
					"x = (Integer)\n" +
1249
					"(Object)\n" +
1250
					"(@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value=0)[][] )\n" +
1251
					"(HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0)[][] )\n" +
1252
					"(@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker[][] )\n" +
1253
					"(Object)\n" +
1254
					"(@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value=0)[][] )\n" +
1255
					"(HashMap<Integer, @Negative Integer>[] @SingleMember(0)[][] )\n" +
1256
					"(@Readonly HashMap<@Positive Integer, Integer>[] @Marker[][] )\n" +
1257
					"(Object)\n" +
1258
					"(@Readonly String[] @Normal(Value=0)[][] )\n" +
1259
					"(String[] @SingleMember(0)[][] )\n" +
1260
					"(@Readonly String[] @Marker[][] )\n" +
1261
					"(Object)\n" +
1262
					"(@Readonly int[] @Normal(Value=0)[][] )\n" +
1263
					"(int[] @SingleMember(0)[][] )\n" +
1264
					"(@Readonly int[] @Marker[][] )\n" +
1265
					"(Object)\n" +
1266
					"(@Readonly HashMap<Integer, @Negative Integer>.Iterator)\n" +
1267
					"(Object)\n" +
1268
					"(@Readonly HashMap<@Positive Integer, Integer>)\n" +
1269
					"(Object)\n" +
1270
					"(@ReadOnly String)\n" +
1271
					"(Object)\n" +
1272
					"(@Readonly int) 10;\n" +
1273
					"}\n" +
1274
					"}\n";
1275
	String expectedUnitToString = 
1276
		"public class Clazz {\n" + 
1277
		"  public Clazz() {\n" + 
1278
		"    super();\n" + 
1279
		"  }\n" + 
1280
		"  public static void main(String[] args) {\n" + 
1281
		"    int x;\n" + 
1282
		"    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" + 
1283
		"  }\n" + 
1284
		"}\n";
1285
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0061", expectedUnitToString);
1286
}
1287
// instanceof checks 
1288
public void test0062() throws IOException {
1289
	String source = "public class Clazz {\n" +
1290
					"public static void main(Object o) {\n" +
1291
					"if (o instanceof @Readonly String) {\n" +
1292
					"} else if (o instanceof @Readonly int[] @NonEmpty[][] ) {\n" +
1293
					"} else if (o instanceof @Readonly String[] @NonEmpty[][] ) {\n" +
1294
					"} else if (o instanceof @Readonly HashMap<?,?>[] @NonEmpty[][] ) {\n" +
1295
					"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] ) {\n" +	
1296
					"} else if (o instanceof @Readonly HashMap<?,?>) {\n" +
1297
					"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) {\n" +
1298
					"}\n" +
1299
					"}\n" +
1300
					"}";
1301
	String expectedUnitToString = 
1302
		"public class Clazz {\n" + 
1303
		"  public Clazz() {\n" + 
1304
		"    super();\n" + 
1305
		"  }\n" + 
1306
		"  public static void main(Object o) {\n" + 
1307
		"    if ((o instanceof @Readonly String))\n" + 
1308
		"        {\n" + 
1309
		"        }\n" + 
1310
		"    else\n" + 
1311
		"        if ((o instanceof @Readonly int[] @NonEmpty [][]))\n" + 
1312
		"            {\n" + 
1313
		"            }\n" + 
1314
		"        else\n" + 
1315
		"            if ((o instanceof @Readonly String[] @NonEmpty [][]))\n" + 
1316
		"                {\n" + 
1317
		"                }\n" + 
1318
		"            else\n" + 
1319
		"                if ((o instanceof @Readonly HashMap<?, ?>[] @NonEmpty [][]))\n" + 
1320
		"                    {\n" + 
1321
		"                    }\n" + 
1322
		"                else\n" + 
1323
		"                    if ((o instanceof  @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][]))\n" + 
1324
		"                        {\n" + 
1325
		"                        }\n" + 
1326
		"                    else\n" + 
1327
		"                        if ((o instanceof @Readonly HashMap<?, ?>))\n" + 
1328
		"                            {\n" + 
1329
		"                            }\n" + 
1330
		"                        else\n" + 
1331
		"                            if ((o instanceof  @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator))\n" + 
1332
		"                                {\n" + 
1333
		"                                }\n" + 
1334
		"  }\n" + 
1335
		"}\n";
1336
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0062", expectedUnitToString);
1337
}
1338
// assorted unclassified 
1339
public void test0063() throws IOException {
1340
	String source = "import java.util.HashMap;\n" +
1341
					"import java.util.Map; \n" +  
1342
					"\n" +
1343
					"public class Clazz <@A M extends @B String, @C N extends @D Comparable> extends\n" +
1344
					"								@E Object implements @F Comparable <@G Object> {\n" +
1345
					"	\n" +
1346
					"  Clazz(char[] ...args) @H { \n" +   
1347
					"   }\n" +
1348
					"   \n" +
1349
					"  int @I[] f @J[], g, h[], i@K[];\n" +
1350
					"  int @L[][]@M[] f2; \n" +
1351
					"   \n" +
1352
					"  Clazz (int @N[] @O... a) @Q {}\n" +
1353
					" int @R[]@S[] aa() {}\n" +
1354
					" \n" +
1355
					" int @T[]@U[]@V[] a () @W[]@X[]@Y[] @Z { return null; }\n" +
1356
					"   \n" +
1357
					"  public void main(String @A[] @B ... args) @C throws @D Exception {\n" +
1358
					"  	\n" +
1359
					"       HashMap<@E String, @F String> b1;\n" +
1360
					"      \n" +
1361
					"     int b; b = (@G int) 10;\n" +
1362
					"      \n" +
1363
					"     char @H[]@I[] ch; ch = (@K char @L[]@M[])(@N char @O[]@P[]) null;\n" +
1364
					"      \n" +
1365
					"      int[] i; i = new @Q int @R[10];\n" +
1366
					"       \n" +
1367
					"      \n" +
1368
					"   Integer w; w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" +
1369
					"    throw new @V Exception(\"test\");\n" +
1370
					"    boolean c; c  = null instanceof @W String;\n" +
1371
					"	} \n" +
1372
					" public <@X X, @Y Y> void foo(X x, Y @Z... y) {  \n" +
1373
					"	\n" +
1374
					"}\n" +
1375
					" \n" +
1376
					" void foo(Map<? super @A Object, ? extends @B String> m){}\n" +
1377
					" public int compareTo(Object arg0) {\n" +
1378
					"     return 0;\n" +
1379
					" }\n" +
1380
					"\n" +
1381
					"}\n" +
1382
					"class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" +
1383
					"	\n" +
1384
					"  public Integer get(Integer integer) {\n" +
1385
					"       return null;\n" +
1386
					"   }\n" +
1387
					"}\n";
1388
					
1389
					
1390
	String expectedUnitToString = "import java.util.HashMap;\n" + 
1391
								  "import java.util.Map;\n" + 
1392
								  "public class Clazz<@A M extends @B String, @C N extends @D Comparable> extends @E Object implements @F Comparable<@G Object> {\n" + 
1393
								  "  int @I [] @J [] f;\n" + 
1394
								  "  int @I [] g;\n" + 
1395
								  "  int @I [][] h;\n" + 
1396
								  "  int @I [] @K [] i;\n" + 
1397
								  "  int @L [][] @M [] f2;\n" + 
1398
								  "  Clazz(char[]... args) @H {\n" + 
1399
								  "    super();\n" + 
1400
								  "  }\n" + 
1401
								  "  Clazz(int @N [] @O ... a) @Q {\n" + 
1402
								  "    super();\n" + 
1403
								  "  }\n" + 
1404
								  "  int @R [] @S [] aa() {\n" + 
1405
								  "  }\n" + 
1406
								  "  int @T [] @U [] @V [] @W [] @X [] @Y [] a() @Z {\n" + 
1407
								  "    return null;\n" + 
1408
								  "  }\n" + 
1409
								  "  public void main(String @A [] @B ... args) @C throws @D Exception {\n" + 
1410
								  "    HashMap<@E String, @F String> b1;\n" + 
1411
								  "    int b;\n" +
1412
								  "    b = (@G int) 10;\n" + 
1413
								  "    char @H [] @I [] ch;\n" +
1414
								  "    ch = (@K char @L [] @M []) (@N char @O [] @P []) null;\n" + 
1415
								  "    int[] i;\n" +
1416
								  "    i = new @Q int @R [10];\n" + 
1417
								  "    Integer w;\n" +
1418
								  "    w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" + 
1419
								  "    throw new @V Exception(\"test\");\n" + 
1420
								  "    boolean c;\n" +
1421
								  "    c = (null instanceof @W String);\n" + 
1422
								  "  }\n" + 
1423
								  "  public <@X X, @Y Y>void foo(X x, Y @Z ... y) {\n" + 
1424
								  "  }\n" + 
1425
								  "  void foo(Map<? super @A Object, ? extends @B String> m) {\n" + 
1426
								  "  }\n" + 
1427
								  "  public int compareTo(Object arg0) {\n" + 
1428
								  "    return 0;\n" + 
1429
								  "  }\n" + 
1430
								  "}\n" + 
1431
								  "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" + 
1432
								  "  X() {\n" + 
1433
								  "    super();\n" + 
1434
								  "  }\n" + 
1435
								  "  public Integer get(Integer integer) {\n" + 
1436
								  "    return null;\n" + 
1437
								  "  }\n" + 
1438
								  "}\n";
1439
	// indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
1440
	// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
1441
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0063", expectedUnitToString);
1442
}
1443
//assorted unclassified 
1444
public void test0064() throws IOException {
1445
	String source = "class X<T extends @E Object & @F Comparable<? super T>> {}\n";
1446
	String expectedUnitToString = "class X<T extends @E Object & @F Comparable<? super T>> {\n" + 
1447
								  "  X() {\n" + 
1448
								  "    super();\n" + 
1449
								  "  }\n" + 
1450
								  "}\n";
1451
	// indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
1452
	// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
1453
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test064", expectedUnitToString);
1454
}
1455
//type class literal expression
1456
public void test0065() throws IOException {
1457
	String source = "public class Clazz {\n" +
1458
					"public static void main(String[] args) {\n" +
1459
					"Class x;\n" +
1460
					"x = Integer.class;\n" +
1461
					"x = @Readonly Object.class;\n" +
1462
					"x = HashMap.Iterator[] @Normal(Value=0)[][].class;\n" +
1463
					"x = @Readonly HashMap.Iterator[] @SingleMember(0)[][].class;\n" +
1464
					"x = @Readonly HashMap.Iterator @Normal(Value=1)[] @Marker[] @Normal(Value=2)[].class;\n" +
1465
					"x = @Readonly Object.class;\n" +
1466
					"x = @Readonly String[] @Normal(Value=0)[][].class;\n" +
1467
					"x = @Readonly String[] @SingleMember(0)[][].class;\n" +
1468
					"x = @Readonly String[] @Marker[][].class;\n" +
1469
					"x = @Readonly Object.class;\n" +
1470
					"x = @Readonly int[][] @Normal(Value=0)[].class;\n" +
1471
					"x = @Readonly int @SingleMember(0)[][][].class;\n" +
1472
					"x = @Readonly int[] @Marker[][].class;\n" +
1473
					"x = @Readonly int.class;\n" +
1474
					"}\n" +
1475
					"}\n";
1476
	String expectedUnitToString = 
1477
		"public class Clazz {\n" + 
1478
		"  public Clazz() {\n" + 
1479
		"    super();\n" + 
1480
		"  }\n" + 
1481
		"  public static void main(String[] args) {\n" + 
1482
		"    Class x;\n" + 
1483
		"    x = Integer.class;\n" + 
1484
		"    x = @Readonly Object.class;\n" + 
1485
		"    x = HashMap.Iterator[] @Normal(Value = 0) [][].class;\n" + 
1486
		"    x = @Readonly HashMap.Iterator[] @SingleMember(0) [][].class;\n" + 
1487
		"    x = @Readonly HashMap.Iterator @Normal(Value = 1) [] @Marker [] @Normal(Value = 2) [].class;\n" + 
1488
		"    x = @Readonly Object.class;\n" + 
1489
		"    x = @Readonly String[] @Normal(Value = 0) [][].class;\n" + 
1490
		"    x = @Readonly String[] @SingleMember(0) [][].class;\n" + 
1491
		"    x = @Readonly String[] @Marker [][].class;\n" + 
1492
		"    x = @Readonly Object.class;\n" + 
1493
		"    x = @Readonly int[][] @Normal(Value = 0) [].class;\n" + 
1494
		"    x = @Readonly int @SingleMember(0) [][][].class;\n" + 
1495
		"    x = @Readonly int[] @Marker [][].class;\n" + 
1496
		"    x = @Readonly int.class;\n" + 
1497
		"  }\n" + 
1498
		"}\n";
1499
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0065", expectedUnitToString);
1500
}
1501
//type class literal expression
1502
public void test0066() throws IOException {
1503
	String source = "public class X {\n" + 
1504
			"	<T extends Y<@A String @C[][]@B[]> & Cloneable> void foo(T t) {}\n" + 
1505
			"}";
1506
	String expectedUnitToString = 
1507
		"public class X {\n" + 
1508
		"  public X() {\n" + 
1509
		"    super();\n" + 
1510
		"  }\n" + 
1511
		"  <T extends Y<@A String @C [][] @B []> & Cloneable>void foo(T t) {\n" + 
1512
		"  }\n" + 
1513
		"}\n";
1514
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0066", expectedUnitToString);
1515
}
1516
//check locations
1517
public void test0067() throws IOException {
1518
	String source = 
1519
		"public class X {\n" + 
1520
		"	@H String @E[] @F[] @G[] field;\n" + 
1521
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
1522
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
1523
		"}";
1524
	String expectedUnitToString = 
1525
		"public class X {\n" + 
1526
		"  @H String @E [] @F [] @G [] field;\n" + 
1527
		"  @A Map<@B String, @C List<@D Object>> field2;\n" + 
1528
		"  @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" + 
1529
		"  public X() {\n" + 
1530
		"    super();\n" + 
1531
		"  }\n" + 
1532
		"}\n";
1533
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0067", expectedUnitToString);
1534
}
1535
//check locations
1536
public void test0068() throws IOException {
1537
	String source = 
1538
		"public class X {\n" + 
1539
		"	@H String @E[] @F[] @G[] field;\n" + 
1540
		"}";
1541
	String expectedUnitToString = 
1542
		"public class X {\n" + 
1543
		"  @H String @E [] @F [] @G [] field;\n" + 
1544
		"  public X() {\n" + 
1545
		"    super();\n" + 
1546
		"  }\n" + 
1547
		"}\n";
1548
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1549
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0068", expectedUnitToString, visitor);
1550
	Map locations = visitor.getLocations();
1551
	assertEquals("Wrong size", 4, locations.size());
1552
	assertEquals("Wrong location", null, locations.get("@E"));
1553
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1554
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1555
	assertEquals("Wrong location", "{2}", locations.get("@H"));
1556
}
1557
//check locations
1558
public void test0069() throws IOException {
1559
	String source = 
1560
		"public class X {\n" + 
1561
		"	@A Map<@B String, @H String> field3;\n" + 
1562
		"}";
1563
	String expectedUnitToString = 
1564
		"public class X {\n" + 
1565
		"  @A Map<@B String, @H String> field3;\n" + 
1566
		"  public X() {\n" + 
1567
		"    super();\n" + 
1568
		"  }\n" + 
1569
		"}\n";
1570
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1571
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0069", expectedUnitToString, visitor);
1572
	Map locations = visitor.getLocations();
1573
	assertEquals("Wrong size", 3, locations.size());
1574
	assertEquals("Wrong location", null, locations.get("@A"));
1575
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1576
	assertEquals("Wrong location", "{1}", locations.get("@H"));
1577
}
1578
//check locations
1579
public void test0070() throws IOException {
1580
	String source = 
1581
		"public class X {\n" + 
1582
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
1583
		"}";
1584
	String expectedUnitToString = 
1585
		"public class X {\n" + 
1586
		"  @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" + 
1587
		"  public X() {\n" + 
1588
		"    super();\n" + 
1589
		"  }\n" + 
1590
		"}\n";
1591
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1592
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0070", expectedUnitToString, visitor);
1593
	Map locations = visitor.getLocations();
1594
	assertEquals("Wrong size", 6, locations.size());
1595
	assertEquals("Wrong location", null, locations.get("@A"));
1596
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1597
	assertEquals("Wrong location", "{1}", locations.get("@E"));
1598
	assertEquals("Wrong location", "{1,0}", locations.get("@F"));
1599
	assertEquals("Wrong location", "{1,1}", locations.get("@G"));
1600
	assertEquals("Wrong location", "{1,2}", locations.get("@H"));
1601
}
1602
//check locations
1603
public void test0071() throws IOException {
1604
	String source = 
1605
		"public class X {\n" + 
1606
		"	@A Map<@B String, @C List<@H String @E[][] @G[]>> field;\n" + 
1607
		"}";
1608
	String expectedUnitToString = 
1609
		"public class X {\n" + 
1610
		"  @A Map<@B String, @C List<@H String @E [][] @G []>> field;\n" + 
1611
		"  public X() {\n" + 
1612
		"    super();\n" + 
1613
		"  }\n" + 
1614
		"}\n";
1615
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1616
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0071", expectedUnitToString, visitor);
1617
	Map locations = visitor.getLocations();
1618
	assertEquals("Wrong size", 6, locations.size());
1619
	assertEquals("Wrong location", null, locations.get("@A"));
1620
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1621
	assertEquals("Wrong location", "{1}", locations.get("@C"));
1622
	assertEquals("Wrong location", "{1,0,2}", locations.get("@H"));
1623
	assertEquals("Wrong location", "{1,0}", locations.get("@E"));
1624
	assertEquals("Wrong location", "{1,0,1}", locations.get("@G"));
1625
}
1626
//check locations
1627
public void test0072() throws IOException {
1628
	String source = 
1629
		"public class X {\n" + 
1630
		"	@A Map<@B String, @C List<@H String @E[][] @G[]>>[] @I[] @J[] field;\n" + 
1631
		"}";
1632
	String expectedUnitToString = 
1633
		"public class X {\n" + 
1634
		"  @A Map<@B String, @C List<@H String @E [][] @G []>>[] @I [] @J [] field;\n" + 
1635
		"  public X() {\n" + 
1636
		"    super();\n" + 
1637
		"  }\n" + 
1638
		"}\n";
1639
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1640
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0072", expectedUnitToString, visitor);
1641
	Map locations = visitor.getLocations();
1642
	assertEquals("Wrong size", 8, locations.size());
1643
	assertEquals("Wrong location", "{0}", locations.get("@I"));
1644
	assertEquals("Wrong location", "{1}", locations.get("@J"));
1645
	assertEquals("Wrong location", "{2}", locations.get("@A"));
1646
	assertEquals("Wrong location", "{2,0}", locations.get("@B"));
1647
	assertEquals("Wrong location", "{2,1}", locations.get("@C"));
1648
	assertEquals("Wrong location", "{2,1,0,2}", locations.get("@H"));
1649
	assertEquals("Wrong location", "{2,1,0}", locations.get("@E"));
1650
	assertEquals("Wrong location", "{2,1,0,1}", locations.get("@G"));
1651
}
1652
//check locations
1653
public void test0073() throws IOException {
1654
	String source = 
1655
		"public class X {\n" + 
1656
		"	@A Map<@B String, @C List<@H String @E[][] @G[]>> @I[][] @J[] field;\n" + 
1657
		"}";
1658
	String expectedUnitToString = 
1659
		"public class X {\n" + 
1660
		"  @A Map<@B String, @C List<@H String @E [][] @G []>> @I [][] @J [] field;\n" + 
1661
		"  public X() {\n" + 
1662
		"    super();\n" + 
1663
		"  }\n" + 
1664
		"}\n";
1665
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1666
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0073", expectedUnitToString, visitor);
1667
	Map locations = visitor.getLocations();
1668
	assertEquals("Wrong size", 8, locations.size());
1669
	assertEquals("Wrong location", null, locations.get("@I"));
1670
	assertEquals("Wrong location", "{1}", locations.get("@J"));
1671
	assertEquals("Wrong location", "{2}", locations.get("@A"));
1672
	assertEquals("Wrong location", "{2,0}", locations.get("@B"));
1673
	assertEquals("Wrong location", "{2,1}", locations.get("@C"));
1674
	assertEquals("Wrong location", "{2,1,0,2}", locations.get("@H"));
1675
	assertEquals("Wrong location", "{2,1,0}", locations.get("@E"));
1676
	assertEquals("Wrong location", "{2,1,0,1}", locations.get("@G"));
1677
}
1678
//check locations
1679
public void test0074() throws IOException {
1680
	String source = 
1681
		"public class X {\n" + 
1682
		"	@A Map<@C List<@H String @E[][] @G[]>, String @B[] @D[]> @I[] @F[] @J[] field;\n" + 
1683
		"}";
1684
	String expectedUnitToString = 
1685
		"public class X {\n" + 
1686
		"  @A Map<@C List<@H String @E [][] @G []>, String @B [] @D []> @I [] @F [] @J [] field;\n" + 
1687
		"  public X() {\n" + 
1688
		"    super();\n" + 
1689
		"  }\n" + 
1690
		"}\n";
1691
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1692
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0074", expectedUnitToString, visitor);
1693
	Map locations = visitor.getLocations();
1694
	assertEquals("Wrong size", 10, locations.size());
1695
	assertEquals("Wrong location", null, locations.get("@I"));
1696
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1697
	assertEquals("Wrong location", "{1}", locations.get("@J"));
1698
	assertEquals("Wrong location", "{2}", locations.get("@A"));
1699
	assertEquals("Wrong location", "{2,0}", locations.get("@C"));
1700
	assertEquals("Wrong location", "{2,0,0}", locations.get("@E"));
1701
	assertEquals("Wrong location", "{2,0,0,1}", locations.get("@G"));
1702
	assertEquals("Wrong location", "{2,0,0,2}", locations.get("@H"));
1703
	assertEquals("Wrong location", "{2,1,0}", locations.get("@D"));
1704
	assertEquals("Wrong location", "{2,1}", locations.get("@B"));
1705
}
1706
//check locations
1707
public void test0075() throws IOException {
1708
	String source = 
1709
		"public class X {\n" + 
1710
		"	@A Map<@C List<@H String @E[][] @G[]>, @B List<String [] @D[]>> [] @I[] @F[] @J[] field;\n" + 
1711
		"}";
1712
	String expectedUnitToString = 
1713
		"public class X {\n" + 
1714
		"  @A Map<@C List<@H String @E [][] @G []>, @B List<String[] @D []>>[] @I [] @F [] @J [] field;\n" + 
1715
		"  public X() {\n" + 
1716
		"    super();\n" + 
1717
		"  }\n" + 
1718
		"}\n";
1719
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1720
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0075", expectedUnitToString, visitor);
1721
	Map locations = visitor.getLocations();
1722
	assertEquals("Wrong size", 10, locations.size());
1723
	assertEquals("Wrong location", "{0}", locations.get("@I"));
1724
	assertEquals("Wrong location", "{1}", locations.get("@F"));
1725
	assertEquals("Wrong location", "{2}", locations.get("@J"));
1726
	assertEquals("Wrong location", "{3}", locations.get("@A"));
1727
	assertEquals("Wrong location", "{3,0}", locations.get("@C"));
1728
	assertEquals("Wrong location", "{3,0,0}", locations.get("@E"));
1729
	assertEquals("Wrong location", "{3,0,0,1}", locations.get("@G"));
1730
	assertEquals("Wrong location", "{3,0,0,2}", locations.get("@H"));
1731
	assertEquals("Wrong location", "{3,1}", locations.get("@B"));
1732
	assertEquals("Wrong location", "{3,1,0,0}", locations.get("@D"));
1733
}
1734
//check locations
1735
public void test0076() throws IOException {
1736
	String source = 
1737
		"public class X {\n" + 
1738
		"	@A Map<@B String, @C List<@D Object>> field;\n" + 
1739
		"}";
1740
	String expectedUnitToString = 
1741
		"public class X {\n" + 
1742
		"  @A Map<@B String, @C List<@D Object>> field;\n" + 
1743
		"  public X() {\n" + 
1744
		"    super();\n" + 
1745
		"  }\n" + 
1746
		"}\n";
1747
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1748
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0076", expectedUnitToString, visitor);
1749
	Map locations = visitor.getLocations();
1750
	assertEquals("Wrong size", 4, locations.size());
1751
	assertEquals("Wrong location", null, locations.get("@A"));
1752
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1753
	assertEquals("Wrong location", "{1}", locations.get("@C"));
1754
	assertEquals("Wrong location", "{1,0}", locations.get("@D"));
1755
}
1756
//check locations
1757
public void test0077() throws IOException {
1758
	String source = 
1759
		"public class X {\n" + 
1760
		"	@H String @E[] @F[] @G[] field;\n" + 
1761
		"}";
1762
	String expectedUnitToString = 
1763
		"public class X {\n" + 
1764
		"  @H String @E [] @F [] @G [] field;\n" + 
1765
		"  public X() {\n" + 
1766
		"    super();\n" + 
1767
		"  }\n" + 
1768
		"}\n";
1769
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1770
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0077", expectedUnitToString, visitor);
1771
	Map locations = visitor.getLocations();
1772
	assertEquals("Wrong size", 4, locations.size());
1773
	assertEquals("Wrong location", null, locations.get("@E"));
1774
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1775
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1776
	assertEquals("Wrong location", "{2}", locations.get("@H"));
1777
}
1778
//check locations
1779
public void test0078() throws IOException {
1780
	String source = 
1781
		"public class X {\n" + 
1782
		"	@A Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" + 
1783
		"}";
1784
	String expectedUnitToString = 
1785
		"public class X {\n" + 
1786
		"  @A Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" + 
1787
		"  public X() {\n" + 
1788
		"    super();\n" + 
1789
		"  }\n" + 
1790
		"}\n";
1791
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1792
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0078", expectedUnitToString, visitor);
1793
	Map locations = visitor.getLocations();
1794
	assertEquals("Wrong size", 8, locations.size());
1795
	assertEquals("Wrong location", null, locations.get("@A"));
1796
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1797
	assertEquals("Wrong location", "{0,0,2}", locations.get("@C"));
1798
	assertEquals("Wrong location", "{0,0}", locations.get("@D"));
1799
	assertEquals("Wrong location", "{0,0,0}", locations.get("@E"));
1800
	assertEquals("Wrong location", "{0,0,1}", locations.get("@F"));
1801
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1802
	assertEquals("Wrong location", "{1,0}", locations.get("@H"));
1803
}
1804
//check locations
1805
public void test0079() throws IOException {
1806
	String source = 
1807
		"public class X {\n" + 
1808
		"	@A java.util.Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" + 
1809
		"}";
1810
	String expectedUnitToString = 
1811
		"public class X {\n" + 
1812
		"  @A java.util.Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" + 
1813
		"  public X() {\n" + 
1814
		"    super();\n" + 
1815
		"  }\n" + 
1816
		"}\n";
1817
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1818
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0079", expectedUnitToString, visitor);
1819
	Map locations = visitor.getLocations();
1820
	assertEquals("Wrong size", 8, locations.size());
1821
	assertEquals("Wrong location", null, locations.get("@A"));
1822
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1823
	assertEquals("Wrong location", "{0,0,2}", locations.get("@C"));
1824
	assertEquals("Wrong location", "{0,0}", locations.get("@D"));
1825
	assertEquals("Wrong location", "{0,0,0}", locations.get("@E"));
1826
	assertEquals("Wrong location", "{0,0,1}", locations.get("@F"));
1827
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1828
	assertEquals("Wrong location", "{1,0}", locations.get("@H"));
1829
}
1830
//check locations
1831
public void test0080() throws IOException {
1832
	String source = 
1833
		"public class X {\n" + 
1834
		"	@B Map<? extends Z, ? extends @A Z> field;\n" + 
1835
		"}";
1836
	String expectedUnitToString = 
1837
		"public class X {\n" + 
1838
		"  @B Map<? extends Z, ? extends @A Z> field;\n" + 
1839
		"  public X() {\n" + 
1840
		"    super();\n" + 
1841
		"  }\n" + 
1842
		"}\n";
1843
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1844
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0080", expectedUnitToString, visitor);
1845
	Map locations = visitor.getLocations();
1846
	assertEquals("Wrong size", 2, locations.size());
1847
	assertEquals("Wrong location", null, locations.get("@B"));
1848
	assertEquals("Wrong location", "{1}", locations.get("@A"));
1849
}
1850
//check locations
1851
public void test0081() throws IOException {
1852
	String source = 
1853
		"public class X {\n" + 
1854
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
1855
		"}";
1856
	String expectedUnitToString = 
1857
		"public class X {\n" + 
1858
		"  @H java.lang.String @E [] @F [] @G [] field;\n" + 
1859
		"  public X() {\n" + 
1860
		"    super();\n" + 
1861
		"  }\n" + 
1862
		"}\n";
1863
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1864
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0081", expectedUnitToString, visitor);
1865
	Map locations = visitor.getLocations();
1866
	assertEquals("Wrong size", 4, locations.size());
1867
	assertEquals("Wrong location", null, locations.get("@E"));
1868
	assertEquals("Wrong location", "{0}", locations.get("@F"));
1869
	assertEquals("Wrong location", "{1}", locations.get("@G"));
1870
	assertEquals("Wrong location", "{2}", locations.get("@H"));
1871
}
1872
//check locations
1873
public void test0082() throws IOException {
1874
	String source = 
1875
		"public class X {\n" + 
1876
		"	@A Map<@B java.lang.String, @H java.lang.String @E[] @F[] @G[]> field3;\n" + 
1877
		"}";
1878
	String expectedUnitToString = 
1879
		"public class X {\n" + 
1880
		"  @A Map<@B java.lang.String, @H java.lang.String @E [] @F [] @G []> field3;\n" + 
1881
		"  public X() {\n" + 
1882
		"    super();\n" + 
1883
		"  }\n" + 
1884
		"}\n";
1885
	LocationPrinterVisitor visitor = new LocationPrinterVisitor();
1886
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0082", expectedUnitToString, visitor);
1887
	Map locations = visitor.getLocations();
1888
	assertEquals("Wrong size", 6, locations.size());
1889
	assertEquals("Wrong location", null, locations.get("@A"));
1890
	assertEquals("Wrong location", "{0}", locations.get("@B"));
1891
	assertEquals("Wrong location", "{1}", locations.get("@E"));
1892
	assertEquals("Wrong location", "{1,0}", locations.get("@F"));
1893
	assertEquals("Wrong location", "{1,1}", locations.get("@G"));
1894
	assertEquals("Wrong location", "{1,2}", locations.get("@H"));
1895
}
1896
public void test0083() throws IOException {
1897
	String source =
1898
		"@Marker class A {}\n;" +
1899
		"@Marker class B extends @Marker A {}\n" +
1900
		"@Marker class C extends @Marker @SingleMember(0) A {}\n" +
1901
		"@Marker class D extends @Marker @SingleMember(0) @Normal(value = 0) A {}\n" +
1902
		"@Marker class E extends B {}\n;";
1903
1904
	String expectedUnitToString =
1905
		"@Marker class A {\n" +
1906
		"  A() {\n" +
1907
		"    super();\n" +
1908
		"  }\n" +
1909
		"}\n" +
1910
		"@Marker class B extends @Marker A {\n" +
1911
		"  B() {\n" +
1912
		"    super();\n" +
1913
		"  }\n" +
1914
		"}\n" +
1915
		"@Marker class C extends @Marker @SingleMember(0) A {\n" +
1916
		"  C() {\n" +
1917
		"    super();\n" +
1918
		"  }\n" +
1919
		"}\n" +
1920
		"@Marker class D extends @Marker @SingleMember(0) @Normal(value = 0) A {\n" +
1921
		"  D() {\n" +
1922
		"    super();\n" +
1923
		"  }\n" +
1924
		"}\n" +
1925
		"@Marker class E extends B {\n" +
1926
		"  E() {\n" +
1927
		"    super();\n" +
1928
		"  }\n" +
1929
		"}\n";
1930
	checkParse(source.toCharArray(), null, "test0083", expectedUnitToString);
1931
}
1932
1933
// To test Parser.consumeAdditionalBound() with Type annotations
1934
public void test0084() throws IOException {
1935
	String source =
1936
		"@Marker interface I<@Negative T> {}\n" +
1937
		"@SingleMember(0) interface J<@Positive T> {}\n" +
1938
		"@Marker class A implements I<@SingleMember(0) A>, J<@Marker A> {}\n" +
1939
		"@Normal(value = 1) class X<E extends @Positive A & @Marker I<A> & @Marker @SingleMember(1) J<@Readonly A>>  {\n" +
1940
		"}";
1941
	String expectedUnitToString =
1942
		"@Marker interface I<@Negative T> {\n" +
1943
		"}\n" +
1944
		"@SingleMember(0) interface J<@Positive T> {\n" +
1945
		"}\n" +
1946
		"@Marker class A implements I<@SingleMember(0) A>, J<@Marker A> {\n" +
1947
		"  A() {\n" +
1948
		"    super();\n" +
1949
		"  }\n" +
1950
		"}\n" +
1951
		"@Normal(value = 1) class X<E extends @Positive A & @Marker I<A> & @Marker @SingleMember(1) J<@Readonly A>> {\n" +
1952
		"  X() {\n" +
1953
		"    super();\n" +
1954
		"  }\n" +
1955
		"}\n";
1956
	checkParse(source.toCharArray(), null, "test0084", expectedUnitToString );
1957
}
1958
1959
// To test Parser.consumeAdditionalBound() with Type annotations
1960
public void test0085() throws IOException {
1961
	String source =
1962
		"import java.io.Serializable;\n" +
1963
		"\n" +
1964
		"@SingleMember(10) class X<T extends @Marker Serializable & @Normal(value = 10) Runnable, V extends @Marker T> {\n" +
1965
		"	@Negative T t;\n" +
1966
		"	@Marker X(@Readonly T t) {\n" +
1967
		"		this.t = t;\n" +
1968
		"	}\n" +
1969
		"	void foo() @Marker {\n" +
1970
		"		(this == null ? t : t).run();\n" +
1971
		"		((@Marker V) t).run();\n" +
1972
		"	}\n" +
1973
		"	public static void main(@Readonly String @Marker [] args) {\n" +
1974
		"		new @Marker  X<@Marker A, @Negative A>(new @Marker A()).foo();\n" +
1975
		"	}\n" +
1976
		"}\n" +
1977
		"@Marker class A implements @Marker Serializable, @SingleMember(1) Runnable {\n" +
1978
		"	public void run() {\n" +
1979
		"		System.out.print(\"AA\");\n" +
1980
		"	}\n" +
1981
		"}\n";
1982
	String expectedUnitToString =
1983
		"import java.io.Serializable;\n" +
1984
		"@SingleMember(10) class X<T extends @Marker Serializable & @Normal(value = 10) Runnable, V extends @Marker T> {\n" +
1985
		"  @Negative T t;\n" +
1986
		"  @Marker X(@Readonly T t) {\n" +
1987
		"    super();\n" +
1988
		"    this.t = t;\n" +
1989
		"  }\n" +
1990
		"  void foo() @Marker {\n" +
1991
		"    ((this == null) ? t : t).run();\n" +
1992
		"    (@Marker V) t.run();\n" +
1993
		"  }\n" +
1994
		"  public static void main(@Readonly String @Marker [] args) {\n" +
1995
		"    new @Marker X<@Marker A, @Negative A>(new @Marker A()).foo();\n" +
1996
		"  }\n" +
1997
		"}\n" +
1998
		"@Marker class A implements @Marker Serializable, @SingleMember(1) Runnable {\n" +
1999
		"  A() {\n" +
2000
		"    super();\n" +
2001
		"  }\n" +
2002
		"  public void run() {\n" +
2003
		"    System.out.print(\"AA\");\n" +
2004
		"  }\n" +
2005
		"}\n";
2006
	checkParse(source.toCharArray(), null, "test0085", expectedUnitToString );
2007
}
2008
2009
// To test Parser.classInstanceCreation() with type annotations
2010
public void test0086() throws IOException {
2011
	String source =
2012
		"class X {\n" +
2013
		"	@Marker X() {\n" +
2014
		"		System.out.print(\"new X created\");\n" +
2015
		"	}\n" +
2016
		"  	void f() throws @Marker InstantiationException {\n" +
2017
		"       X testX;\n" +
2018
		"		testX = new @Readonly @Negative X();\n" +
2019
		"		Double d;\n" +
2020
		"		d = new @Marker @Positive Double(1.1);\n" +
2021
		"     	throw new @Positive @Normal(value = 10) InstantiationException(\"test\");\n" +
2022
		"   }\n" +
2023
		"}";
2024
	String expectedUnitToString =
2025
		"class X {\n" +
2026
		"  @Marker X() {\n" +
2027
		"    super();\n" +
2028
		"    System.out.print(\"new X created\");\n" +
2029
		"  }\n" +
2030
		"  void f() throws @Marker InstantiationException {\n" +
2031
		"    X testX;\n" +
2032
		"    testX = new @Readonly @Negative X();\n" +
2033
		"    Double d;\n" +
2034
		"    d = new @Marker @Positive Double(1.1);\n" +
2035
		"    throw new @Positive @Normal(value = 10) InstantiationException(\"test\");\n" +
2036
		"  }\n" +
2037
		"}\n";
2038
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0086", expectedUnitToString );
2039
}
2040
2041
// To test Parser.classInstanceCreation() with type annotations
2042
public void test0087() throws IOException {
2043
	String source =
2044
		"class X {\n" +
2045
		"	@Marker X() {\n" +
2046
		"		System.out.print(\"new X created\");\n" +
2047
		"	}\n" +
2048
		"	@Marker class Inner {\n" +
2049
		"		@Normal(value = 10) Inner(){\n" +
2050
		"			System.out.print(\"X.Inner created\");\n" +
2051
		"		}\n" +
2052
		"	}\n" +
2053
		"	public String getString(){\n" +
2054
		"		return \"hello\";\n" +
2055
		"	}\n" +
2056
		"  	void f() @Marker {\n" +
2057
		"       String testString;\n" +
2058
		"		testString = new @Readonly @Negative X().getString();\n" +
2059
		"		X.Inner testInner;\n" +
2060
		"		testInner = new @Readonly X.Inner();\n" +
2061
		"		int i;\n" +
2062
		"		for(i = 0; i < 10; i++)\n" +
2063
		"			System.out.print(\"test\");\n" +
2064
		"   }\n" +
2065
		"}";
2066
	String expectedUnitToString =
2067
		"class X {\n" +
2068
		"  @Marker class Inner {\n" +
2069
		"    @Normal(value = 10) Inner() {\n" +
2070
		"      super();\n" +
2071
		"      System.out.print(\"X.Inner created\");\n" +
2072
		"    }\n" +
2073
		"  }\n" +
2074
		"  @Marker X() {\n" +
2075
		"    super();\n" +
2076
		"    System.out.print(\"new X created\");\n" +
2077
		"  }\n" +
2078
		"  public String getString() {\n" +
2079
		"    return \"hello\";\n" +
2080
		"  }\n" +
2081
		"  void f() @Marker {\n" +
2082
		"    String testString;\n" +
2083
		"    testString = new @Readonly @Negative X().getString();\n" +
2084
		"    X.Inner testInner;\n" +
2085
		"    testInner = new @Readonly X.Inner();\n" +
2086
		"    int i;\n" +
2087
		"    for (i = 0; (i < 10); i ++) \n" +
2088
		"      System.out.print(\"test\");\n" +
2089
		"  }\n" +
2090
		"}\n";
2091
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0087", expectedUnitToString );
2092
}
2093
2094
// To test Parser.classInstanceCreation() with type annotations
2095
public void test0088() throws IOException {
2096
	String source =
2097
		"import java.io.Serializable;\n" +
2098
		"class X {\n" +
2099
		"	public static void main(String[] args) {\n" +
2100
		"		new @Marker Serializable() {\n" +
2101
		"		};\n" +
2102
		"		new @Positive @Marker Serializable() {\n" +
2103
		"			public long serialVersion;\n" +
2104
		"		};\n" +
2105
		"	}\n" +
2106
		"}";
2107
	String expectedUnitToString =
2108
		"import java.io.Serializable;\n" +
2109
		"class X {\n" +
2110
		"  X() {\n" +
2111
		"    super();\n" +
2112
		"  }\n" +
2113
		"  public static void main(String[] args) {\n" +
2114
		"    new @Marker Serializable() {\n" +
2115
		"    };\n" +
2116
		"    new @Positive @Marker Serializable() {\n" +
2117
		"      public long serialVersion;\n" +
2118
		"    };\n" +
2119
		"  }\n" +
2120
		"}\n";
2121
	checkParse(source.toCharArray(), null, "test0088", expectedUnitToString );
2122
}
2123
2124
// To test Parser.classInstanceCreation() with type annotations
2125
public void test0089() throws IOException {
2126
	String source =
2127
		"import java.io.Serializable;\n" +
2128
		"class X<T>{\n" +
2129
		"	public void f() {\n" +
2130
		"		X testX;\n" +
2131
		"		testX = new @Marker @SingleMember(10) X<@Negative Integer>();\n" +
2132
		"		System.out.print(\"object created\");\n" +
2133
		"	}\n" +
2134
		"}";
2135
	String expectedUnitToString =
2136
		"import java.io.Serializable;\n" +
2137
		"class X<T> {\n" +
2138
		"  X() {\n" +
2139
		"    super();\n" +
2140
		"  }\n" +
2141
		"  public void f() {\n" +
2142
		"    X testX;\n" +
2143
		"    testX = new @Marker @SingleMember(10) X<@Negative Integer>();\n" +
2144
		"    System.out.print(\"object created\");\n" +
2145
		"  }\n" +
2146
		"}\n";
2147
	checkParse(source.toCharArray(), null, "test0089", expectedUnitToString );
2148
}
2149
2150
// To test Parser.classInstanceCreation() with type annotations
2151
public void test0090() throws IOException {
2152
	String source =
2153
		"class X <@Marker T extends @Readonly String> {\n" +
2154
		"    T foo(T t) {\n" +
2155
		"        return t;\n" +
2156
		"    }\n" +
2157
		"    public static void main(String[] args) {\n" +
2158
		"        new @Readonly X<String>().baz(\"SUCCESS\");\n" +	// Parser.classInstanceCreation called
2159
		"    }\n" +
2160
		"    void baz(final T t) {\n" +
2161
		"        new @Readonly @Marker Object() {\n" +	// Parser.classInstanceCreation called
2162
		"            void print() {\n" +
2163
		"            }\n" +
2164
		"        }.print();\n" +
2165
		"    }\n" +
2166
		"}\n";
2167
	String expectedUnitToString =
2168
		"class X<@Marker T extends @Readonly String> {\n" +
2169
		"  X() {\n" +
2170
		"    super();\n" +
2171
		"  }\n" +
2172
		"  T foo(T t) {\n" +
2173
		"    return t;\n" +
2174
		"  }\n" +
2175
		"  public static void main(String[] args) {\n" +
2176
		"    new @Readonly X<String>().baz(\"SUCCESS\");\n" +
2177
		"  }\n" +
2178
		"  void baz(final T t) {\n" +
2179
		"    new @Readonly @Marker Object() {\n" +
2180
		"  void print() {\n" +
2181
		"  }\n" +
2182
		"}.print();\n" +
2183
		"  }\n" +
2184
		"}\n";
2185
	checkParse(source.toCharArray(), null, "test0090", expectedUnitToString );
2186
}
2187
2188
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2189
public void test0091() throws IOException {
2190
	String source =
2191
		"class X <@Marker T extends @Readonly String> {\n" +
2192
		"    public static void main(String[] args) {\n" +
2193
		"		int [] x1;\n" +
2194
		"		x1 = new int @Marker @SingleMember(2) [] {-1, -2};\n" +
2195
		"       Integer [][] x2;\n" +
2196
		"		x2 = new @Positive Integer @Marker @SingleMember(3) [] @SingleMember(3) [] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};\n" +
2197
		"    }\n" +
2198
		"}\n";
2199
	String expectedUnitToString =
2200
		"class X<@Marker T extends @Readonly String> {\n" +
2201
		"  X() {\n" +
2202
		"    super();\n" +
2203
		"  }\n" +
2204
		"  public static void main(String[] args) {\n" +
2205
		"    int[] x1;\n" +
2206
		"    x1 = new int @Marker @SingleMember(2) []{(- 1), (- 2)};\n" +
2207
		"    Integer[][] x2;\n" +
2208
		"    x2 = new @Positive Integer @Marker @SingleMember(3) [] @SingleMember(3) []{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};\n" +
2209
		"  }\n" +
2210
		"}\n";
2211
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0091", expectedUnitToString );
2212
}
2213
2214
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2215
public void test0092() throws IOException {
2216
	String source =
2217
		"class X {\n" +
2218
		"	static class T {\n" +
2219
		"		public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2220
		"			return new @Readonly Object @Normal(value = 10) [] {this, T.this};\n" +
2221
		"		}\n" +
2222
		"	}\n" +
2223
		"}";
2224
	String expectedUnitToString =
2225
		"class X {\n" +
2226
		"  static class T {\n" +
2227
		"    T() {\n" +
2228
		"      super();\n" +
2229
		"    }\n" +
2230
		"    public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2231
		"      return new @Readonly Object @Normal(value = 10) []{this, T.this};\n" +
2232
		"    }\n" +
2233
		"  }\n" +
2234
		"  X() {\n" +
2235
		"    super();\n" +
2236
		"  }\n" +
2237
		"}\n";
2238
	checkParse(source.toCharArray(), null, "test0092", expectedUnitToString );
2239
}
2240
2241
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2242
public void test0093() throws IOException {
2243
	String source =
2244
		"class X {\n" +
2245
		"    public static void main(String[] args) {\n" +
2246
		"        java.util.Arrays.asList(new @Readonly Object @SingleMember(1) [] {\"1\"});\n" +
2247
		"    }\n" +
2248
		"}\n";
2249
	String expectedUnitToString =
2250
		"class X {\n" +
2251
		"  X() {\n" +
2252
		"    super();\n" +
2253
		"  }\n" +
2254
		"  public static void main(String[] args) {\n" +
2255
		"    java.util.Arrays.asList(new @Readonly Object @SingleMember(1) []{\"1\"});\n" +
2256
		"  }\n" +
2257
		"}\n";
2258
	checkParse(source.toCharArray(), null, "test0093", expectedUnitToString );
2259
}
2260
2261
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2262
public void test0094() throws IOException {
2263
	String source =
2264
		"class X {\n" +
2265
		"	public boolean test() {\n" +
2266
		"		String[] s;\n" +
2267
		"		s = foo(new @Marker String @SingleMember(1) []{\"hello\"});\n" +
2268
		"		return s != null;\n" +
2269
		"	}\n" +
2270
		"	public <@Marker F> F @SingleMember(1) [] foo(F[] f) {\n" +
2271
		"		return f;\n" +
2272
		"	}\n" +
2273
		"}";
2274
	String expectedUnitToString =
2275
		"class X {\n" +
2276
		"  X() {\n" +
2277
		"    super();\n" +
2278
		"  }\n" +
2279
		"  public boolean test() {\n" +
2280
		"    String[] s;\n" +
2281
		"    s = foo(new @Marker String @SingleMember(1) []{\"hello\"});\n" +
2282
		"    return (s != null);\n" +
2283
		"  }\n" +
2284
		"  public <@Marker F>F @SingleMember(1) [] foo(F[] f) {\n" +
2285
		"    return f;\n" +
2286
		"  }\n" +
2287
		"}\n";
2288
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0094", expectedUnitToString );
2289
}
2290
2291
// To test Parser.consumeArrayCreationExpressionWithInitializer() with Type Annotations
2292
public void test0095() throws IOException {
2293
	String source =
2294
		"import java.util.Arrays;\n" +
2295
		"import java.util.List;\n" +
2296
		"@Marker class Deejay {\n" +
2297
		"	@Marker class Counter<@Marker T> {}\n" +
2298
		"	public void f(String[] args) {\n" +
2299
		"		Counter<@Positive Integer> songCounter;\n" +
2300
		"		songCounter = new Counter<@Positive Integer>();\n" +
2301
		"		Counter<@Readonly String> genre;\n" +
2302
		"		genre = new Counter<@Readonly String>();\n" +
2303
		"		List<@Marker Counter<?>> list1;\n" +
2304
		"		list1 = Arrays.asList(new @Marker Counter<?> @Normal(value = 2) @Marker [] {songCounter, genre});\n" +
2305
		"	}\n" +
2306
		"}\n";
2307
	String expectedUnitToString =
2308
		"import java.util.Arrays;\n" +
2309
		"import java.util.List;\n" +
2310
		"@Marker class Deejay {\n" +
2311
		"  @Marker class Counter<@Marker T> {\n" +
2312
		"    Counter() {\n" +
2313
		"      super();\n" +
2314
		"    }\n" +
2315
		"  }\n" +
2316
		"  Deejay() {\n" +
2317
		"    super();\n" +
2318
		"  }\n" +
2319
		"  public void f(String[] args) {\n" +
2320
		"    Counter<@Positive Integer> songCounter;\n" +
2321
		"    songCounter = new Counter<@Positive Integer>();\n" +
2322
		"    Counter<@Readonly String> genre;\n" +
2323
		"    genre = new Counter<@Readonly String>();\n" +
2324
		"    List<@Marker Counter<?>> list1;\n" +
2325
		"    list1 = Arrays.asList(new @Marker Counter<?> @Normal(value = 2) @Marker []{songCounter, genre});\n" +
2326
		"  }\n" +
2327
		"}\n";
2328
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0095", expectedUnitToString );
2329
}
2330
2331
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2332
public void test0096() throws IOException {
2333
	String source =
2334
		"class X <@Marker T extends @Readonly String> {\n" +
2335
		"    public static void main(String[] args) {\n" +
2336
		"		int [] x1;\n" +
2337
		"		x1 = new int @Marker @SingleMember(10) [10];\n" +
2338
		"       Integer [][] x2;\n" +
2339
		"		x2 = new @Positive Integer @Marker [10] @Normal(value = 10) [10];\n" +
2340
		"		char[][] tokens;\n" +
2341
		"		tokens = new char @SingleMember(0) [0] @Normal(value = 10) @Marker [];\n" +
2342
		"    }\n" +
2343
		"}\n";
2344
	String expectedUnitToString =
2345
		"class X<@Marker T extends @Readonly String> {\n" +
2346
		"  X() {\n" +
2347
		"    super();\n" +
2348
		"  }\n" +
2349
		"  public static void main(String[] args) {\n" +
2350
		"    int[] x1;\n" +
2351
		"    x1 = new int @Marker @SingleMember(10) [10];\n" +
2352
		"    Integer[][] x2;\n" +
2353
		"    x2 = new @Positive Integer @Marker [10] @Normal(value = 10) [10];\n" +
2354
		"    char[][] tokens;\n" +
2355
		"    tokens = new char @SingleMember(0) [0] @Normal(value = 10) @Marker [];\n" +
2356
		"  }\n" +
2357
		"}\n";
2358
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0096", expectedUnitToString );
2359
}
2360
2361
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2362
public void test0097() throws IOException {
2363
	String source =
2364
		"class X {\n" +
2365
		"	public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2366
		"		return new @Readonly Object @Normal(value = 10) [10];\n" +
2367
		"	}\n" +
2368
		"}";
2369
	String expectedUnitToString =
2370
		"class X {\n" +
2371
		"  X() {\n" +
2372
		"    super();\n" +
2373
		"  }\n" +
2374
		"  public @Readonly Object @Normal(value = 10) [] f() @Marker {\n" +
2375
		"    return new @Readonly Object @Normal(value = 10) [10];\n" +
2376
		"  }\n" +
2377
		"}\n";
2378
	checkParse(source.toCharArray(), null, "test0097", expectedUnitToString );
2379
}
2380
2381
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2382
public void test0098() throws IOException {
2383
	String source =
2384
		"class X {\n" +
2385
		"	public boolean test() {\n" +
2386
		"		String[] s;\n" +
2387
		"		s = foo(new @Marker String @SingleMember(1) [10]);\n" +
2388
		"		return s != null;\n" +
2389
		"	}\n" +
2390
		"	public <@Marker F> F @SingleMember(1) [] foo(F[] f) {\n" +
2391
		"		return f;\n" +
2392
		"	}\n" +
2393
		"}";
2394
	String expectedUnitToString =
2395
		"class X {\n" +
2396
		"  X() {\n" +
2397
		"    super();\n" +
2398
		"  }\n" +
2399
		"  public boolean test() {\n" +
2400
		"    String[] s;\n" +
2401
		"    s = foo(new @Marker String @SingleMember(1) [10]);\n" +
2402
		"    return (s != null);\n" +
2403
		"  }\n" +
2404
		"  public <@Marker F>F @SingleMember(1) [] foo(F[] f) {\n" +
2405
		"    return f;\n" +
2406
		"  }\n" +
2407
		"}\n";
2408
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0098", expectedUnitToString );
2409
}
2410
2411
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2412
public void test0099() throws IOException {
2413
	String source =
2414
		"import java.util.Arrays;\n" +
2415
		"import java.util.List;\n" +
2416
		"class X<@Marker T> {\n" +
2417
		"	public void test() {\n" +
2418
		"		List<@Marker X<?>> a;\n" +
2419
		"		a = Arrays.asList(new @Marker X<?> @SingleMember(0) [0]);\n" +
2420
		"		String @Marker [] @SingleMember(1) [] x;\n" +
2421
		"		x = new @Readonly String @Normal(value = 5) [5] @SingleMember(1) [1];\n" +
2422
		"	}\n" +
2423
		"}";
2424
	String expectedUnitToString =
2425
		"import java.util.Arrays;\n" +
2426
		"import java.util.List;\n" +
2427
		"class X<@Marker T> {\n" +
2428
		"  X() {\n" +
2429
		"    super();\n" +
2430
		"  }\n" +
2431
		"  public void test() {\n" +
2432
		"    List<@Marker X<?>> a;\n" +
2433
		"    a = Arrays.asList(new @Marker X<?> @SingleMember(0) [0]);\n" +
2434
		"    String @Marker [] @SingleMember(1) [] x;\n" +
2435
		"    x = new @Readonly String @Normal(value = 5) [5] @SingleMember(1) [1];\n" +
2436
		"  }\n" +
2437
		"}\n";
2438
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0099", expectedUnitToString );
2439
}
2440
2441
// To test Parser.consumeArrayCreationExpressionWithoutInitializer() with Type Annotations
2442
public void test0100() throws IOException {
2443
	String source =
2444
		"import java.util.*;\n" +
2445
		"class X {\n" +
2446
		"    public Integer[] getTypes() {\n" +
2447
		"        List<@Positive Integer> list;\n" +
2448
		"		 list = new ArrayList<@Positive Integer>();\n" +
2449
		"        return list == null \n" +
2450
		"            ? new @Positive Integer @SingleMember(0) [0] \n" +
2451
		"            : list.toArray(new @Positive Integer @Marker [list.size()]);\n" +
2452
		"    }\n" +
2453
		"}";
2454
	String expectedUnitToString =
2455
		"import java.util.*;\n" +
2456
		"class X {\n" +
2457
		"  X() {\n" +
2458
		"    super();\n" +
2459
		"  }\n" +
2460
		"  public Integer[] getTypes() {\n" +
2461
		"    List<@Positive Integer> list;\n" +
2462
		"    list = new ArrayList<@Positive Integer>();\n" +
2463
		"    return ((list == null) ? new @Positive Integer @SingleMember(0) [0] : list.toArray(new @Positive Integer @Marker [list.size()]));\n" +
2464
		"  }\n" +
2465
		"}\n";
2466
	checkParse(source.toCharArray(), null, "test0100", expectedUnitToString );
2467
}
2468
2469
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2470
public void test0101() throws IOException {
2471
	String source =
2472
		"import java.util.*;\n" +
2473
		"\n" +
2474
		"@Marker class X {\n" +
2475
		"    Vector<Object> data;\n" +
2476
		"    public void t() {\n" +
2477
		"        Vector<@Readonly Object> v;\n" +
2478
		" 		 v = (@Marker @SingleMember(0) Vector<@Readonly Object>) data.elementAt(0);\n" +
2479
		"    }\n" +
2480
		"}\n";
2481
	String expectedUnitToString =
2482
		"import java.util.*;\n" +
2483
		"@Marker class X {\n" +
2484
		"  Vector<Object> data;\n" +
2485
		"  X() {\n" +
2486
		"    super();\n" +
2487
		"  }\n" +
2488
		"  public void t() {\n" +
2489
		"    Vector<@Readonly Object> v;\n" +
2490
		"    v = (@Marker @SingleMember(0) Vector<@Readonly Object>) data.elementAt(0);\n" +
2491
		"  }\n" +
2492
		"}\n";
2493
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0101", expectedUnitToString );
2494
}
2495
2496
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2497
// To test Parser.consumeClassHeaderExtends() with Type Annotations
2498
public void test0102() throws IOException {
2499
	String source =
2500
		"class X<E> {\n" +
2501
		"    X<@Readonly String> bar() {\n" +
2502
		"    	return (@Marker AX<@Readonly String>) new X<@Readonly String>();\n" +
2503
		"    }\n" +
2504
		"    X<@Readonly String> bar(Object o) {\n" +
2505
		"    	return (@Marker AX<@Readonly String>) o;\n" +
2506
		"    }\n" +
2507
		"    X<@Negative E> foo(Object o) {\n" +
2508
		"    	return (@Marker @Normal(value = 10) AX<@Negative E>) o;\n" +
2509
		"    }    \n" +
2510
		"    X<E> baz(Object o) {\n" +
2511
		"    	return (@Marker AX<E>) null;\n" +
2512
		"    }\n" +
2513
		"    X<String> baz2(BX bx) {\n" +
2514
		"    	return (@Marker @SingleMember(10) X<String>) bx;\n" +
2515
		"    }\n" +
2516
		"}\n" +
2517
		"@Normal(value = 1) class AX<@Marker F> extends @Marker X<@SingleMember(10)F> {}\n" +
2518
		"@Normal(value = 2) class BX extends @Marker @SingleMember(1) AX<@Readonly String> {}\n";
2519
	String expectedUnitToString =
2520
		"class X<E> {\n" +
2521
		"  X() {\n" +
2522
		"    super();\n" +
2523
		"  }\n" +
2524
		"  X<@Readonly String> bar() {\n" +
2525
		"    return (@Marker AX<@Readonly String>) new X<@Readonly String>();\n" +
2526
		"  }\n" +
2527
		"  X<@Readonly String> bar(Object o) {\n" +
2528
		"    return (@Marker AX<@Readonly String>) o;\n" +
2529
		"  }\n" +
2530
		"  X<@Negative E> foo(Object o) {\n" +
2531
		"    return (@Marker @Normal(value = 10) AX<@Negative E>) o;\n" +
2532
		"  }\n" +
2533
		"  X<E> baz(Object o) {\n" +
2534
		"    return (@Marker AX<E>) null;\n" +
2535
		"  }\n" +
2536
		"  X<String> baz2(BX bx) {\n" +
2537
		"    return (@Marker @SingleMember(10) X<String>) bx;\n" +
2538
		"  }\n" +
2539
		"}\n" +
2540
		"@Normal(value = 1) class AX<@Marker F> extends @Marker X<@SingleMember(10) F> {\n" +
2541
		"  AX() {\n" +
2542
		"    super();\n" +
2543
		"  }\n" +
2544
		"}\n" +
2545
		"@Normal(value = 2) class BX extends @Marker @SingleMember(1) AX<@Readonly String> {\n" +
2546
		"  BX() {\n" +
2547
		"    super();\n" +
2548
		"  }\n" +
2549
		"}\n";
2550
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0102", expectedUnitToString );
2551
}
2552
2553
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2554
public void test0103() throws IOException {
2555
	String source =
2556
		"import java.lang.reflect.Array;\n" +
2557
		"@Marker class X<@Readonly T> {\n" +
2558
		"	T @SingleMember(0) [] theArray;\n" +
2559
		"	public X(Class<T> clazz) {\n" +
2560
		"		theArray = (@Marker @SingleMember(0) T @Normal(value = 10) []) Array.newInstance(clazz, 10); // Compiler warning\n" +
2561
		"	}\n" +
2562
		"}";
2563
	String expectedUnitToString =
2564
		"import java.lang.reflect.Array;\n" +
2565
		"@Marker class X<@Readonly T> {\n" +
2566
		"  T @SingleMember(0) [] theArray;\n" +
2567
		"  public X(Class<T> clazz) {\n" +
2568
		"    super();\n" +
2569
		"    theArray = (@Marker @SingleMember(0) T @Normal(value = 10) []) Array.newInstance(clazz, 10);\n" +
2570
		"  }\n" +
2571
		"}\n";
2572
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0103", expectedUnitToString );
2573
}
2574
2575
// To test Parser.consumeCastExpressionWithGenericsArray() with Type Annotations
2576
public void test0104() throws IOException {
2577
	String source =
2578
		"import java.util.*;\n" +
2579
		"class X {\n" +
2580
		"    void method(Object o) {\n" +
2581
		"		 if (o instanceof String[]){\n" +
2582
		"			 String[] s;\n" +
2583
		"			 s = (@Marker @Readonly String @Marker []) o;\n" +
2584
		"		 }\n" +
2585
		"        if (o instanceof @Readonly List<?>[]) {\n" +
2586
		"            List<?>[] es;\n" +
2587
		"			 es = (@Marker List<?> @SingleMember(0) []) o;\n" +
2588
		"        }\n" +
2589
		"    }\n" +
2590
		"}";
2591
	String expectedUnitToString =
2592
		"import java.util.*;\n" +
2593
		"class X {\n" +
2594
		"  X() {\n" +
2595
		"    super();\n" +
2596
		"  }\n" +
2597
		"  void method(Object o) {\n" +
2598
		"    if ((o instanceof String[]))\n" +
2599
		"        {\n" +
2600
		"          String[] s;\n" +
2601
		"          s = (@Marker @Readonly String @Marker []) o;\n" +
2602
		"        }\n" +
2603
		"    if ((o instanceof @Readonly List<?>[]))\n" +
2604
		"        {\n" +
2605
		"          List<?>[] es;\n" +
2606
		"          es = (@Marker List<?> @SingleMember(0) []) o;\n" +
2607
		"        }\n" +
2608
		"  }\n" +
2609
		"}\n";
2610
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0104", expectedUnitToString );
2611
}
2612
2613
2614
// To test Parser.consumeCastExpressionWithPrimitiveType() with Type Annotations
2615
public void test0105() throws IOException {
2616
	String source =
2617
		"import java.util.HashMap;\n" +
2618
		"class X {\n" +
2619
		"	public static void main(String[] args) {\n" +
2620
		"		HashMap<Byte, Byte> subst;\n" +
2621
		"		subst = new HashMap<Byte, Byte>();\n" +
2622
		"		subst.put((@Marker byte)1, (@Positive byte)1);\n" +
2623
		"		if (1 + subst.get((@Positive @Normal(value = 10) byte)1) > 0.f) {\n" +
2624
		"			System.out.println(\"SUCCESS\");\n" +
2625
		"		}		\n" +
2626
		"	}\n" +
2627
		"}\n";
2628
	String expectedUnitToString =
2629
		"import java.util.HashMap;\n" +
2630
		"class X {\n" +
2631
		"  X() {\n" +
2632
		"    super();\n" +
2633
		"  }\n" +
2634
		"  public static void main(String[] args) {\n" +
2635
		"    HashMap<Byte, Byte> subst;\n" +
2636
		"    subst = new HashMap<Byte, Byte>();\n" +
2637
		"    subst.put((@Marker byte) 1, (@Positive byte) 1);\n" +
2638
		"    if (((1 + subst.get((@Positive @Normal(value = 10) byte) 1)) > 0.f))\n" +
2639
		"        {\n" +
2640
		"          System.out.println(\"SUCCESS\");\n" +
2641
		"        }\n" +
2642
		"  }\n" +
2643
		"}\n";
2644
	checkParse(source.toCharArray(), null, "test0105", expectedUnitToString );
2645
}
2646
2647
// To test Parser.consumeCastExpressionWithPrimitiveType() with Type Annotations
2648
public void test0106() throws IOException {
2649
	String source =
2650
		"class X{\n" +
2651
		"	private float x, y, z;\n" +
2652
		"	float magnitude () {\n" +
2653
		"		return (@Marker @Positive float) Math.sqrt((x*x) + (y*y) + (z*z));\n" +
2654
		"	}\n" +
2655
		"}\n";
2656
	String expectedUnitToString =
2657
		"class X {\n" +
2658
		"  private float x;\n" +
2659
		"  private float y;\n" +
2660
		"  private float z;\n" +
2661
		"  X() {\n" +
2662
		"    super();\n" +
2663
		"  }\n" +
2664
		"  float magnitude() {\n" +
2665
		"    return (@Marker @Positive float) Math.sqrt((((x * x) + (y * y)) + (z * z)));\n" +
2666
		"  }\n" +
2667
		"}\n";
2668
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0106", expectedUnitToString );
2669
}
2670
2671
// To test Parser.consumeCastExpressionWithQualifiedGenericsArray() with Type Annotations
2672
// Javac version b76 crashes on type annotations on type arguments to parameterized classes
2673
// in a qualified generic reference
2674
public void test0107() throws IOException {
2675
	String source =
2676
		"class C1<T> {\n" +
2677
		"	class C11 {	}\n" +
2678
		"	@Marker class C12 {\n" +
2679
		"		T t;\n" +
2680
		"		C1<@Readonly T>.C11 m() {\n" +
2681
		"			C1<@Readonly T>.C11[] ts;\n" +
2682
		"			ts = (@Marker C1<@Readonly T>.C11[]) new @Marker C1<?>.C11 @Normal(value = 5) [5];\n" +
2683
		"			return ts;\n" +
2684
		"		}\n" +
2685
		"	}\n" +
2686
		"}\n";
2687
	String expectedUnitToString =
2688
		"class C1<T> {\n" +
2689
		"  class C11 {\n" +
2690
		"    C11() {\n" +
2691
		"      super();\n" +
2692
		"    }\n" +
2693
		"  }\n" +
2694
		"  @Marker class C12 {\n" +
2695
		"    T t;\n" +
2696
		"    C12() {\n" +
2697
		"      super();\n" +
2698
		"    }\n" +
2699
		"    C1<@Readonly T>.C11 m() {\n" +
2700
		"      C1<@Readonly T>.C11[] ts;\n" +
2701
		"      ts = ( @Marker C1<@Readonly T>.C11[]) new  @Marker C1<?>.C11 @Normal(value = 5) [5];\n" +
2702
		"      return ts;\n" +
2703
		"    }\n" +
2704
		"  }\n" +
2705
		"  C1() {\n" +
2706
		"    super();\n" +
2707
		"  }\n" +
2708
		"}\n";
2709
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0107", expectedUnitToString );
2710
}
2711
2712
// To test Parser.consumeFormalParameter() with Type Annotations
2713
public void test0108() throws IOException {
2714
	String source =
2715
		"class X {\n" +
2716
		"	int field;" +
2717
		"	public void test(@Marker X x,@Positive int i){\n" +
2718
		"		x.field = i;\n" +
2719
		"	}\n" +
2720
		"	public static void main(@Readonly String args @Normal(10) []){" +
2721
		"		System.exit(0);\n" +
2722
		"	}\n" +
2723
		"}\n";
2724
	String expectedUnitToString =
2725
		"class X {\n" +
2726
		"  int field;\n" +
2727
		"  X() {\n" +
2728
		"    super();\n" +
2729
		"  }\n" +
2730
		"  public void test(@Marker X x, @Positive int i) {\n" +
2731
		"    x.field = i;\n" +
2732
		"  }\n" +
2733
		"  public static void main(@Readonly String @Normal(10) [] args) {\n" +
2734
		"    System.exit(0);\n" +
2735
		"  }\n" +
2736
		"}\n";
2737
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0108", expectedUnitToString );
2738
}
2739
2740
// To test Parser.consumeFormalParameter() with Type Annotations
2741
public void test0109() throws IOException {
2742
	String source =
2743
		"class X<@Marker T> {\n" +
2744
		"	T field;" +
2745
		"	public void test(@Marker @SingleMember(1) X<? extends @Marker Object> x,@Positive T i){\n" +
2746
		"	}\n" +
2747
		"}\n";
2748
	String expectedUnitToString =
2749
		"class X<@Marker T> {\n" +
2750
		"  T field;\n" +
2751
		"  X() {\n" +
2752
		"    super();\n" +
2753
		"  }\n" +
2754
		"  public void test(@Marker @SingleMember(1) X<? extends @Marker Object> x, @Positive T i) {\n" +
2755
		"  }\n" +
2756
		"}\n";
2757
	checkParse(source.toCharArray(), null, "test0109", expectedUnitToString );
2758
}
2759
2760
// To test Parser.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments()
2761
// with Type Annotations
2762
// Javac b76 crashes with type annotations in qualified class instance creation expression
2763
public void test0110() throws IOException {
2764
	String source =
2765
		"class X {\n" +
2766
		"	class MX {\n" +
2767
		"		@Marker <T> MX(T t){\n" +
2768
		"			System.out.println(t);\n" +
2769
		"		}\n" +
2770
		"	}\n" +
2771
		"	public static void main(String[] args) {\n" +
2772
		"		new @Marker @SingleMember(10) X().new <@Readonly String> @Marker MX(\"SUCCESS\");\n" +
2773
		"	}\n" +
2774
		"}\n";
2775
	String expectedUnitToString =
2776
		"class X {\n" +
2777
		"  class MX {\n" +
2778
		"    @Marker <T>MX(T t) {\n" +
2779
		"      super();\n" +
2780
		"      System.out.println(t);\n" +
2781
		"    }\n" +
2782
		"  }\n" +
2783
		"  X() {\n" +
2784
		"    super();\n" +
2785
		"  }\n" +
2786
		"  public static void main(String[] args) {\n" +
2787
		"    new @Marker @SingleMember(10) X().new <@Readonly String>@Marker MX(\"SUCCESS\");\n" +
2788
		"  }\n" +
2789
		"}\n";
2790
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0110", expectedUnitToString );
2791
}
2792
2793
// To test Parser.consumeClassInstanceCreationExpressionWithTypeArguments()
2794
// with Type Annotations
2795
public void test0111() throws IOException {
2796
	String source =
2797
		"class X {\n" +
2798
		"	public <T> X(T t){\n" +
2799
		"		System.out.println(t);\n" +
2800
		"	}\n" +
2801
		"	public static void main(String[] args) {\n" +
2802
		"		new <@Readonly String> @Marker @SingleMember(0) X(\"SUCCESS\");\n" +
2803
		"	}\n" +
2804
		"}\n";
2805
	String expectedUnitToString =
2806
		"class X {\n" +
2807
		"  public <T>X(T t) {\n" +
2808
		"    super();\n" +
2809
		"    System.out.println(t);\n" +
2810
		"  }\n" +
2811
		"  public static void main(String[] args) {\n" +
2812
		"    new <@Readonly String>@Marker @SingleMember(0) X(\"SUCCESS\");\n" +
2813
		"  }\n" +
2814
		"}\n";
2815
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0111", expectedUnitToString );
2816
}
2817
2818
// To test Parser.consumeEnhancedForStatementHeaderInit() with Type Annotations
2819
public void test0112() throws IOException {
2820
	String source =
2821
		"import java.util.*;\n" +
2822
		"class X {\n" +
2823
		"   List list() { return null; }\n" +
2824
		"   void m2() { for (@SingleMember(10) Iterator<@Marker X> i = list().iterator(); i.hasNext();); }\n" +
2825
		"	void m3() {\n" +
2826
		"		Integer [] array;\n" +
2827
		"		array = new Integer [] {1, 2, 3};\n" +
2828
		"		List<List<X>> xList;\n" +
2829
		"		xList = null;\n" +
2830
		"		for(@Positive @SingleMember(10) Integer i: array) {}\n" +
2831
		"		for(@Marker @Normal(value = 5) List<@Readonly X> x: xList) {}\n" +
2832
		"	}" +
2833
		"}\n";
2834
	String expectedUnitToString =
2835
		"import java.util.*;\n" +
2836
		"class X {\n" +
2837
		"  X() {\n" +
2838
		"    super();\n" +
2839
		"  }\n" +
2840
		"  List list() {\n" +
2841
		"    return null;\n" +
2842
		"  }\n" +
2843
		"  void m2() {\n" +
2844
		"    for (@SingleMember(10) Iterator<@Marker X> i = list().iterator();; i.hasNext(); ) \n" +
2845
		"      ;\n" +
2846
		"  }\n" +
2847
		"  void m3() {\n" +
2848
		"    Integer[] array;\n" +
2849
		"    array = new Integer[]{1, 2, 3};\n" +
2850
		"    List<List<X>> xList;\n" +
2851
		"    xList = null;\n" +
2852
		"    for (@Positive @SingleMember(10) Integer i : array) \n" +
2853
		"      {\n" +
2854
		"      }\n" +
2855
		"    for (@Marker @Normal(value = 5) List<@Readonly X> x : xList) \n" +
2856
		"      {\n" +
2857
		"      }\n" +
2858
		"  }\n" +
2859
		"}\n";
2860
	checkParse(CHECK_ALL & ~CHECK_COMPLETION_PARSER & ~CHECK_SELECTION_PARSER & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0112", expectedUnitToString );
2861
	expectedUnitToString =
2862
		"import java.util.*;\n" +
2863
		"class X {\n" +
2864
		"  X() {\n" +
2865
		"    super();\n" +
2866
		"  }\n" +
2867
		"  List list() {\n" +
2868
		"    return null;\n" +
2869
		"  }\n" +
2870
		"  void m2() {\n" +
2871
		"    for (@SingleMember(10) Iterator<@Marker X> i;; i.hasNext(); ) \n" +
2872
		"      ;\n" +
2873
		"  }\n" +
2874
		"  void m3() {\n" +
2875
		"    Integer[] array;\n" +
2876
		"    array = new Integer[]{1, 2, 3};\n" +
2877
		"    List<List<X>> xList;\n" +
2878
		"    xList = null;\n" +
2879
		"    for (@Positive @SingleMember(10) Integer i : array) \n" +
2880
		"      {\n" +
2881
		"      }\n" +
2882
		"    for (@Marker @Normal(value = 5) List<@Readonly X> x : xList) \n" +
2883
		"      {\n" +
2884
		"      }\n" +
2885
		"  }\n" +
2886
		"}\n";
2887
	checkParse(CHECK_COMPLETION_PARSER & CHECK_SELECTION_PARSER, source.toCharArray(), null, "test0112", expectedUnitToString );
2888
}
2889
2890
// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations
2891
public void test0113() throws IOException {
2892
	String source =
2893
		"@Marker class X {\n" +
2894
		"  void f() @Normal(value = 5) {\n" +
2895
		"    new @Marker @SingleMember(10) Object() {\n" +
2896
		"      void foo(){\n" +
2897
		"        System.out.println(\"test\");\n" +
2898
		"      }\n" +
2899
		"    }.foo();\n" +
2900
		"  }\n" +
2901
		"}";
2902
	String expectedUnitToString =
2903
		"@Marker class X {\n" +
2904
		"  X() {\n" +
2905
		"    super();\n" +
2906
		"  }\n" +
2907
		"  void f() @Normal(value = 5) {\n" +
2908
		"    new @Marker @SingleMember(10) Object() {\n" +
2909
		"  void foo() {\n" +
2910
		"    System.out.println(\"test\");\n" +
2911
		"  }\n" +
2912
		"}.foo();\n" +
2913
		"  }\n" +
2914
		"}\n";
2915
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0113", expectedUnitToString );
2916
}
2917
2918
// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations
2919
public void test0114() throws IOException {
2920
	String source =
2921
		"class Toplevel2{\n" +
2922
		"    public boolean foo(){\n" +
2923
		"    Toplevel2 o;\n" +
2924
		"	 o = new @Marker @Normal(value = 5) Toplevel2() { \n" +
2925
		"              public boolean foo() {  return false; }  // no copy in fact\n" +
2926
		"              };\n" +
2927
		"    return o.foo();\n" +
2928
		"  }\n" +
2929
		"}";
2930
	String expectedUnitToString =
2931
		"class Toplevel2 {\n" +
2932
		"  Toplevel2() {\n" +
2933
		"    super();\n" +
2934
		"  }\n" +
2935
		"  public boolean foo() {\n" +
2936
		"    Toplevel2 o;\n" +
2937
		"    o = new @Marker @Normal(value = 5) Toplevel2() {\n" +
2938
		"  public boolean foo() {\n" +
2939
		"    return false;\n" +
2940
		"  }\n" +
2941
		"};\n" +
2942
		"    return o.foo();\n" +
2943
		"  }\n" +
2944
		"}\n";
2945
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0114", expectedUnitToString );
2946
}
2947
2948
// To test Parser.consumeEnterAnonymousClassBody() with Type Annotations
2949
public void test0115() throws IOException {
2950
	String source =
2951
		"class X <T> {\n" +
2952
		"    T foo(T t) {\n" +
2953
		"        System.out.println(t);\n" +
2954
		"        return t;\n" +
2955
		"    }\n" +
2956
		"    public static void main(String @Normal(value =  5) [] args) {\n" +
2957
		"        new @Marker X<@SingleMember(10) @Normal(value = 5) XY>() {\n" +
2958
		"            void run() {\n" +
2959
		"                foo(new @Marker XY());\n" +
2960
		"            }\n" +
2961
		"        }.run();\n" +
2962
		"    }\n" +
2963
		"}\n" +
2964
		"@Marker class XY {\n" +
2965
		"    public String toString() {\n" +
2966
		"        return \"SUCCESS\";\n" +
2967
		"    }\n" +
2968
		"}\n";
2969
	String expectedUnitToString =
2970
		"class X<T> {\n" +
2971
		"  X() {\n" +
2972
		"    super();\n" +
2973
		"  }\n" +
2974
		"  T foo(T t) {\n" +
2975
		"    System.out.println(t);\n" +
2976
		"    return t;\n" +
2977
		"  }\n" +
2978
		"  public static void main(String @Normal(value = 5) [] args) {\n" +
2979
		"    new @Marker X<@SingleMember(10) @Normal(value = 5) XY>() {\n" +
2980
		"  void run() {\n" +
2981
		"    foo(new @Marker XY());\n" +
2982
		"  }\n" +
2983
		"}.run();\n" +
2984
		"  }\n" +
2985
		"}\n" +
2986
		"@Marker class XY {\n" +
2987
		"  XY() {\n" +
2988
		"    super();\n" +
2989
		"  }\n" +
2990
		"  public String toString() {\n" +
2991
		"    return \"SUCCESS\";\n" +
2992
		"  }\n" +
2993
		"}\n";
2994
	checkParse(CHECK_ALL & ~CHECK_DOCUMENT_ELEMENT_PARSER, source.toCharArray(), null, "test0115", expectedUnitToString );
2995
}
2996
2997
// To test Parser.consumeInsideCastExpressionLL1() with Type Annotations
2998
public void test0116() throws IOException {
2999
	String source =
3000
		"class X{\n" +
3001
		"  public void test1(){\n" +
3002
		"    throw (@Marker Error) null; \n" +
3003
		"  }  \n" +
3004
		"  public void test2(){\n" +
3005
		"    String s;\n" +
3006
		"	 s = (@Marker @SingleMember(10) String) null;\n" +
3007
		"	 byte b;\n" +
3008
		"	 b = 0;\n" +
3009
		"	 Byte i;\n" +
3010
		"	 i = (@Positive Byte) b;\n" +
3011
		"  }  \n" +
3012
		"  public void test3(java.io.Serializable name) {\n" +
3013
		"     Object temp;\n" +
3014
		"	  temp = (Object)name;\n" +
3015
		"     System.out.println( (String)temp );\n" +
3016
		"  }\n" +
3017
		"}";
3018
	String expectedUnitToString =
3019
		"class X {\n" +
3020
		"  X() {\n" +
3021
		"    super();\n" +
3022
		"  }\n" +
3023
		"  public void test1() {\n" +
3024
		"    throw (@Marker Error) null;\n" +
3025
		"  }\n" +
3026
		"  public void test2() {\n" +
3027
		"    String s;\n" +
3028
		"    s = (@Marker @SingleMember(10) String) null;\n" +
3029
		"    byte b;\n" +
3030
		"    b = 0;\n" +
3031
		"    Byte i;\n" +
3032
		"    i = (@Positive Byte) b;\n" +
3033
		"  }\n" +
3034
		"  public void test3(java.io.Serializable name) {\n" +
3035
		"    Object temp;\n" +
3036
		"    temp = (Object) name;\n" +
3037
		"    System.out.println((String) temp);\n" +
3038
		"  }\n" +
3039
		"}\n";
3040
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0116", expectedUnitToString );
3041
}
3042
3043
// To test Parser.consumeInstanceOfExpression() with Type Annotations
3044
public void test0117() throws IOException {
3045
	String source =
3046
		"import java.util.*;\n" +
3047
		"class X <@NonNull T>{\n" +
3048
		" 	public void test1(Object obj) @Marker {\n" +
3049
		"   	if(obj instanceof @Marker @NonNull X) {\n" +
3050
		"		 	X newX;\n" +
3051
		"		 	newX = (@NonNull X) obj;\n" +
3052
		"	 }\n" +
3053
		"   }\n" +
3054
		"	@NonNull T foo(@NonNull T t) @Marker {\n" +
3055
		"       if (t instanceof @NonNull @Marker List<?> @Normal(value = 10) []) {\n" +
3056
		"           List<?> @SingleMember (10) [] es;\n" +
3057
		"			es = (@Marker List<?> @SingleMember(10) []) t;\n" +
3058
		"       }\n" +
3059
		"		if (t instanceof @Marker @Normal(value = 5) X<?>) {\n" +
3060
		"			return t;\n" +
3061
		"		}\n" +
3062
		"		return t;\n" +
3063
		"	}\n" +
3064
		"}";
3065
	String expectedUnitToString =
3066
		"import java.util.*;\n" +
3067
		"class X<@NonNull T> {\n" +
3068
		"  X() {\n" +
3069
		"    super();\n" +
3070
		"  }\n" +
3071
		"  public void test1(Object obj) @Marker {\n" +
3072
		"    if ((obj instanceof @Marker @NonNull X))\n" +
3073
		"        {\n" +
3074
		"          X newX;\n" +
3075
		"          newX = (@NonNull X) obj;\n" +
3076
		"        }\n" +
3077
		"  }\n" +
3078
		"  @NonNull T foo(@NonNull T t) @Marker {\n" +
3079
		"    if ((t instanceof @NonNull @Marker List<?> @Normal(value = 10) []))\n" +
3080
		"        {\n" +
3081
		"          List<?> @SingleMember(10) [] es;\n" +
3082
		"          es = (@Marker List<?> @SingleMember(10) []) t;\n" +
3083
		"        }\n" +
3084
		"    if ((t instanceof @Marker @Normal(value = 5) X<?>))\n" +
3085
		"        {\n" +
3086
		"          return t;\n" +
3087
		"        }\n" +
3088
		"    return t;\n" +
3089
		"  }\n" +
3090
		"}\n";
3091
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER , source.toCharArray(), null, "test0117", expectedUnitToString );
3092
}
3093
3094
// To test Parser.consumeInstanceOfExpressionWithName() with Type Annotations
3095
public void test0118() throws IOException {
3096
	String source =
3097
		"class Outer<E> {\n" +
3098
		"  Inner inner;\n" +
3099
		"  class Inner {\n" +
3100
		"    E e;\n" +
3101
		"    @NonNull E getOtherElement(Object other) @Marker {\n" +
3102
		"      if (!(other instanceof @Marker @SingleMember(10) Outer<?>.Inner))\n" +
3103
		"       throw new @Marker IllegalArgumentException(String.valueOf(other));\n" +
3104
		"      Inner that;\n" +
3105
		"	   that = (@Marker Inner) other;\n" +
3106
		"      return that.e;\n" +
3107
		"    }\n" +
3108
		"  }\n" +
3109
		"}";
3110
	String expectedUnitToString =
3111
		"class Outer<E> {\n" +
3112
		"  class Inner {\n" +
3113
		"    E e;\n" +
3114
		"    Inner() {\n" +
3115
		"      super();\n" +
3116
		"    }\n" +
3117
		"    @NonNull E getOtherElement(Object other) @Marker {\n" +
3118
		"      if ((! (other instanceof  @Marker @SingleMember(10) Outer<?>.Inner)))\n" +
3119
		"          throw new @Marker IllegalArgumentException(String.valueOf(other));\n" +
3120
		"      Inner that;\n" +
3121
		"      that = (@Marker Inner) other;\n" +
3122
		"      return that.e;\n" +
3123
		"    }\n" +
3124
		"  }\n" +
3125
		"  Inner inner;\n" +
3126
		"  Outer() {\n" +
3127
		"    super();\n" +
3128
		"  }\n" +
3129
		"}\n";
3130
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER , source.toCharArray(), null, "test0118", expectedUnitToString );
3131
}
3132
3133
// To test Parser.consumeTypeArgument() with Type Annotations
3134
public void test0119() throws IOException {
3135
	String source =
3136
		"class X<@SingleMember(1) Xp1 extends @Readonly String, @NonNull Xp2 extends @NonNull Comparable>  extends @Marker XS<@SingleMember(10) Xp2> {\n" +
3137
		"\n" +
3138
		"    public static void main(String @Marker [] args) {\n" +
3139
		"        Integer w;\n" +
3140
		"        w = new @Marker X<@Readonly @SingleMember(10) String,@Positive Integer>().get(new @Positive Integer(12));\n" +
3141
		"        System.out.println(\"SUCCESS\");\n" +
3142
		"	 }\n" +
3143
		"    Xp2 get(Xp2 t) @Marker {\n" +
3144
		"        System.out.print(\"{X::get}\");\n" +
3145
		"        return super.get(t);\n" +
3146
		"    }\n" +
3147
		"}\n" +
3148
		"@Marker class XS <@NonNull XSp1> {\n" +
3149
		"    XSp1 get(XSp1 t) @Marker {\n" +
3150
		"		 @NonNull @SingleMember(10) Y.M mObject;\n" +
3151
		"		 mObject = new @SingleMember(10) @NonNull Y.M();\n" +
3152
		"        System.out.print(\"{XS::get}\");\n" +
3153
		"        return t;\n" +
3154
		"    }\n" +
3155
		"}\n" +
3156
		"class X2<T,E>{}\n" +
3157
		"@Marker class Y extends @Marker X2<@NonNull Y.M, @NonNull @SingleMember(1) Y.N> {\n" +
3158
		"	static class M{}\n" +
3159
		"	static class N extends M{}\n" +
3160
		"}\n";
3161
	String expectedUnitToString =
3162
		"class X<@SingleMember(1) Xp1 extends @Readonly String, @NonNull Xp2 extends @NonNull Comparable> extends @Marker XS<@SingleMember(10) Xp2> {\n" +
3163
		"  X() {\n" +
3164
		"    super();\n" +
3165
		"  }\n" +
3166
		"  public static void main(String @Marker [] args) {\n" +
3167
		"    Integer w;\n" +
3168
		"    w = new @Marker X<@Readonly @SingleMember(10) String, @Positive Integer>().get(new @Positive Integer(12));\n" +
3169
		"    System.out.println(\"SUCCESS\");\n" +
3170
		"  }\n" +
3171
		"  Xp2 get(Xp2 t) @Marker {\n" +
3172
		"    System.out.print(\"{X::get}\");\n" +
3173
		"    return super.get(t);\n" +
3174
		"  }\n" +
3175
		"}\n" +
3176
		"@Marker class XS<@NonNull XSp1> {\n" +
3177
		"  XS() {\n" +
3178
		"    super();\n" +
3179
		"  }\n" +
3180
		"  XSp1 get(XSp1 t) @Marker {\n" +
3181
		"    @NonNull @SingleMember(10) Y.M mObject;\n" +
3182
		"    mObject = new @SingleMember(10) @NonNull Y.M();\n" +
3183
		"    System.out.print(\"{XS::get}\");\n" +
3184
		"    return t;\n" +
3185
		"  }\n" +
3186
		"}\n" +
3187
		"class X2<T, E> {\n" +
3188
		"  X2() {\n" +
3189
		"    super();\n" +
3190
		"  }\n" +
3191
		"}\n" +
3192
		"@Marker class Y extends @Marker X2<@NonNull Y.M, @NonNull @SingleMember(1) Y.N> {\n" +
3193
		"  static class M {\n" +
3194
		"    M() {\n" +
3195
		"      super();\n" +
3196
		"    }\n" +
3197
		"  }\n" +
3198
		"  static class N extends M {\n" +
3199
		"    N() {\n" +
3200
		"      super();\n" +
3201
		"    }\n" +
3202
		"  }\n" +
3203
		"  Y() {\n" +
3204
		"    super();\n" +
3205
		"  }\n" +
3206
		"}\n";
3207
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0119", expectedUnitToString );
3208
}
3209
3210
// To test Parser.consumeTypeArgument() with Type Annotations
3211
public void test0120() throws IOException {
3212
	String source =
3213
		"class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" +
3214
		"}\n" +
3215
		"class Y {\n" +
3216
		"	@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" +
3217
		"}\n";
3218
	String expectedUnitToString =
3219
		"class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" +
3220
		"  X() {\n" +
3221
		"    super();\n" +
3222
		"  }\n" +
3223
		"}\n" +
3224
		"class Y {\n" +
3225
		"  @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" +
3226
		"  Y() {\n" +
3227
		"    super();\n" +
3228
		"  }\n" +
3229
		"}\n";
3230
	checkParse(source.toCharArray(), null, "test0120", expectedUnitToString );
3231
}
3232
3233
// To test Parser.consumeTypeArgumentReferenceType1() with Type Annotations
3234
public void test0121() throws IOException {
3235
	String source =
3236
		"@Marker class X <@NonNull T> {\n" +
3237
		"    protected T t;\n" +
3238
		"    @Marker X(@NonNull T t) {\n" +
3239
		"        this.t = t;\n" +
3240
		"    }\n" +
3241
		"    public static void main(String[] args) {\n" +
3242
		"	  X<@Marker X<@Readonly @NonNull String>> xs;\n" +
3243
		"	  xs = new @Marker X<@Marker X<@Readonly @NonNull String>>(new @Marker X<@Readonly @NonNull @SingleMember(10) String>(\"SUCCESS\"));\n" +
3244
		"	  System.out.println(xs.t.t);\n" +
3245
		"    }\n" +
3246
		"}\n";
3247
	String expectedUnitToString =
3248
		"@Marker class X<@NonNull T> {\n" +
3249
		"  protected T t;\n" +
3250
		"  @Marker X(@NonNull T t) {\n" +
3251
		"    super();\n" +
3252
		"    this.t = t;\n" +
3253
		"  }\n" +
3254
		"  public static void main(String[] args) {\n" +
3255
		"    X<@Marker X<@Readonly @NonNull String>> xs;\n" +
3256
		"    xs = new @Marker X<@Marker X<@Readonly @NonNull String>>(new @Marker X<@Readonly @NonNull @SingleMember(10) String>(\"SUCCESS\"));\n" +
3257
		"    System.out.println(xs.t.t);\n" +
3258
		"  }\n" +
3259
		"}\n";
3260
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0121", expectedUnitToString );
3261
}
3262
3263
// To test Parser.consumeTypeParameter1WithExtendsAndBounds() and Parser.consumeWildcardBoundsSuper() with
3264
// Type Annotations
3265
public void test0122() throws IOException {
3266
	String source =
3267
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable<@Marker Foo1> {\n" +
3268
		"	public int compareTo(Foo1 arg0) {\n" +
3269
		"		return 0;\n" +
3270
		"	}\n" +
3271
		"}\n" +
3272
		"class Foo1 {}\n" +
3273
		"@Marker class X<@NonNull T extends @NonNull @Normal (value = 5) Object & @Marker Comparable<? super @NonNull T>> {\n" +
3274
		"    public static void main(String[] args) {\n" +
3275
		"        new @Marker @SingleMember(10) X<@Marker Foo>();\n" +
3276
		"    }\n" +
3277
		"}\n";
3278
	String expectedUnitToString =
3279
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable<@Marker Foo1> {\n" +
3280
		"  Foo() {\n" +
3281
		"    super();\n" +
3282
		"  }\n" +
3283
		"  public int compareTo(Foo1 arg0) {\n" +
3284
		"    return 0;\n" +
3285
		"  }\n" +
3286
		"}\n" +
3287
		"class Foo1 {\n" +
3288
		"  Foo1() {\n" +
3289
		"    super();\n" +
3290
		"  }\n" +
3291
		"}\n" +
3292
		"@Marker class X<@NonNull T extends @NonNull @Normal(value = 5) Object & @Marker Comparable<? super @NonNull T>> {\n" +
3293
		"  X() {\n" +
3294
		"    super();\n" +
3295
		"  }\n" +
3296
		"  public static void main(String[] args) {\n" +
3297
		"    new @Marker @SingleMember(10) X<@Marker Foo>();\n" +
3298
		"  }\n" +
3299
		"}\n";
3300
	checkParse(source.toCharArray(), null, "test0122", expectedUnitToString );
3301
}
3302
3303
// To test Parser.consumeTypeParameter1WithExtendsAndBounds() with Type Annotations
3304
public void test0123() throws IOException {
3305
	String source =
3306
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable {\n" +
3307
		"	public int compareTo(Object arg0) {\n" +
3308
		"		return 0;\n" +
3309
		"	}\n" +
3310
		"}\n" +
3311
		"class Foo1 {}\n" +
3312
		"@Marker class X<@NonNull T extends @NonNull @Normal (value = 5) Object & @Marker Comparable, @NonNull V extends @Readonly Object> {\n" +
3313
		"    public static void main(String[] args) {\n" +
3314
		"        new @Marker @SingleMember(10) X<@Marker Foo, @SingleMember(0) Foo1>();\n" +
3315
		"		 Class <@NonNull Foo> c;\n" +
3316
		"		 c = @Readonly @NonNull Foo.class;\n" +
3317
		"    }\n" +
3318
		"}\n";
3319
	String expectedUnitToString =
3320
		"@Marker class Foo extends @Marker Foo1 implements @Marker @SingleMember(10) Comparable {\n" +
3321
		"  Foo() {\n" +
3322
		"    super();\n" +
3323
		"  }\n" +
3324
		"  public int compareTo(Object arg0) {\n" +
3325
		"    return 0;\n" +
3326
		"  }\n" +
3327
		"}\n" +
3328
		"class Foo1 {\n" +
3329
		"  Foo1() {\n" +
3330
		"    super();\n" +
3331
		"  }\n" +
3332
		"}\n" +
3333
		"@Marker class X<@NonNull T extends @NonNull @Normal(value = 5) Object & @Marker Comparable, @NonNull V extends @Readonly Object> {\n" +
3334
		"  X() {\n" +
3335
		"    super();\n" +
3336
		"  }\n" +
3337
		"  public static void main(String[] args) {\n" +
3338
		"    new @Marker @SingleMember(10) X<@Marker Foo, @SingleMember(0) Foo1>();\n" +
3339
		"    Class<@NonNull Foo> c;\n" +
3340
		"    c = @Readonly @NonNull Foo.class;\n" +
3341
		"  }\n" +
3342
		"}\n";
3343
	checkParse(source.toCharArray(), null, "test0123", expectedUnitToString );
3344
}
3345
3346
// To test type annotations on static class member access in a declaration
3347
public void test0124() throws IOException {
3348
	String source =
3349
		"@Marker class Foo {\n" +
3350
		"	static @Marker @SingleMember(0) class Foo1 {}\n" +
3351
		"   public static void main(String[] args) {\n" +
3352
		"       @Marker @Normal(value = 5) Foo.Foo1 foo1Object;\n" +
3353
		"		foo1Object = new @Marker @Normal(value = 5) Foo.Foo1();\n" +
3354
		"		Class <@NonNull Foo.Foo1> c;\n" +
3355
		"		c = @Readonly @NonNull Foo.Foo1.class;\n" +
3356
		"    }\n" +
3357
		"}\n";
3358
	String expectedUnitToString =
3359
		"@Marker class Foo {\n" +
3360
		"  static @Marker @SingleMember(0) class Foo1 {\n" +
3361
		"    Foo1() {\n" +
3362
		"      super();\n" +
3363
		"    }\n" +
3364
		"  }\n" +
3365
		"  Foo() {\n" +
3366
		"    super();\n" +
3367
		"  }\n" +
3368
		"  public static void main(String[] args) {\n" +
3369
		"    @Marker @Normal(value = 5) Foo.Foo1 foo1Object;\n" +
3370
		"    foo1Object = new @Marker @Normal(value = 5) Foo.Foo1();\n" +
3371
		"    Class<@NonNull Foo.Foo1> c;\n" +
3372
		"    c = @Readonly @NonNull Foo.Foo1.class;\n" +
3373
		"  }\n" +
3374
		"}\n";
3375
	checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER, source.toCharArray(), null, "test0124", expectedUnitToString );
3376
}
3377
//To test type annotations on static class member access in a declaration
3378
public void test0125() throws IOException {
3379
	String source =
3380
		"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> {}";
3381
	String expectedUnitToString =
3382
		"public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> {\n" + 
3383
		"  public X() {\n" + 
3384
		"    super();\n" + 
3385
		"  }\n" + 
3386
		"}\n";
3387
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0125", expectedUnitToString );
3388
}
3389
//To test type annotations on static class member access in a declaration
3390
public void test0126() throws IOException {
3391
	String source =
3392
		"public class X {\n" +
3393
		"	@A(\"Hello, World!\") @B @C('(') String@E[] @D[] f;\n" +
3394
		"}";
3395
	String expectedUnitToString =
3396
		"public class X {\n" + 
3397
		"  @A(\"Hello, World!\") @B @C(\'(\') String @E [] @D [] f;\n" + 
3398
		"  public X() {\n" + 
3399
		"    super();\n" + 
3400
		"  }\n" + 
3401
		"}\n";
3402
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0126", expectedUnitToString );
3403
}
3404
//To test type annotations on static class member access in a declaration
3405
public void test0127() throws IOException {
3406
	String source =
3407
		"public class X {\n" +
3408
		"	@A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> f;\n" +
3409
		"}";
3410
	String expectedUnitToString =
3411
		"public class X {\n" + 
3412
		"  @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> f;\n" + 
3413
		"  public X() {\n" + 
3414
		"    super();\n" + 
3415
		"  }\n" + 
3416
		"}\n";
3417
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0127", expectedUnitToString );
3418
}
3419
//type class literal expression
3420
public void test0128() throws IOException {
3421
	String source = 
3422
	"public class X {\n" + 
3423
	"	public boolean foo(String s) {\n" + 
3424
	"		return (s instanceof @C('_') Object[]);\n" + 
3425
	"	}\n" + 
3426
	"	public Object foo1(String s) {\n" + 
3427
	"		return new @B(3) @A(\"new Object\") Object[] {};\n" + 
3428
	"	}\n" + 
3429
	"	public Class foo2(String s) {\n" + 
3430
	"		return @B(4) Object[].class;\n" + 
3431
	"	}\n" + 
3432
	"	public Class foo3(String s) {\n" + 
3433
	"		return @A(\"int class literal\")  @B(5) int[].class;\n" + 
3434
	"	}\n" + 
3435
	"}";
3436
	String expectedUnitToString = 
3437
		"public class X {\n" + 
3438
		"  public X() {\n" + 
3439
		"    super();\n" + 
3440
		"  }\n" + 
3441
		"  public boolean foo(String s) {\n" + 
3442
		"    return (s instanceof @C(\'_\') Object[]);\n" + 
3443
		"  }\n" + 
3444
		"  public Object foo1(String s) {\n" + 
3445
		"    return new @B(3) @A(\"new Object\") Object[]{};\n" + 
3446
		"  }\n" + 
3447
		"  public Class foo2(String s) {\n" + 
3448
		"    return @B(4) Object[].class;\n" + 
3449
		"  }\n" + 
3450
		"  public Class foo3(String s) {\n" + 
3451
		"    return @A(\"int class literal\") @B(5) int[].class;\n" + 
3452
		"  }\n" + 
3453
		"}\n";
3454
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0128", expectedUnitToString );
3455
}
3456
//instanceof checks 
3457
public void test0129() throws IOException {
3458
	String source = "public class Clazz {\n" +
3459
					"public static void main(Object o) {\n" +
3460
					"if (o instanceof @Readonly String) {\n" +
3461
					"}\n" +
3462
					"}\n" +
3463
					"}";
3464
	String expectedUnitToString = 
3465
		"public class Clazz {\n" + 
3466
		"  public Clazz() {\n" + 
3467
		"    super();\n" + 
3468
		"  }\n" + 
3469
		"  public static void main(Object o) {\n" + 
3470
		"    if ((o instanceof @Readonly String))\n" + 
3471
		"        {\n" + 
3472
		"        }\n" + 
3473
		"  }\n" + 
3474
		"}\n";
3475
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0129", expectedUnitToString);
3476
}
3477
//instanceof checks 
3478
public void test0130() throws IOException {
3479
	String source = "public class Clazz {\n" +
3480
					"public static void foo() {\n" +
3481
					"	if (o instanceof @Readonly String[]) {}" +
3482
					"}\n" +
3483
					"}";
3484
	String expectedUnitToString = 
3485
		"public class Clazz {\n" + 
3486
		"  public Clazz() {\n" + 
3487
		"    super();\n" + 
3488
		"  }\n" + 
3489
		"  public static void foo() {\n" + 
3490
		"    if ((o instanceof @Readonly String[]))\n" + 
3491
		"        {\n" + 
3492
		"        }\n" + 
3493
		"  }\n" + 
3494
		"}\n";
3495
	checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3496
}
3497
//cast
3498
public void test0131() throws IOException {
3499
	String source =
3500
		"public class X {\n" + 
3501
		"	public void foo(Object o) {\n" + 
3502
		"		if (o instanceof String[][]) {\n" +
3503
		"			String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" +
3504
		"			System.out.println(tab.length);\n" +
3505
		"		}\n" + 
3506
		"		System.out.println(o);\n" +
3507
		"	}\n" + 
3508
		"}";
3509
	String expectedUnitToString = 
3510
		"public class X {\n" + 
3511
		"  public X() {\n" + 
3512
		"    super();\n" + 
3513
		"  }\n" + 
3514
		"  public void foo(Object o) {\n" + 
3515
		"    if ((o instanceof String[][]))\n" + 
3516
		"        {\n" + 
3517
		"          String[][] tab = (@C(\'_\') @B(3) String[] @A []) o;\n" + 
3518
		"          System.out.println(tab.length);\n" + 
3519
		"        }\n" + 
3520
		"    System.out.println(o);\n" + 
3521
		"  }\n" + 
3522
		"}\n";
3523
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3524
}
3525
//cast
3526
public void test0132() throws IOException {
3527
	String source =
3528
		"public class X {\n" + 
3529
		"	public void foo(Object o) {\n" + 
3530
		"		if (o instanceof String[][]) {\n" +
3531
		"			String[][] tab = (@C('_') @B(3) String@D[] @A[]) o;\n" +
3532
		"			System.out.println(tab.length);\n" +
3533
		"		}\n" + 
3534
		"		System.out.println(o);\n" +
3535
		"	}\n" + 
3536
		"}";
3537
	String expectedUnitToString = 
3538
		"public class X {\n" + 
3539
		"  public X() {\n" + 
3540
		"    super();\n" + 
3541
		"  }\n" + 
3542
		"  public void foo(Object o) {\n" + 
3543
		"    if ((o instanceof String[][]))\n" + 
3544
		"        {\n" + 
3545
		"          String[][] tab = (@C(\'_\') @B(3) String @D [] @A []) o;\n" + 
3546
		"          System.out.println(tab.length);\n" + 
3547
		"        }\n" + 
3548
		"    System.out.println(o);\n" + 
3549
		"  }\n" + 
3550
		"}\n";
3551
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3552
}
3553
//generic type arguments in a generic method invocation
3554
public void test0133() throws IOException {
3555
	String source =
3556
		"public class X {\n" +
3557
		"	static <T, U> T foo(T t, U u) {\n" +
3558
		"		return t;\n" +
3559
		"	}\n" +
3560
		"	public static void main(String[] args) {\n" +
3561
		"		System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
3562
		"	}\n" +
3563
		"}\n";
3564
	String expectedUnitToString = 
3565
		"public class X {\n" + 
3566
		"  public X() {\n" + 
3567
		"    super();\n" + 
3568
		"  }\n" + 
3569
		"  static <T, U>T foo(T t, U u) {\n" + 
3570
		"    return t;\n" + 
3571
		"  }\n" + 
3572
		"  public static void main(String[] args) {\n" + 
3573
		"    System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + 
3574
		"  }\n" + 
3575
		"}\n";
3576
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3577
}
3578
//generic type arguments in a generic method invocation
3579
public void test0134() throws IOException {
3580
	String source =
3581
		"public class X {\n" +
3582
		"\n" +
3583
		"	<T, U> T foo(T t, U u) {\n" +
3584
		"		return t;\n" +
3585
		"	}\n" +
3586
		"	public static void main(String[] args) {\n" +
3587
		"		X x = new X();\n" +
3588
		"		System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
3589
		"	}\n" +
3590
		"}\n";
3591
	String expectedUnitToString = 
3592
		"public class X {\n" + 
3593
		"  public X() {\n" + 
3594
		"    super();\n" + 
3595
		"  }\n" + 
3596
		"  <T, U>T foo(T t, U u) {\n" + 
3597
		"    return t;\n" + 
3598
		"  }\n" + 
3599
		"  public static void main(String[] args) {\n" +
3600
		"    X x = new X();\n" +
3601
		"    System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" + 
3602
		"  }\n" + 
3603
		"}\n";
3604
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3605
}
3606
//generic type arguments in a generic constructor invocation
3607
public void test0135() throws IOException {
3608
	String source =
3609
		"public class X {\n" +
3610
		"	<T, U> X(T t, U u) {\n" +
3611
		"	}\n" +
3612
		"	public static void main(String[] args) {\n" +
3613
		"		X x = new <@D() @A(value = \"hello\") String, @B X> X();\n" +
3614
		"		System.out.println(x);\n" +
3615
		"	}\n" +
3616
		"}\n";
3617
	String expectedUnitToString = 
3618
		"public class X {\n" + 
3619
		"  <T, U>X(T t, U u) {\n" + 
3620
		"    super();\n" + 
3621
		"  }\n" + 
3622
		"  public static void main(String[] args) {\n" + 
3623
		"    X x = new <@D() @A(value = \"hello\") String, @B X>X();\n" + 
3624
		"    System.out.println(x);\n" + 
3625
		"  }\n" + 
3626
		"}\n";
3627
	checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
3628
}
3629
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 551-557 Link Here
551
551
552
// https://bugs.eclipse.org/331872 -  [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
552
// https://bugs.eclipse.org/331872 -  [compiler] NPE in Scope.createArrayType when attempting qualified access from type parameter
553
public void test018() throws Exception {
553
public void test018() throws Exception {
554
	if (this.complianceLevel < ClassFileConstants.JDK1_5)
554
	if (new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_5)
555
		return;
555
		return;
556
	this.runNegativeTest(
556
	this.runNegativeTest(
557
		new String[] {
557
		new String[] {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (-2 / +46 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2010 IBM Corporation and others.
2
 * Copyright (c) 2006, 2011 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 13-18 Link Here
13
package org.eclipse.jdt.core.tests.compiler.regression;
13
package org.eclipse.jdt.core.tests.compiler.regression;
14
14
15
import java.lang.reflect.Field;
15
import java.lang.reflect.Field;
16
import java.util.Arrays;
17
import java.util.Comparator;
16
import java.util.HashMap;
18
import java.util.HashMap;
17
import java.util.Map;
19
import java.util.Map;
18
20
Lines 44-50 Link Here
44
  	// Only the highest compliance level is run; add the VM argument
46
  	// Only the highest compliance level is run; add the VM argument
45
  	// -Dcompliance=1.4 (for example) to lower it if needed
47
  	// -Dcompliance=1.4 (for example) to lower it if needed
46
  	static {
48
  	static {
47
//    	TESTS_NAMES = new String[] { "test001" };
49
//    	TESTS_NAMES = new String[] { "test003_task_tags_options" };
48
//    	TESTS_NUMBERS = new int[] { 1 };
50
//    	TESTS_NUMBERS = new int[] { 1 };
49
//    	TESTS_RANGE = new int[] { 1, -1 };
51
//    	TESTS_RANGE = new int[] { 1, -1 };
50
//  	TESTS_RANGE = new int[] { 1, 2049 };
52
//  	TESTS_RANGE = new int[] { 1, 2049 };
Lines 456-468 Link Here
456
		expectedProblemAttributes.put("HierarchyHasProblems", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
458
		expectedProblemAttributes.put("HierarchyHasProblems", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
457
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
459
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
458
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
460
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
461
		expectedProblemAttributes.put("IllegalBinaryLiteral", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
459
		expectedProblemAttributes.put("IllegalCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
462
		expectedProblemAttributes.put("IllegalCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
460
		expectedProblemAttributes.put("IllegalClassLiteralForTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
463
		expectedProblemAttributes.put("IllegalClassLiteralForTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
464
		expectedProblemAttributes.put("IllegalDangerousCharacter", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
461
		expectedProblemAttributes.put("IllegalDimension", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
465
		expectedProblemAttributes.put("IllegalDimension", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
462
		expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
466
		expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
467
		expectedProblemAttributes.put("IllegalExoticIdentifier", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
463
		expectedProblemAttributes.put("IllegalExtendedDimensions", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
468
		expectedProblemAttributes.put("IllegalExtendedDimensions", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
464
		expectedProblemAttributes.put("IllegalExtendedDimensionsForVarArgs", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
469
		expectedProblemAttributes.put("IllegalExtendedDimensionsForVarArgs", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
465
		expectedProblemAttributes.put("IllegalGenericArray", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
470
		expectedProblemAttributes.put("IllegalGenericArray", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
471
		expectedProblemAttributes.put("IllegalHexaLiteral", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
466
		expectedProblemAttributes.put("IllegalInstanceofParameterizedType", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
472
		expectedProblemAttributes.put("IllegalInstanceofParameterizedType", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
467
		expectedProblemAttributes.put("IllegalInstanceofTypeParameter", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
473
		expectedProblemAttributes.put("IllegalInstanceofTypeParameter", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
468
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
474
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 493-499 Link Here
493
		expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
499
		expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
494
		expectedProblemAttributes.put("IllegalStaticModifierForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
500
		expectedProblemAttributes.put("IllegalStaticModifierForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
495
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
501
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
502
		expectedProblemAttributes.put("IllegalUnderscorePosition", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
496
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
503
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
504
		expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
505
		expectedProblemAttributes.put("IllegalUsageOfUnderscore", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
497
		expectedProblemAttributes.put("IllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
506
		expectedProblemAttributes.put("IllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
498
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
507
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
499
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
508
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 537-548 Link Here
537
		expectedProblemAttributes.put("InterfaceNotVisible", DEPRECATED);
546
		expectedProblemAttributes.put("InterfaceNotVisible", DEPRECATED);
538
		expectedProblemAttributes.put("InternalTypeNameProvided", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
547
		expectedProblemAttributes.put("InternalTypeNameProvided", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
539
		expectedProblemAttributes.put("InvalidAnnotationMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
548
		expectedProblemAttributes.put("InvalidAnnotationMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
549
		expectedProblemAttributes.put("InvalidBinary", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
540
		expectedProblemAttributes.put("InvalidBreak", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
550
		expectedProblemAttributes.put("InvalidBreak", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
541
		expectedProblemAttributes.put("InvalidCatchBlockSequence", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
551
		expectedProblemAttributes.put("InvalidCatchBlockSequence", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
542
		expectedProblemAttributes.put("InvalidCharacterConstant", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
552
		expectedProblemAttributes.put("InvalidCharacterConstant", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
543
		expectedProblemAttributes.put("InvalidClassInstantiation", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
553
		expectedProblemAttributes.put("InvalidClassInstantiation", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
544
		expectedProblemAttributes.put("InvalidContinue", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
554
		expectedProblemAttributes.put("InvalidContinue", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
545
		expectedProblemAttributes.put("InvalidDigit", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
555
		expectedProblemAttributes.put("InvalidDigit", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
556
		expectedProblemAttributes.put("InvalidEmptyExoticIdentifier", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
546
		expectedProblemAttributes.put("InvalidEncoding", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
557
		expectedProblemAttributes.put("InvalidEncoding", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
547
		expectedProblemAttributes.put("InvalidEscape", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
558
		expectedProblemAttributes.put("InvalidEscape", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
548
		expectedProblemAttributes.put("InvalidExplicitConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
559
		expectedProblemAttributes.put("InvalidExplicitConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
Lines 553-558 Link Here
553
		expectedProblemAttributes.put("InvalidHighSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
564
		expectedProblemAttributes.put("InvalidHighSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
554
		expectedProblemAttributes.put("InvalidInput", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
565
		expectedProblemAttributes.put("InvalidInput", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
555
		expectedProblemAttributes.put("InvalidLowSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
566
		expectedProblemAttributes.put("InvalidLowSurrogate", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
567
		expectedProblemAttributes.put("InvalidLocationForModifiers", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
556
		expectedProblemAttributes.put("InvalidNullToSynchronized", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
568
		expectedProblemAttributes.put("InvalidNullToSynchronized", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
557
		expectedProblemAttributes.put("InvalidOctal", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
569
		expectedProblemAttributes.put("InvalidOctal", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
558
		expectedProblemAttributes.put("InvalidOperator", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
570
		expectedProblemAttributes.put("InvalidOperator", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
Lines 570-576 Link Here
570
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
582
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
571
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
583
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
572
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
584
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
585
		expectedProblemAttributes.put("InvalidUsageOfReceiverAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
573
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
586
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
587
		expectedProblemAttributes.put("InvalidUsageOfTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
574
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
588
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
575
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
589
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
576
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
590
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
Lines 665-670 Link Here
665
		expectedProblemAttributes.put("MethodRequiresBody", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
679
		expectedProblemAttributes.put("MethodRequiresBody", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
666
		expectedProblemAttributes.put("MethodReturnsVoid", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
680
		expectedProblemAttributes.put("MethodReturnsVoid", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
667
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
681
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
682
		expectedProblemAttributes.put("MisplacedTypeAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
668
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
683
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
669
		expectedProblemAttributes.put("MissingEnclosingInstance", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
684
		expectedProblemAttributes.put("MissingEnclosingInstance", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
670
		expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
685
		expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 842-847 Link Here
842
		expectedProblemAttributes.put("UnsafeReturnTypeOverride", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
857
		expectedProblemAttributes.put("UnsafeReturnTypeOverride", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
843
		expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
858
		expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
844
		expectedProblemAttributes.put("UnterminatedComment", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
859
		expectedProblemAttributes.put("UnterminatedComment", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
860
		expectedProblemAttributes.put("UnterminatedExoticIdentifier", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
845
		expectedProblemAttributes.put("UnterminatedString", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
861
		expectedProblemAttributes.put("UnterminatedString", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
846
		expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
862
		expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
847
		expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
863
		expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
Lines 871-876 Link Here
871
		StringBuffer failures = new StringBuffer();
887
		StringBuffer failures = new StringBuffer();
872
		StringBuffer correctResult = new StringBuffer(70000);
888
		StringBuffer correctResult = new StringBuffer(70000);
873
		Field[] fields = (iProblemClass = IProblem.class).getFields();
889
		Field[] fields = (iProblemClass = IProblem.class).getFields();
890
		Arrays.sort(fields, new Comparator() {
891
			public int compare(Object o1, Object o2) {
892
				Field field1 = (Field) o1;
893
				Field field2 = (Field) o2;
894
				return field1.getName().compareTo(field2.getName());
895
			}
896
		});
874
		boolean watchInternalCategory = false, printHeader = true;
897
		boolean watchInternalCategory = false, printHeader = true;
875
		for (int i = 0, length = fields.length; i < length; i++) {
898
		for (int i = 0, length = fields.length; i < length; i++) {
876
			Field field = fields[i];
899
			Field field = fields[i];
Lines 1093-1105 Link Here
1093
		expectedProblemAttributes.put("HierarchyHasProblems", SKIP);
1116
		expectedProblemAttributes.put("HierarchyHasProblems", SKIP);
1094
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", SKIP);
1117
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", SKIP);
1095
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", SKIP);
1118
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", SKIP);
1119
		expectedProblemAttributes.put("IllegalBinaryLiteral", SKIP);
1096
		expectedProblemAttributes.put("IllegalCast", SKIP);
1120
		expectedProblemAttributes.put("IllegalCast", SKIP);
1097
		expectedProblemAttributes.put("IllegalClassLiteralForTypeVariable", SKIP);
1121
		expectedProblemAttributes.put("IllegalClassLiteralForTypeVariable", SKIP);
1122
		expectedProblemAttributes.put("IllegalDangerousCharacter", SKIP);
1098
		expectedProblemAttributes.put("IllegalDimension", SKIP);
1123
		expectedProblemAttributes.put("IllegalDimension", SKIP);
1099
		expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", SKIP);
1124
		expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", SKIP);
1125
		expectedProblemAttributes.put("IllegalExoticIdentifier", SKIP);
1100
		expectedProblemAttributes.put("IllegalExtendedDimensions", SKIP);
1126
		expectedProblemAttributes.put("IllegalExtendedDimensions", SKIP);
1101
		expectedProblemAttributes.put("IllegalExtendedDimensionsForVarArgs", SKIP);
1127
		expectedProblemAttributes.put("IllegalExtendedDimensionsForVarArgs", SKIP);
1102
		expectedProblemAttributes.put("IllegalGenericArray", SKIP);
1128
		expectedProblemAttributes.put("IllegalGenericArray", SKIP);
1129
		expectedProblemAttributes.put("IllegalHexaLiteral", SKIP);
1103
		expectedProblemAttributes.put("IllegalInstanceofParameterizedType", SKIP);
1130
		expectedProblemAttributes.put("IllegalInstanceofParameterizedType", SKIP);
1104
		expectedProblemAttributes.put("IllegalInstanceofTypeParameter", SKIP);
1131
		expectedProblemAttributes.put("IllegalInstanceofTypeParameter", SKIP);
1105
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", SKIP);
1132
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", SKIP);
Lines 1130-1136 Link Here
1130
		expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", SKIP);
1157
		expectedProblemAttributes.put("IllegalQualifiedParameterizedTypeAllocation", SKIP);
1131
		expectedProblemAttributes.put("IllegalStaticModifierForMemberType", SKIP);
1158
		expectedProblemAttributes.put("IllegalStaticModifierForMemberType", SKIP);
1132
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", SKIP);
1159
		expectedProblemAttributes.put("IllegalTypeVariableSuperReference", SKIP);
1160
		expectedProblemAttributes.put("IllegalUnderscorePosition", SKIP);
1133
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", SKIP);
1161
		expectedProblemAttributes.put("IllegalUsageOfQualifiedTypeReference", SKIP);
1162
		expectedProblemAttributes.put("IllegalUsageOfTypeAnnotations", SKIP);
1163
		expectedProblemAttributes.put("IllegalUsageOfUnderscore", SKIP);
1134
		expectedProblemAttributes.put("IllegalVararg", SKIP);
1164
		expectedProblemAttributes.put("IllegalVararg", SKIP);
1135
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", SKIP);
1165
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForField", SKIP);
1136
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", SKIP);
1166
		expectedProblemAttributes.put("IllegalVisibilityModifierCombinationForMemberType", SKIP);
Lines 1174-1185 Link Here
1174
		expectedProblemAttributes.put("InterfaceNotVisible", SKIP);
1204
		expectedProblemAttributes.put("InterfaceNotVisible", SKIP);
1175
		expectedProblemAttributes.put("InternalTypeNameProvided", SKIP);
1205
		expectedProblemAttributes.put("InternalTypeNameProvided", SKIP);
1176
		expectedProblemAttributes.put("InvalidAnnotationMemberType", SKIP);
1206
		expectedProblemAttributes.put("InvalidAnnotationMemberType", SKIP);
1207
		expectedProblemAttributes.put("InvalidBinary", SKIP);
1177
		expectedProblemAttributes.put("InvalidBreak", SKIP);
1208
		expectedProblemAttributes.put("InvalidBreak", SKIP);
1178
		expectedProblemAttributes.put("InvalidCatchBlockSequence", SKIP);
1209
		expectedProblemAttributes.put("InvalidCatchBlockSequence", SKIP);
1179
		expectedProblemAttributes.put("InvalidCharacterConstant", SKIP);
1210
		expectedProblemAttributes.put("InvalidCharacterConstant", SKIP);
1180
		expectedProblemAttributes.put("InvalidClassInstantiation", SKIP);
1211
		expectedProblemAttributes.put("InvalidClassInstantiation", SKIP);
1181
		expectedProblemAttributes.put("InvalidContinue", SKIP);
1212
		expectedProblemAttributes.put("InvalidContinue", SKIP);
1182
		expectedProblemAttributes.put("InvalidDigit", SKIP);
1213
		expectedProblemAttributes.put("InvalidDigit", SKIP);
1214
		expectedProblemAttributes.put("InvalidEmptyExoticIdentifier", SKIP);
1183
		expectedProblemAttributes.put("InvalidEncoding", SKIP);
1215
		expectedProblemAttributes.put("InvalidEncoding", SKIP);
1184
		expectedProblemAttributes.put("InvalidEscape", SKIP);
1216
		expectedProblemAttributes.put("InvalidEscape", SKIP);
1185
		expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP);
1217
		expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP);
Lines 1190-1195 Link Here
1190
		expectedProblemAttributes.put("InvalidHighSurrogate", SKIP);
1222
		expectedProblemAttributes.put("InvalidHighSurrogate", SKIP);
1191
		expectedProblemAttributes.put("InvalidInput", SKIP);
1223
		expectedProblemAttributes.put("InvalidInput", SKIP);
1192
		expectedProblemAttributes.put("InvalidLowSurrogate", SKIP);
1224
		expectedProblemAttributes.put("InvalidLowSurrogate", SKIP);
1225
		expectedProblemAttributes.put("InvalidLocationForModifiers", SKIP);
1193
		expectedProblemAttributes.put("InvalidNullToSynchronized", SKIP);
1226
		expectedProblemAttributes.put("InvalidNullToSynchronized", SKIP);
1194
		expectedProblemAttributes.put("InvalidOctal", SKIP);
1227
		expectedProblemAttributes.put("InvalidOctal", SKIP);
1195
		expectedProblemAttributes.put("InvalidOperator", SKIP);
1228
		expectedProblemAttributes.put("InvalidOperator", SKIP);
Lines 1207-1213 Link Here
1207
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP);
1240
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP);
1208
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP);
1241
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP);
1209
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP);
1242
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP);
1243
		expectedProblemAttributes.put("InvalidUsageOfReceiverAnnotations", SKIP);
1210
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP);
1244
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP);
1245
		expectedProblemAttributes.put("InvalidUsageOfTypeAnnotations", SKIP);
1211
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", SKIP);
1246
		expectedProblemAttributes.put("InvalidUsageOfTypeArguments", SKIP);
1212
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", SKIP);
1247
		expectedProblemAttributes.put("InvalidUsageOfTypeParameters", SKIP);
1213
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", SKIP);
1248
		expectedProblemAttributes.put("InvalidUsageOfTypeParametersForAnnotationDeclaration", SKIP);
Lines 1302-1307 Link Here
1302
		expectedProblemAttributes.put("MethodRequiresBody", SKIP);
1337
		expectedProblemAttributes.put("MethodRequiresBody", SKIP);
1303
		expectedProblemAttributes.put("MethodReturnsVoid", SKIP);
1338
		expectedProblemAttributes.put("MethodReturnsVoid", SKIP);
1304
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST));
1339
		expectedProblemAttributes.put("MethodVarargsArgumentNeedCast", new ProblemAttributes(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST));
1340
		expectedProblemAttributes.put("MisplacedTypeAnnotations", SKIP);
1305
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", SKIP);
1341
		expectedProblemAttributes.put("MissingArgumentsForParameterizedMemberType", SKIP);
1306
		expectedProblemAttributes.put("MissingEnclosingInstance", SKIP);
1342
		expectedProblemAttributes.put("MissingEnclosingInstance", SKIP);
1307
		expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP);
1343
		expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP);
Lines 1478-1483 Link Here
1478
		expectedProblemAttributes.put("UnsafeReturnTypeOverride", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
1514
		expectedProblemAttributes.put("UnsafeReturnTypeOverride", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
1479
		expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
1515
		expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
1480
		expectedProblemAttributes.put("UnterminatedComment", SKIP);
1516
		expectedProblemAttributes.put("UnterminatedComment", SKIP);
1517
		expectedProblemAttributes.put("UnterminatedExoticIdentifier", SKIP);
1481
		expectedProblemAttributes.put("UnterminatedString", SKIP);
1518
		expectedProblemAttributes.put("UnterminatedString", SKIP);
1482
		expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING));
1519
		expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING));
1483
		expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_IMPORT));
1520
		expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_IMPORT));
Lines 1516-1521 Link Here
1516
		fields = IProblem.class.getFields();
1553
		fields = IProblem.class.getFields();
1517
		StringBuffer failures = new StringBuffer();
1554
		StringBuffer failures = new StringBuffer();
1518
		StringBuffer correctResult = new StringBuffer(70000);
1555
		StringBuffer correctResult = new StringBuffer(70000);
1556
		Arrays.sort(fields, new Comparator() {
1557
			public int compare(Object o1, Object o2) {
1558
				Field field1 = (Field) o1;
1559
				Field field2 = (Field) o2;
1560
				return field1.getName().compareTo(field2.getName());
1561
			}
1562
		});
1519
		for (int i = 0, length = fields.length; i < length; i++) {
1563
		for (int i = 0, length = fields.length; i < length; i++) {
1520
			Field field = fields[i];
1564
			Field field = fields[i];
1521
			if (field.getType() == Integer.TYPE) {
1565
			if (field.getType() == Integer.TYPE) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java (+923 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.compiler.regression;
12
13
import junit.framework.Test;
14
15
public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
16
17
	static { 
18
//		TESTS_NUMBERS = new int [] { 35 };
19
	}
20
	public static Class testClass() {
21
		return NegativeTypeAnnotationTest.class;
22
	}
23
	public static Test suite() {
24
		return buildMinimalComplianceTestSuite(testClass(), F_1_7);
25
	}
26
	public NegativeTypeAnnotationTest(String testName){
27
		super(testName);
28
	}
29
	public void test001() throws Exception {
30
		this.runNegativeTest(
31
				new String[] {
32
					"X.java",
33
					"public class X extends @Marker2 Object {}",
34
				},
35
				"----------\n" + 
36
				"1. ERROR in X.java (at line 1)\n" + 
37
				"	public class X extends @Marker2 Object {}\n" + 
38
				"	                        ^^^^^^^\n" + 
39
				"Marker2 cannot be resolved to a type\n" + 
40
				"----------\n");
41
	}
42
	public void test002() throws Exception {
43
		this.runNegativeTest(
44
				new String[] {
45
					"X.java",
46
					"import java.io.Serializable;\n" +
47
					"public class X implements @Marker2 Serializable {\n" +
48
					"	private static final long serialVersionUID = 1L;\n" +
49
					"}",
50
				},
51
				"----------\n" + 
52
				"1. ERROR in X.java (at line 2)\n" + 
53
				"	public class X implements @Marker2 Serializable {\n" + 
54
				"	                           ^^^^^^^\n" + 
55
				"Marker2 cannot be resolved to a type\n" + 
56
				"----------\n");
57
	}
58
	public void test003() throws Exception {
59
		this.runNegativeTest(
60
				new String[] {
61
					"X.java",
62
					"public class X extends @Marker Object {}",
63
				},
64
				"----------\n" + 
65
				"1. ERROR in X.java (at line 1)\n" + 
66
				"	public class X extends @Marker Object {}\n" + 
67
				"	                        ^^^^^^\n" + 
68
				"Marker cannot be resolved to a type\n" + 
69
				"----------\n");
70
	}
71
	public void test004() throws Exception {
72
		this.runNegativeTest(
73
				new String[] {
74
					"X.java",
75
					"public class X<@Marker T> {}",
76
				},
77
				"----------\n" + 
78
				"1. ERROR in X.java (at line 1)\n" + 
79
				"	public class X<@Marker T> {}\n" + 
80
				"	                ^^^^^^\n" + 
81
				"Marker cannot be resolved to a type\n" + 
82
				"----------\n");
83
	}
84
	public void test005() throws Exception {
85
		this.runNegativeTest(
86
				new String[] {
87
					"X.java",
88
					"public class X<@Marker T> {}",
89
				},
90
				"----------\n" + 
91
				"1. ERROR in X.java (at line 1)\n" + 
92
				"	public class X<@Marker T> {}\n" + 
93
				"	                ^^^^^^\n" + 
94
				"Marker cannot be resolved to a type\n" + 
95
				"----------\n");
96
	}
97
	public void test006() throws Exception {
98
		this.runNegativeTest(
99
			new String[] {
100
				"Y.java",
101
				"class Y {}\n",
102
				"X.java",
103
				"public class X extends @A(id=\"Hello, World!\") @B @C('(') Y {\n" + 
104
				"}",
105
		},
106
		"----------\n" + 
107
		"1. ERROR in X.java (at line 1)\n" + 
108
		"	public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + 
109
		"	                        ^\n" + 
110
		"A cannot be resolved to a type\n" + 
111
		"----------\n" + 
112
		"2. ERROR in X.java (at line 1)\n" + 
113
		"	public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + 
114
		"	                                               ^\n" + 
115
		"B cannot be resolved to a type\n" + 
116
		"----------\n" + 
117
		"3. ERROR in X.java (at line 1)\n" + 
118
		"	public class X extends @A(id=\"Hello, World!\") @B @C(\'(\') Y {\n" + 
119
		"	                                                  ^\n" + 
120
		"C cannot be resolved to a type\n" + 
121
		"----------\n");
122
	}
123
	public void test007() throws Exception {
124
		this.runNegativeTest(
125
			new String[] {
126
				"I.java",
127
				"interface I {}\n",
128
				"J.java",
129
				"interface J {}\n",
130
				"X.java",
131
				"public class X implements @A(id=\"Hello, World!\") I, @B @C('(') J {}",
132
		},
133
		"----------\n" + 
134
		"1. ERROR in X.java (at line 1)\n" + 
135
		"	public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + 
136
		"	                           ^\n" + 
137
		"A cannot be resolved to a type\n" + 
138
		"----------\n" + 
139
		"2. ERROR in X.java (at line 1)\n" + 
140
		"	public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + 
141
		"	                                                     ^\n" + 
142
		"B cannot be resolved to a type\n" + 
143
		"----------\n" + 
144
		"3. ERROR in X.java (at line 1)\n" + 
145
		"	public class X implements @A(id=\"Hello, World!\") I, @B @C(\'(\') J {}\n" + 
146
		"	                                                        ^\n" + 
147
		"C cannot be resolved to a type\n" + 
148
		"----------\n");
149
	}
150
	// class literal
151
	public void test008() throws Exception {
152
		this.runNegativeTest(
153
			new String[] {
154
				"I.java",
155
				"interface I {}\n",
156
				"J.java",
157
				"interface J {}\n",
158
				"X.java",
159
				"public class X {\n" + 
160
				"	public boolean foo(String s) {\n" + 
161
				"		return (s instanceof @C('_') Object);\n" + 
162
				"	}\n" + 
163
				"	public Object foo1(String s) {\n" + 
164
				"		return new @B(3) @A(\"new Object\") Object();\n" + 
165
				"	}\n" + 
166
				"	public Class<?> foo2(String s) {\n" + 
167
				"		return @B(4) Object.class;\n" + 
168
				"	}\n" + 
169
				"	public Class<?> foo3(String s) {\n" + 
170
				"		return @A(\"int class literal\")  @B(5) int.class;\n" + 
171
				"	}\n" + 
172
				"}",
173
		},
174
		"----------\n" + 
175
		"1. ERROR in X.java (at line 3)\n" + 
176
		"	return (s instanceof @C(\'_\') Object);\n" + 
177
		"	                      ^\n" + 
178
		"C cannot be resolved to a type\n" + 
179
		"----------\n" + 
180
		"2. ERROR in X.java (at line 6)\n" + 
181
		"	return new @B(3) @A(\"new Object\") Object();\n" + 
182
		"	            ^\n" + 
183
		"B cannot be resolved to a type\n" + 
184
		"----------\n" + 
185
		"3. ERROR in X.java (at line 6)\n" + 
186
		"	return new @B(3) @A(\"new Object\") Object();\n" + 
187
		"	                  ^\n" + 
188
		"A cannot be resolved to a type\n" + 
189
		"----------\n" + 
190
		"4. ERROR in X.java (at line 9)\n" + 
191
		"	return @B(4) Object.class;\n" + 
192
		"	        ^\n" + 
193
		"B cannot be resolved to a type\n" + 
194
		"----------\n" + 
195
		"5. ERROR in X.java (at line 12)\n" + 
196
		"	return @A(\"int class literal\")  @B(5) int.class;\n" + 
197
		"	        ^\n" + 
198
		"A cannot be resolved to a type\n" + 
199
		"----------\n" + 
200
		"6. ERROR in X.java (at line 12)\n" + 
201
		"	return @A(\"int class literal\")  @B(5) int.class;\n" + 
202
		"	                                 ^\n" + 
203
		"B cannot be resolved to a type\n" + 
204
		"----------\n");
205
	}
206
	// class literal generic and array
207
	public void test009() throws Exception {
208
		this.runNegativeTest(
209
			new String[] {
210
				"I.java",
211
				"interface I {}\n",
212
				"J.java",
213
				"interface J {}\n",
214
				"X.java",
215
				"public class X {\n" + 
216
				"	public boolean foo(Object o) {\n" + 
217
				"		return (o instanceof @C('_') Object[]);\n" + 
218
				"	}\n" + 
219
				"	public Object foo1(String s) {\n" + 
220
				"		return new @B(3) @A(\"new Object\") Object[] {};\n" + 
221
				"	}\n" + 
222
				"	public Class<?> foo2(String s) {\n" + 
223
				"		return @B(4) Object[].class;\n" + 
224
				"	}\n" + 
225
				"	public Class<?> foo3(String s) {\n" + 
226
				"		return @A(\"int class literal\")  @B(5) int[].class;\n" + 
227
				"	}\n" + 
228
				"}",
229
		},
230
		"----------\n" + 
231
		"1. ERROR in X.java (at line 3)\n" + 
232
		"	return (o instanceof @C(\'_\') Object[]);\n" + 
233
		"	                      ^\n" + 
234
		"C cannot be resolved to a type\n" + 
235
		"----------\n" + 
236
		"2. ERROR in X.java (at line 6)\n" + 
237
		"	return new @B(3) @A(\"new Object\") Object[] {};\n" + 
238
		"	            ^\n" + 
239
		"B cannot be resolved to a type\n" + 
240
		"----------\n" + 
241
		"3. ERROR in X.java (at line 6)\n" + 
242
		"	return new @B(3) @A(\"new Object\") Object[] {};\n" + 
243
		"	                  ^\n" + 
244
		"A cannot be resolved to a type\n" + 
245
		"----------\n" + 
246
		"4. ERROR in X.java (at line 9)\n" + 
247
		"	return @B(4) Object[].class;\n" + 
248
		"	        ^\n" + 
249
		"B cannot be resolved to a type\n" + 
250
		"----------\n" + 
251
		"5. ERROR in X.java (at line 12)\n" + 
252
		"	return @A(\"int class literal\")  @B(5) int[].class;\n" + 
253
		"	        ^\n" + 
254
		"A cannot be resolved to a type\n" + 
255
		"----------\n" + 
256
		"6. ERROR in X.java (at line 12)\n" + 
257
		"	return @A(\"int class literal\")  @B(5) int[].class;\n" + 
258
		"	                                 ^\n" + 
259
		"B cannot be resolved to a type\n" + 
260
		"----------\n");
261
	}
262
	public void test010() throws Exception {
263
		this.runNegativeTest(
264
			new String[] {
265
				"Y.java",
266
				"class Y<T> {}\n",
267
				"X.java",
268
				"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String> {\n" + 
269
				"}",
270
		},
271
		"----------\n" + 
272
		"1. ERROR in X.java (at line 1)\n" + 
273
		"	public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + 
274
		"	                        ^\n" + 
275
		"A cannot be resolved to a type\n" + 
276
		"----------\n" + 
277
		"2. ERROR in X.java (at line 1)\n" + 
278
		"	public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + 
279
		"	                                              ^\n" + 
280
		"B cannot be resolved to a type\n" + 
281
		"----------\n" + 
282
		"3. ERROR in X.java (at line 1)\n" + 
283
		"	public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String> {\n" + 
284
		"	                                                 ^\n" + 
285
		"C cannot be resolved to a type\n" + 
286
		"----------\n");
287
	}
288
	public void test011() throws Exception {
289
		this.runNegativeTest(
290
			new String[] {
291
				"I.java",
292
				"interface I<T> {}\n",
293
				"J.java",
294
				"interface J<T> {}\n",
295
				"X.java",
296
				"public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C('(') Integer> {}",
297
		},
298
		"----------\n" + 
299
		"1. ERROR in X.java (at line 1)\n" + 
300
		"	public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C(\'(\') Integer> {}\n" + 
301
		"	                             ^\n" + 
302
		"A cannot be resolved to a type\n" + 
303
		"----------\n" + 
304
		"2. ERROR in X.java (at line 1)\n" + 
305
		"	public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C(\'(\') Integer> {}\n" + 
306
		"	                                                           ^\n" + 
307
		"B cannot be resolved to a type\n" + 
308
		"----------\n" + 
309
		"3. ERROR in X.java (at line 1)\n" + 
310
		"	public class X implements I<@A(\"Hello, World!\") String>,  @B J<@C(\'(\') Integer> {}\n" + 
311
		"	                                                                ^\n" + 
312
		"C cannot be resolved to a type\n" + 
313
		"----------\n");
314
	}
315
	// throws
316
	public void test012() throws Exception {
317
		this.runNegativeTest(
318
			new String[] {
319
				"E.java",
320
				"class E extends RuntimeException {\n" +
321
				"	private static final long serialVersionUID = 1L;\n" +
322
				"}\n",
323
				"E1.java",
324
				"class E1 extends RuntimeException {\n" +
325
				"	private static final long serialVersionUID = 1L;\n" +
326
				"}\n",
327
				"E2.java",
328
				"class E2 extends RuntimeException {\n" +
329
				"	private static final long serialVersionUID = 1L;\n" +
330
				"}\n",
331
				"X.java",
332
				"public class X {\n" +
333
				"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C('(') E2 {}\n" +
334
				"}",
335
		},
336
		"----------\n" + 
337
		"1. ERROR in X.java (at line 2)\n" + 
338
		"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + 
339
		"	                   ^\n" + 
340
		"A cannot be resolved to a type\n" + 
341
		"----------\n" + 
342
		"2. ERROR in X.java (at line 2)\n" + 
343
		"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + 
344
		"	                                              ^\n" + 
345
		"B cannot be resolved to a type\n" + 
346
		"----------\n" + 
347
		"3. ERROR in X.java (at line 2)\n" + 
348
		"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C(\'(\') E2 {}\n" + 
349
		"	                                                 ^\n" + 
350
		"C cannot be resolved to a type\n" + 
351
		"----------\n");
352
	}
353
	// method receiver
354
	public void test013() throws Exception {
355
		this.runNegativeTest(
356
			new String[] {
357
				"X.java",
358
				"public class X {\n" + 
359
				"	void foo() @B(3) {}\n" + 
360
				"}",
361
		},
362
		"----------\n" + 
363
		"1. ERROR in X.java (at line 2)\n" + 
364
		"	void foo() @B(3) {}\n" + 
365
		"	            ^\n" + 
366
		"B cannot be resolved to a type\n" + 
367
		"----------\n");
368
	}
369
	// method return type
370
	public void test014() throws Exception {
371
		this.runNegativeTest(
372
			new String[] {
373
				"X.java",
374
				"public class X {\n" + 
375
				"	@B(3) int foo() {\n" +
376
				"		return 1;\n" +
377
				"	}\n" + 
378
				"}",
379
		},
380
		"----------\n" + 
381
		"1. ERROR in X.java (at line 2)\n" + 
382
		"	@B(3) int foo() {\n" + 
383
		"	 ^\n" + 
384
		"B cannot be resolved to a type\n" + 
385
		"----------\n");
386
	}
387
	// field type
388
	public void test015() throws Exception {
389
		this.runNegativeTest(
390
			new String[] {
391
				"X.java",
392
				"public class X {\n" + 
393
				"	@B(3) int field;\n" +
394
				"}",
395
		},
396
		"----------\n" + 
397
		"1. ERROR in X.java (at line 2)\n" + 
398
		"	@B(3) int field;\n" + 
399
		"	 ^\n" + 
400
		"B cannot be resolved to a type\n" + 
401
		"----------\n");
402
	}
403
	// method parameter
404
	public void test016() throws Exception {
405
		this.runNegativeTest(
406
			new String[] {
407
				"X.java",
408
				"public class X {\n" + 
409
				"	int foo(@B(3) String s) {\n" +
410
				"		return s.length();\n" +
411
				"	}\n" + 
412
				"}",
413
		},
414
		"----------\n" + 
415
		"1. ERROR in X.java (at line 2)\n" + 
416
		"	int foo(@B(3) String s) {\n" + 
417
		"	         ^\n" + 
418
		"B cannot be resolved to a type\n" + 
419
		"----------\n");
420
	}
421
	// method parameter generic or array
422
	public void test017() throws Exception {
423
		this.runNegativeTest(
424
			new String[] {
425
				"X.java",
426
				"public class X {\n" + 
427
				"	int foo(String @B(3) [] s) {\n" +
428
				"		return s.length;\n" +
429
				"	}\n" + 
430
				"}",
431
		},
432
		"----------\n" + 
433
		"1. ERROR in X.java (at line 2)\n" + 
434
		"	int foo(String @B(3) [] s) {\n" + 
435
		"	                ^\n" + 
436
		"B cannot be resolved to a type\n" + 
437
		"----------\n");
438
	}
439
	// field type generic or array
440
	public void test018() throws Exception {
441
		this.runNegativeTest(
442
			new String[] {
443
				"X.java",
444
				"public class X {\n" + 
445
				"	int @B(3) [] field;\n" +
446
				"}",
447
		},
448
		"----------\n" + 
449
		"1. ERROR in X.java (at line 2)\n" + 
450
		"	int @B(3) [] field;\n" + 
451
		"	     ^\n" + 
452
		"B cannot be resolved to a type\n" + 
453
		"----------\n");
454
	}
455
	// class type parameter
456
	public void test019() throws Exception {
457
		this.runNegativeTest(
458
			new String[] {
459
				"X.java",
460
				"public class X<@A @B(3) T> {}",
461
		},
462
		"----------\n" + 
463
		"1. ERROR in X.java (at line 1)\n" + 
464
		"	public class X<@A @B(3) T> {}\n" + 
465
		"	                ^\n" + 
466
		"A cannot be resolved to a type\n" + 
467
		"----------\n" + 
468
		"2. ERROR in X.java (at line 1)\n" + 
469
		"	public class X<@A @B(3) T> {}\n" + 
470
		"	                   ^\n" + 
471
		"B cannot be resolved to a type\n" + 
472
		"----------\n");
473
	}
474
	// method type parameter
475
	public void test020() throws Exception {
476
		this.runNegativeTest(
477
			new String[] {
478
				"X.java",
479
				"public class X {\n" + 
480
				"	<@A @B(3) T> void foo(T t) {}\n" + 
481
				"}",
482
		},
483
		"----------\n" + 
484
		"1. ERROR in X.java (at line 2)\n" + 
485
		"	<@A @B(3) T> void foo(T t) {}\n" + 
486
		"	  ^\n" + 
487
		"A cannot be resolved to a type\n" + 
488
		"----------\n" + 
489
		"2. ERROR in X.java (at line 2)\n" + 
490
		"	<@A @B(3) T> void foo(T t) {}\n" + 
491
		"	     ^\n" + 
492
		"B cannot be resolved to a type\n" + 
493
		"----------\n");
494
	}
495
	// class type parameter bound
496
	public void test021() throws Exception {
497
		this.runNegativeTest(
498
			new String[] {
499
				"Z.java",
500
				"public class Z {}",
501
				"X.java",
502
				"public class X<T extends @A Z & @B(3) Cloneable> {}",
503
		},
504
		"----------\n" + 
505
		"1. ERROR in X.java (at line 1)\n" + 
506
		"	public class X<T extends @A Z & @B(3) Cloneable> {}\n" + 
507
		"	                          ^\n" + 
508
		"A cannot be resolved to a type\n" + 
509
		"----------\n" + 
510
		"2. ERROR in X.java (at line 1)\n" + 
511
		"	public class X<T extends @A Z & @B(3) Cloneable> {}\n" + 
512
		"	                                 ^\n" + 
513
		"B cannot be resolved to a type\n" + 
514
		"----------\n");
515
	}
516
	// class type parameter bound generic or array
517
	public void test022() throws Exception {
518
		this.runNegativeTest(
519
			new String[] {
520
				"Y.java",
521
				"public class Y<T> {}",
522
				"X.java",
523
				"public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}",
524
		},
525
		"----------\n" + 
526
		"1. ERROR in X.java (at line 1)\n" + 
527
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
528
		"	                            ^\n" + 
529
		"A cannot be resolved to a type\n" + 
530
		"----------\n" + 
531
		"2. ERROR in X.java (at line 1)\n" + 
532
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
533
		"	                                      ^\n" + 
534
		"C cannot be resolved to a type\n" + 
535
		"----------\n" + 
536
		"3. ERROR in X.java (at line 1)\n" + 
537
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
538
		"	                                            ^\n" + 
539
		"B cannot be resolved to a type\n" + 
540
		"----------\n" + 
541
		"4. ERROR in X.java (at line 1)\n" + 
542
		"	public class X<T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}\n" + 
543
		"	                                                    ^\n" + 
544
		"B cannot be resolved to a type\n" + 
545
		"----------\n");
546
	}
547
	// method type parameter bound
548
	public void test023() throws Exception {
549
		this.runNegativeTest(
550
			new String[] {
551
				"Z.java",
552
				"public class Z {}",
553
				"X.java",
554
				"public class X {\n" +
555
				"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" +
556
				"}",
557
		},
558
		"----------\n" + 
559
		"1. ERROR in X.java (at line 2)\n" + 
560
		"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + 
561
		"	            ^\n" + 
562
		"A cannot be resolved to a type\n" + 
563
		"----------\n" + 
564
		"2. ERROR in X.java (at line 2)\n" + 
565
		"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" + 
566
		"	                   ^\n" + 
567
		"B cannot be resolved to a type\n" + 
568
		"----------\n");
569
	}
570
	// class type parameter bound generic or array
571
	public void test024() throws Exception {
572
		this.runNegativeTest(
573
			new String[] {
574
				"Z.java",
575
				"public class Z {}",
576
				"Y.java",
577
				"public class Y<T> {}",
578
				"X.java",
579
				"public class X {\n" +
580
				"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" +
581
				"}",
582
		},
583
		"----------\n" + 
584
		"1. ERROR in X.java (at line 2)\n" + 
585
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
586
		"	              ^\n" + 
587
		"A cannot be resolved to a type\n" + 
588
		"----------\n" + 
589
		"2. ERROR in X.java (at line 2)\n" + 
590
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
591
		"	                   ^\n" + 
592
		"C cannot be resolved to a type\n" + 
593
		"----------\n" + 
594
		"3. ERROR in X.java (at line 2)\n" + 
595
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
596
		"	                         ^\n" + 
597
		"B cannot be resolved to a type\n" + 
598
		"----------\n" + 
599
		"4. ERROR in X.java (at line 2)\n" + 
600
		"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" + 
601
		"	                                 ^\n" + 
602
		"B cannot be resolved to a type\n" + 
603
		"----------\n");
604
	}
605
	// local variable + generic or array
606
	public void test025() throws Exception {
607
		this.runNegativeTest(
608
			new String[] {
609
				"X.java",
610
				"public class X {\n" + 
611
				"	void foo(String s) {\n" + 
612
				"		@C int i;\n" + 
613
				"		@A String [] @B(3)[] tab = new String[][] {};\n" + 
614
				"		if (tab != null) {\n" + 
615
				"			i = 0;\n" + 
616
				"			System.out.println(i + tab.length);\n" + 
617
				"		} else {\n" + 
618
				"			System.out.println(tab.length);\n" + 
619
				"		}\n" + 
620
				"		i = 4;\n" + 
621
				"		System.out.println(-i + tab.length);\n" + 
622
				"	}\n" + 
623
				"}",
624
		},
625
		"----------\n" + 
626
		"1. ERROR in X.java (at line 3)\n" + 
627
		"	@C int i;\n" + 
628
		"	 ^\n" + 
629
		"C cannot be resolved to a type\n" + 
630
		"----------\n" + 
631
		"2. ERROR in X.java (at line 4)\n" + 
632
		"	@A String [] @B(3)[] tab = new String[][] {};\n" + 
633
		"	 ^\n" + 
634
		"A cannot be resolved to a type\n" + 
635
		"----------\n" + 
636
		"3. ERROR in X.java (at line 4)\n" + 
637
		"	@A String [] @B(3)[] tab = new String[][] {};\n" + 
638
		"	              ^\n" + 
639
		"B cannot be resolved to a type\n" + 
640
		"----------\n");
641
	}
642
	// type argument constructor call
643
	public void test026() throws Exception {
644
		this.runNegativeTest(
645
			new String[] {
646
				"X.java",
647
				"public class X {\n" + 
648
				"	<T> X(T t) {\n" + 
649
				"	}\n" + 
650
				"	public Object foo() {\n" + 
651
				"		X x = new <@A @B(1) String>X(null);\n" + 
652
				"		return x;\n" + 
653
				"	}\n" + 
654
				"}",
655
		},
656
		"----------\n" + 
657
		"1. ERROR in X.java (at line 5)\n" + 
658
		"	X x = new <@A @B(1) String>X(null);\n" + 
659
		"	            ^\n" + 
660
		"A cannot be resolved to a type\n" + 
661
		"----------\n" + 
662
		"2. ERROR in X.java (at line 5)\n" + 
663
		"	X x = new <@A @B(1) String>X(null);\n" + 
664
		"	               ^\n" + 
665
		"B cannot be resolved to a type\n" + 
666
		"----------\n");
667
	}
668
	// type argument constructor call generic or array
669
	public void test027() throws Exception {
670
		this.runNegativeTest(
671
			new String[] {
672
				"X.java",
673
				"public class X {\n" + 
674
				"	<T> X(T t) {\n" + 
675
				"	}\n" + 
676
				"	public Object foo() {\n" + 
677
				"		X x = new <@A @B(1) String>X(null);\n" + 
678
				"		return x;\n" + 
679
				"	}\n" + 
680
				"}",
681
		},
682
		"----------\n" + 
683
		"1. ERROR in X.java (at line 5)\n" + 
684
		"	X x = new <@A @B(1) String>X(null);\n" + 
685
		"	            ^\n" + 
686
		"A cannot be resolved to a type\n" + 
687
		"----------\n" + 
688
		"2. ERROR in X.java (at line 5)\n" + 
689
		"	X x = new <@A @B(1) String>X(null);\n" + 
690
		"	               ^\n" + 
691
		"B cannot be resolved to a type\n" + 
692
		"----------\n");
693
	}
694
	// type argument method call and generic or array
695
	public void test028() throws Exception {
696
		this.runNegativeTest(
697
			new String[] {
698
				"X.java",
699
				"public class X {\n" +
700
				"\n" +
701
				"	static <T, U> T foo(T t, U u) {\n" +
702
				"		return t;\n" +
703
				"	}\n" +
704
				"	public static void main(String[] args) {\n" +
705
				"		System.out.println(X.<@A @B(1) String[], @C('-') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" +
706
				"	}\n" +
707
				"}\n",
708
		},
709
		"----------\n" + 
710
		"1. ERROR in X.java (at line 7)\n" + 
711
		"	System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + 
712
		"	                       ^\n" + 
713
		"A cannot be resolved to a type\n" + 
714
		"----------\n" + 
715
		"2. ERROR in X.java (at line 7)\n" + 
716
		"	System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + 
717
		"	                          ^\n" + 
718
		"B cannot be resolved to a type\n" + 
719
		"----------\n" + 
720
		"3. ERROR in X.java (at line 7)\n" + 
721
		"	System.out.println(X.<@A @B(1) String[], @C(\'-\') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" + 
722
		"	                                          ^\n" + 
723
		"C cannot be resolved to a type\n" + 
724
		"----------\n");
725
	}
726
	public void test029() throws Exception {
727
		this.runNegativeTest(
728
				new String[] {
729
					"X.java",
730
					"public class X extends @Marker2 Object {}",
731
				},
732
				"----------\n" + 
733
				"1. ERROR in X.java (at line 1)\n" + 
734
				"	public class X extends @Marker2 Object {}\n" + 
735
				"	                        ^^^^^^^\n" + 
736
				"Marker2 cannot be resolved to a type\n" + 
737
				"----------\n");
738
	}
739
	public void test030() throws Exception {
740
		this.runNegativeTest(
741
				new String[] {
742
					"X.java",
743
					"import java.io.Serializable;\n" +
744
					"public class X implements @Marker2 Serializable {\n" +
745
					"	private static final long serialVersionUID = 1L;\n" +
746
					"}",
747
				},
748
				"----------\n" + 
749
				"1. ERROR in X.java (at line 2)\n" + 
750
				"	public class X implements @Marker2 Serializable {\n" + 
751
				"	                           ^^^^^^^\n" + 
752
				"Marker2 cannot be resolved to a type\n" + 
753
				"----------\n");
754
	}
755
	public void test031() throws Exception {
756
		this.runNegativeTest(
757
				new String[] {
758
					"Marker.java",
759
					"import java.lang.annotation.Target;\n" + 
760
					"import static java.lang.annotation.ElementType.*;\n" + 
761
					"@Target(TYPE_USE)\n" + 
762
					"@interface Marker {}",
763
					"X.java",
764
					"public class X<@Marker T> {}",
765
				},
766
				"----------\n" + 
767
				"1. ERROR in X.java (at line 1)\n" + 
768
				"	public class X<@Marker T> {}\n" + 
769
				"	               ^^^^^^^\n" + 
770
				"The annotation @Marker is disallowed for this location\n" + 
771
				"----------\n");
772
	}
773
	public void test032() throws Exception {
774
		this.runNegativeTest(
775
				new String[] {
776
					"Marker.java",
777
					"@interface Marker {}",
778
					"X.java",
779
					"public class X<@Marker T> {}",
780
				},
781
				"----------\n" + 
782
				"1. ERROR in X.java (at line 1)\n" + 
783
				"	public class X<@Marker T> {}\n" + 
784
				"	               ^^^^^^^\n" + 
785
				"The annotation @Marker is disallowed for this location\n" + 
786
				"----------\n");
787
	}
788
	public void test033() throws Exception {
789
		this.runNegativeTest(
790
				new String[] {
791
					"Marker.java",
792
					"@interface Marker {}",
793
					"Y.java",
794
					"public class Y {}",
795
					"X.java",
796
					"public class X extends @Marker Y {}",
797
				},
798
				"----------\n" + 
799
				"1. ERROR in X.java (at line 1)\n" + 
800
				"	public class X extends @Marker Y {}\n" + 
801
				"	                       ^^^^^^^\n" + 
802
				"The annotation @Marker is disallowed for this location\n" + 
803
				"----------\n");
804
	}
805
	// check locations
806
	public void test034() throws Exception {
807
		this.runNegativeTest(
808
			new String[] {
809
				"X.java",
810
				"import java.util.Map;\n" +
811
				"import java.util.List;\n" +
812
				"public class X {\n" + 
813
				"	@H String @E[] @F[] @G[] field;\n" + 
814
				"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
815
				"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
816
				"}",
817
		},
818
		"----------\n" + 
819
		"1. ERROR in X.java (at line 4)\n" + 
820
		"	@H String @E[] @F[] @G[] field;\n" + 
821
		"	 ^\n" + 
822
		"H cannot be resolved to a type\n" + 
823
		"----------\n" + 
824
		"2. ERROR in X.java (at line 4)\n" + 
825
		"	@H String @E[] @F[] @G[] field;\n" + 
826
		"	           ^\n" + 
827
		"E cannot be resolved to a type\n" + 
828
		"----------\n" + 
829
		"3. ERROR in X.java (at line 4)\n" + 
830
		"	@H String @E[] @F[] @G[] field;\n" + 
831
		"	                ^\n" + 
832
		"F cannot be resolved to a type\n" + 
833
		"----------\n" + 
834
		"4. ERROR in X.java (at line 4)\n" + 
835
		"	@H String @E[] @F[] @G[] field;\n" + 
836
		"	                     ^\n" + 
837
		"G cannot be resolved to a type\n" + 
838
		"----------\n" + 
839
		"5. ERROR in X.java (at line 5)\n" + 
840
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
841
		"	 ^\n" + 
842
		"A cannot be resolved to a type\n" + 
843
		"----------\n" + 
844
		"6. ERROR in X.java (at line 5)\n" + 
845
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
846
		"	        ^\n" + 
847
		"B cannot be resolved to a type\n" + 
848
		"----------\n" + 
849
		"7. ERROR in X.java (at line 5)\n" + 
850
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
851
		"	                   ^\n" + 
852
		"C cannot be resolved to a type\n" + 
853
		"----------\n" + 
854
		"8. ERROR in X.java (at line 5)\n" + 
855
		"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
856
		"	                           ^\n" + 
857
		"D cannot be resolved to a type\n" + 
858
		"----------\n" + 
859
		"9. ERROR in X.java (at line 6)\n" + 
860
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
861
		"	 ^\n" + 
862
		"A cannot be resolved to a type\n" + 
863
		"----------\n" + 
864
		"10. ERROR in X.java (at line 6)\n" + 
865
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
866
		"	        ^\n" + 
867
		"B cannot be resolved to a type\n" + 
868
		"----------\n" + 
869
		"11. ERROR in X.java (at line 6)\n" + 
870
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
871
		"	                   ^\n" + 
872
		"H cannot be resolved to a type\n" + 
873
		"----------\n" + 
874
		"12. ERROR in X.java (at line 6)\n" + 
875
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
876
		"	                             ^\n" + 
877
		"E cannot be resolved to a type\n" + 
878
		"----------\n" + 
879
		"13. ERROR in X.java (at line 6)\n" + 
880
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
881
		"	                                  ^\n" + 
882
		"F cannot be resolved to a type\n" + 
883
		"----------\n" + 
884
		"14. ERROR in X.java (at line 6)\n" + 
885
		"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
886
		"	                                       ^\n" + 
887
		"G cannot be resolved to a type\n" + 
888
		"----------\n");
889
	}
890
	// check locations
891
	public void test035() throws Exception {
892
		this.runNegativeTest(
893
			new String[] {
894
				"X.java",
895
				"import java.util.Map;\n" +
896
				"import java.util.List;\n" +
897
				"public class X {\n" + 
898
				"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
899
				"}",
900
		},
901
		"----------\n" + 
902
		"1. ERROR in X.java (at line 4)\n" + 
903
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
904
		"	 ^\n" + 
905
		"H cannot be resolved to a type\n" + 
906
		"----------\n" + 
907
		"2. ERROR in X.java (at line 4)\n" + 
908
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
909
		"	                     ^\n" + 
910
		"E cannot be resolved to a type\n" + 
911
		"----------\n" + 
912
		"3. ERROR in X.java (at line 4)\n" + 
913
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
914
		"	                          ^\n" + 
915
		"F cannot be resolved to a type\n" + 
916
		"----------\n" + 
917
		"4. ERROR in X.java (at line 4)\n" + 
918
		"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
919
		"	                               ^\n" + 
920
		"G cannot be resolved to a type\n" + 
921
		"----------\n");
922
	}
923
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java (-18 / +128 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 31-37 Link Here
31
	// All specified tests which does not belong to the class are skipped...
31
	// All specified tests which does not belong to the class are skipped...
32
	static {
32
	static {
33
//		TESTS_NAMES = new String[] { "test000" };
33
//		TESTS_NAMES = new String[] { "test000" };
34
//		TESTS_NUMBERS = new int[] { 53 };
34
//		TESTS_NUMBERS = new int[] { 9 };
35
//		TESTS_RANGE = new int[] { 11, -1 };
35
//		TESTS_RANGE = new int[] { 11, -1 };
36
	}
36
	}
37
37
Lines 196-205 Link Here
196
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
196
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
197
				counter++;
197
				counter++;
198
			}
198
			}
199
		} catch (InvalidInputException e) {
200
			assertTrue(false);
199
			assertTrue(false);
200
		} catch (InvalidInputException e) {
201
		}
201
		}
202
		assertEquals("Wrong number of tokens", 5, counter);
202
		assertEquals("Wrong number of tokens", 0, counter);
203
	}
203
	}
204
204
205
	/*
205
	/*
Lines 269-275 Link Here
269
		scanner.resetTo(0, source.length - 1);
269
		scanner.resetTo(0, source.length - 1);
270
		try {
270
		try {
271
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
271
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
272
				// ignore
272
				// do nothing
273
			}
273
			}
274
		} catch (InvalidInputException e) {
274
		} catch (InvalidInputException e) {
275
			assertTrue(true);
275
			assertTrue(true);
Lines 288-294 Link Here
288
		scanner.resetTo(0, source.length - 1);
288
		scanner.resetTo(0, source.length - 1);
289
		try {
289
		try {
290
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
290
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
291
				// ignore
291
				// do nothing
292
			}
292
			}
293
		} catch (InvalidInputException e) {
293
		} catch (InvalidInputException e) {
294
			assertTrue(true);
294
			assertTrue(true);
Lines 383-389 Link Here
383
		scanner.resetTo(0, source.length - 1);
383
		scanner.resetTo(0, source.length - 1);
384
		try {
384
		try {
385
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
385
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
386
				// ignore
386
				// do nothing
387
			}
387
			}
388
		} catch (InvalidInputException e) {
388
		} catch (InvalidInputException e) {
389
			assertTrue(true);
389
			assertTrue(true);
Lines 402-408 Link Here
402
		scanner.resetTo(0, source.length - 1);
402
		scanner.resetTo(0, source.length - 1);
403
		try {
403
		try {
404
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
404
			while (scanner.getNextToken() != ITerminalSymbols.TokenNameEOF) {
405
				// ignore
405
				// do nothing
406
			}
406
			}
407
		} catch (InvalidInputException e) {
407
		} catch (InvalidInputException e) {
408
			assertTrue(true);
408
			assertTrue(true);
Lines 1105-1130 Link Here
1105
			assertEquals("Wrong source", "\"a co\\", new String(scanner.getCurrentTokenSource()));
1105
			assertEquals("Wrong source", "\"a co\\", new String(scanner.getCurrentTokenSource()));
1106
		}
1106
		}
1107
	}
1107
	}
1108
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=294529
1108
	// Exotic identifier
1109
	public void test052() {
1109
	public void test053() {
1110
		IScanner scanner = ToolFactory.createScanner(
1110
		IScanner scanner = ToolFactory.createScanner(
1111
				true,
1111
				true,
1112
				true,
1112
				true,
1113
				true,
1113
				true,
1114
				JavaCore.getOption(JavaCore.COMPILER_SOURCE),
1114
				"1.5",
1115
				JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE));
1115
				"1.7");
1116
		final char[] source = "\"\\u00E9mment, longer\\n than the\\noffset \"".toCharArray();
1116
		final char[] source = "#\"this is an exotic identifier\"".toCharArray();
1117
		scanner.setSource(source);
1117
		scanner.setSource(source);
1118
		scanner.resetTo(0, 5);
1119
		try {
1118
		try {
1120
			assertEquals("Wrong token", ITerminalSymbols.TokenNameStringLiteral, scanner.getNextToken());
1119
			assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken());
1121
			assertTrue("Should fail with InvalidInputException", false);
1120
		} catch (InvalidInputException e) {
1121
			assertTrue("Should not happen", false);
1122
		}
1123
	}
1124
	// Exotic identifier
1125
	public void test054() {
1126
		IScanner scanner = ToolFactory.createScanner(
1127
				true,
1128
				true,
1129
				true,
1130
				"1.7",
1131
				"1.7");
1132
		final char[] source = "#\"\"".toCharArray();
1133
		scanner.setSource(source);
1134
		try {
1135
			scanner.getNextToken();
1136
			assertTrue("Should not happen", false);
1137
		} catch (InvalidInputException e) {
1138
		}
1139
	}
1140
	// Exotic identifier
1141
	public void test055() {
1142
		char[] dangerousCharacters = new char[] {'/', '.', ';', '<', '>', '[', ']'};
1143
		for (int i = 0, max = dangerousCharacters.length; i < max; i++) {
1144
			IScanner scanner = ToolFactory.createScanner(
1145
					true,
1146
					true,
1147
					true,
1148
					"1.7",
1149
					"1.7");
1150
			final char[] source = ("#\""+ dangerousCharacters[i] + "\"").toCharArray();
1151
			scanner.setSource(source);
1152
			try {
1153
				scanner.getNextToken();
1154
				assertTrue("Should not happen", false);
1155
			} catch (InvalidInputException e) {
1156
			}
1157
		}
1158
	}
1159
	// Exotic identifier
1160
	public void test056() {
1161
		char[] dangerousCharacters = new char[] {'/', '.', ';', '<', '>', '[', ']'};
1162
		for (int i = 0, max = dangerousCharacters.length; i < max; i++) {
1163
			IScanner scanner = ToolFactory.createScanner(
1164
					true,
1165
					true,
1166
					true,
1167
					"1.7",
1168
					"1.7");
1169
			final char[] source = ("#\"\\"+ dangerousCharacters[i] + "\"").toCharArray();
1170
			scanner.setSource(source);
1171
			try {
1172
				assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken());
1173
				assertEquals("Wrong contents", "#\"" + dangerousCharacters[i] + "\"", new String(scanner.getCurrentTokenSource()));
1174
				assertEquals("Wrong contents", "#\"\\" + dangerousCharacters[i] + "\"", new String(scanner.getRawTokenSource()));
1175
			} catch (InvalidInputException e) {
1176
				assertTrue("Should not happen", false);
1177
			}
1178
		}
1179
	}
1180
	// Exotic identifier
1181
	public void test057() {
1182
		char[] exoticEscapeCharacters = new char[] {'!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', ':', '?',
1183
				'@', '^', '_', '`', '{', '|', '}', '~'};
1184
		for (int i = 0, max = exoticEscapeCharacters.length; i < max; i++) {
1185
			IScanner scanner = ToolFactory.createScanner(
1186
					true,
1187
					true,
1188
					true,
1189
					"1.7",
1190
					"1.7");
1191
			final char[] source = ("#\"\\"+ exoticEscapeCharacters[i] + "\"").toCharArray();
1192
			scanner.setSource(source);
1193
			try {
1194
				assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken());
1195
				assertEquals("Wrong contents", "#\"\\" + exoticEscapeCharacters[i] + "\"", new String(scanner.getCurrentTokenSource()));
1196
				assertEquals("Wrong contents", "#\"\\" + exoticEscapeCharacters[i] + "\"", new String(scanner.getRawTokenSource()));
1197
			} catch (InvalidInputException e) {
1198
				assertTrue("Should not happen", false);
1199
			}
1200
		}
1201
	}
1202
	// Exotic identifier
1203
	public void test058() {
1204
		IScanner scanner = ToolFactory.createScanner(
1205
				true,
1206
				true,
1207
				true,
1208
				"1.5",
1209
				"1.6");
1210
		final char[] source = "#\"this is an exotic identifier\"".toCharArray();
1211
		scanner.setSource(source);
1212
		try {
1213
			scanner.getNextToken();
1214
			assertTrue("Should not happen", false);
1122
		} catch (InvalidInputException e) {
1215
		} catch (InvalidInputException e) {
1123
			assertEquals("Wrong source", "\"\\u00E", new String(scanner.getCurrentTokenSource()));
1216
		}
1217
	}
1218
	// Exotic identifier
1219
	public void test059() {
1220
		IScanner scanner = ToolFactory.createScanner(
1221
				true,
1222
				true,
1223
				true,
1224
				"1.5",
1225
				"1.7");
1226
		final char[] source = "#\"this \\u0037\"".toCharArray();
1227
		scanner.setSource(source);
1228
		try {
1229
			assertEquals("Wrong token", ITerminalSymbols.TokenNameIdentifier, scanner.getNextToken());
1230
			assertEquals("Wrong contents", "#\"this 7\"", new String(scanner.getCurrentTokenSource()));
1231
			assertEquals("Wrong contents", "#\"this \\u0037\"", new String(scanner.getRawTokenSource()));
1232
		} catch (InvalidInputException e) {
1233
			assertTrue("Should not happen", false);
1124
		}
1234
		}
1125
	}
1235
	}
1126
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=330081
1236
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=330081
1127
	public void test053() {
1237
	public void test060() {
1128
		IScanner scanner = ToolFactory.createScanner(
1238
		IScanner scanner = ToolFactory.createScanner(
1129
				true,
1239
				true,
1130
				true,
1240
				true,
(-)src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java (-1 / +1176 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 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 25-30 Link Here
25
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
25
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
26
26
27
public class SwitchTest extends AbstractRegressionTest {
27
public class SwitchTest extends AbstractRegressionTest {
28
	
29
	private static final long JDKLevelSupportingStringSwitch = ClassFileConstants.JDK1_7;
30
28
static {
31
static {
29
//	TESTS_NUMBERS = new int[] { 22 };
32
//	TESTS_NUMBERS = new int[] { 22 };
30
}
33
}
Lines 829-834 Link Here
829
	},
832
	},
830
	"SUCCESS");
833
	"SUCCESS");
831
}
834
}
835
836
// JDK7: Strings in Switch.
837
public void testStringSwitchAtJDK6() {
838
		String newMessage = 		
839
			"----------\n" + 
840
			"1. ERROR in X.java (at line 4)\n" + 
841
			"	default: return args;\n" + 
842
			"	         ^^^^^^^^^^^^\n" + 
843
			"Void methods cannot return a value\n" + 
844
			"----------\n";
845
		String oldMessage = 
846
			"----------\n" + 
847
			"1. ERROR in X.java (at line 3)\n" + 
848
			"	switch(args[0]) {\n" + 
849
			"	       ^^^^^^^\n" + 
850
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
851
			"----------\n" + 
852
			"2. ERROR in X.java (at line 4)\n" + 
853
			"	default: return args;\n" + 
854
			"	         ^^^^^^^^^^^^\n" + 
855
			"Void methods cannot return a value\n" + 
856
			"----------\n";
857
			
858
		this.runNegativeTest(new String[] {
859
			"X.java",
860
			"public class X {\n" +
861
			"	public static void main(String [] args) {\n" +
862
			"		switch(args[0]) {\n" + 
863
			"		default: return args;\n" +
864
			"		}\n" +
865
			"	}\n" +
866
			"}\n",
867
		},
868
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
869
}
870
871
//JDK7: Strings in Switch.
872
public void testCaseTypeMismatch() {
873
	String newMessage = 	
874
		"----------\n" + 
875
		"1. ERROR in X.java (at line 4)\n" + 
876
		"	case 123: break;\n" + 
877
		"	     ^^^\n" + 
878
		"Type mismatch: cannot convert from int to String\n" + 
879
		"----------\n" + 
880
		"2. ERROR in X.java (at line 5)\n" + 
881
		"	case (byte) 1: break;\n" + 
882
		"	     ^^^^^^^^\n" + 
883
		"Type mismatch: cannot convert from byte to String\n" + 
884
		"----------\n" + 
885
		"3. ERROR in X.java (at line 6)\n" + 
886
		"	case (char) 2: break;\n" + 
887
		"	     ^^^^^^^^\n" + 
888
		"Type mismatch: cannot convert from char to String\n" + 
889
		"----------\n" + 
890
		"4. ERROR in X.java (at line 7)\n" + 
891
		"	case (short)3: break;\n" + 
892
		"	     ^^^^^^^^\n" + 
893
		"Type mismatch: cannot convert from short to String\n" + 
894
		"----------\n" + 
895
		"5. ERROR in X.java (at line 8)\n" + 
896
		"	case (int) 4: break;\n" + 
897
		"	     ^^^^^^^\n" + 
898
		"Type mismatch: cannot convert from int to String\n" + 
899
		"----------\n" + 
900
		"6. ERROR in X.java (at line 9)\n" + 
901
		"	case (long) 5: break;\n" + 
902
		"	     ^^^^^^^^\n" + 
903
		"Type mismatch: cannot convert from long to String\n" + 
904
		"----------\n" + 
905
		"7. ERROR in X.java (at line 10)\n" + 
906
		"	case (float) 6: break;\n" + 
907
		"	     ^^^^^^^^^\n" + 
908
		"Type mismatch: cannot convert from float to String\n" + 
909
		"----------\n" + 
910
		"8. ERROR in X.java (at line 11)\n" + 
911
		"	case (double) 7: break;\n" + 
912
		"	     ^^^^^^^^^^\n" + 
913
		"Type mismatch: cannot convert from double to String\n" + 
914
		"----------\n" + 
915
		"9. ERROR in X.java (at line 12)\n" + 
916
		"	case (boolean) 8: break;\n" + 
917
		"	     ^^^^^^^^^^^\n" + 
918
		"Cannot cast from int to boolean\n" + 
919
		"----------\n" + 
920
		"10. ERROR in X.java (at line 12)\n" + 
921
		"	case (boolean) 8: break;\n" + 
922
		"	     ^^^^^^^^^^^\n" + 
923
		"Type mismatch: cannot convert from boolean to String\n" + 
924
		"----------\n";
925
		String oldMessage = 
926
			"----------\n" + 
927
			"1. ERROR in X.java (at line 3)\n" + 
928
			"	switch(args[0]) {\n" + 
929
			"	       ^^^^^^^\n" + 
930
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
931
			"----------\n" + 
932
			"2. ERROR in X.java (at line 12)\n" + 
933
			"	case (boolean) 8: break;\n" + 
934
			"	     ^^^^^^^^^^^\n" + 
935
			"Cannot cast from int to boolean\n" + 
936
			"----------\n";
937
				
938
		this.runNegativeTest(new String[] {
939
			"X.java",
940
			"public class X {\n" +
941
			"	public static void main(String [] args) {\n" +
942
			"		switch(args[0]) {\n" + 
943
			"		case 123: break;\n" +
944
			"       case (byte) 1: break;\n" +
945
			"       case (char) 2: break;\n" +
946
			"       case (short)3: break;\n" +
947
			"       case (int) 4: break;\n" +
948
			"       case (long) 5: break;\n" +
949
			"       case (float) 6: break;\n" +
950
			"       case (double) 7: break;\n" +
951
			"       case (boolean) 8: break;\n" +
952
			"		}\n" +
953
			"	}\n" +
954
			"}\n",
955
		},
956
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
957
}
958
// JDK7: Strings in Switch.
959
public void testCaseTypeMismatch2() {
960
	if (this.complianceLevel < ClassFileConstants.JDK1_5) {
961
		return;
962
	}
963
	String newMessage = 	
964
		"----------\n" + 
965
		"1. ERROR in X.java (at line 7)\n" + 
966
		"	case Days.Sunday: break;\n" + 
967
		"	     ^^^^^^^^^^^\n" + 
968
		"Type mismatch: cannot convert from Days to String\n" + 
969
		"----------\n";
970
		String oldMessage = 
971
			"----------\n" + 
972
			"1. ERROR in X.java (at line 6)\n" + 
973
			"	switch (\"Sunday\") {\n" + 
974
			"	        ^^^^^^^^\n" + 
975
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
976
			"----------\n";
977
				
978
		this.runNegativeTest(new String[] {
979
			"X.java",
980
			"enum Days { Sunday, Monday, Tuesday, Wednesday, Thuresday, Friday, Satuday };\n" +
981
			"\n" +
982
			"public class X {\n" +
983
			"\n" +
984
			"    public static void main(String argv[]) {\n" +
985
			"        switch (\"Sunday\") {\n" +
986
			"            case Days.Sunday: break;\n" +
987
			"        }\n" +
988
			"    }\n" +
989
			"}\n",
990
		},
991
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
992
}
993
// JDK7: Strings in Switch.
994
public void testCaseTypeMismatch3() {
995
	if (this.complianceLevel < ClassFileConstants.JDK1_5) {
996
		return;
997
	}
998
	String newMessage = 	
999
		"----------\n" + 
1000
		"1. ERROR in X.java (at line 7)\n" + 
1001
		"	case \"0\": break;\n" + 
1002
		"	     ^^^\n" + 
1003
		"Type mismatch: cannot convert from String to int\n" + 
1004
		"----------\n" + 
1005
		"2. ERROR in X.java (at line 10)\n" + 
1006
		"	case \"Sunday\": break;\n" + 
1007
		"	     ^^^^^^^^\n" + 
1008
		"Type mismatch: cannot convert from String to Days\n" + 
1009
		"----------\n" + 
1010
		"3. ERROR in X.java (at line 13)\n" + 
1011
		"	case \"0\": break;\n" + 
1012
		"	     ^^^\n" + 
1013
		"Type mismatch: cannot convert from String to Integer\n" + 
1014
		"----------\n";
1015
				
1016
		this.runNegativeTest(new String[] {
1017
			"X.java",
1018
			"enum Days { Sunday, Monday, Tuesday, Wednesday, Thuresday, Friday, Satuday };\n" +
1019
			"\n" +
1020
			"public class X {\n" +
1021
			"\n" +
1022
			"    public static void main(String argv[]) {\n" +
1023
			"        switch (argv.length) {\n" +
1024
			"            case \"0\": break;\n" +
1025
			"        }\n" +
1026
			"        switch(Days.Sunday) {\n" +
1027
			"            case \"Sunday\": break;\n" +
1028
			"        }\n" +
1029
			"        switch (new Integer(argv.length)) {\n" +
1030
			"            case \"0\": break;\n" +
1031
			"        }\n" +
1032
			"    }\n" +
1033
			"}\n",
1034
		},
1035
		newMessage);
1036
}
1037
// JDK7: Strings in Switch.
1038
public void testDuplicateCase() {
1039
		String newMessage = 
1040
			"----------\n" + 
1041
			"1. ERROR in X.java (at line 4)\n" + 
1042
			"	case \"123\": break;\n" + 
1043
			"	^^^^^^^^^^\n" + 
1044
			"Duplicate case\n" + 
1045
			"----------\n" + 
1046
			"2. ERROR in X.java (at line 5)\n" + 
1047
			"	case \"123\": break;\n" + 
1048
			"	^^^^^^^^^^\n" + 
1049
			"Duplicate case\n" + 
1050
			"----------\n" + 
1051
			"3. ERROR in X.java (at line 6)\n" + 
1052
			"	default: return args;\n" + 
1053
			"	         ^^^^^^^^^^^^\n" + 
1054
			"Void methods cannot return a value\n" + 
1055
			"----------\n";
1056
		
1057
		String oldMessage = 
1058
			"----------\n" + 
1059
			"1. ERROR in X.java (at line 3)\n" + 
1060
			"	switch(args[0]) {\n" + 
1061
			"	       ^^^^^^^\n" + 
1062
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1063
			"----------\n" + 
1064
			"2. ERROR in X.java (at line 6)\n" + 
1065
			"	default: return args;\n" + 
1066
			"	         ^^^^^^^^^^^^\n" + 
1067
			"Void methods cannot return a value\n" + 
1068
			"----------\n";
1069
				
1070
		this.runNegativeTest(new String[] {
1071
			"X.java",
1072
			"public class X {\n" +
1073
			"	public static void main(String [] args) {\n" +
1074
			"		switch(args[0]) {\n" + 
1075
			"		case \"123\": break;\n" +
1076
			"		case \"123\": break;\n" +
1077
			"       default: return args;\n" +
1078
			"		}\n" +
1079
			"	}\n" +
1080
			"}\n",
1081
		},
1082
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
1083
}
1084
1085
// JDK7: Strings in Switch.
1086
public void testDuplicateCase2() {
1087
		String newMessage = 
1088
			"----------\n" + 
1089
			"1. ERROR in X.java (at line 9)\n" + 
1090
			"	case \"123\": break;\n" + 
1091
			"	^^^^^^^^^^\n" + 
1092
			"Duplicate case\n" + 
1093
			"----------\n" + 
1094
			"2. ERROR in X.java (at line 10)\n" + 
1095
			"	case \"123\": break;\n" + 
1096
			"	^^^^^^^^^^\n" + 
1097
			"Duplicate case\n" + 
1098
			"----------\n" + 
1099
			"3. ERROR in X.java (at line 11)\n" + 
1100
			"	case \"1\" + \"2\" + \"3\": break;\n" + 
1101
			"	^^^^^^^^^^^^^^^^^^^^\n" + 
1102
			"Duplicate case\n" + 
1103
			"----------\n" + 
1104
			"4. ERROR in X.java (at line 13)\n" + 
1105
			"	case local: break;\n" + 
1106
			"	^^^^^^^^^^\n" + 
1107
			"Duplicate case\n" + 
1108
			"----------\n" + 
1109
			"5. ERROR in X.java (at line 14)\n" + 
1110
			"	case field: break;\n" + 
1111
			"	^^^^^^^^^^\n" + 
1112
			"Duplicate case\n" + 
1113
			"----------\n" + 
1114
			"6. ERROR in X.java (at line 15)\n" + 
1115
			"	case ifield: break;\n" + 
1116
			"	     ^^^^^^\n" + 
1117
			"Cannot make a static reference to the non-static field ifield\n" + 
1118
			"----------\n" + 
1119
			"7. ERROR in X.java (at line 16)\n" + 
1120
			"	case inffield: break;\n" + 
1121
			"	     ^^^^^^^^\n" + 
1122
			"Cannot make a static reference to the non-static field inffield\n" + 
1123
			"----------\n" + 
1124
			"8. ERROR in X.java (at line 19)\n" + 
1125
			"	default: break;\n" + 
1126
			"	^^^^^^^\n" + 
1127
			"The default case is already defined\n" + 
1128
			"----------\n";
1129
		
1130
		String oldMessage = 
1131
			"----------\n" + 
1132
			"1. ERROR in X.java (at line 8)\n" + 
1133
			"	switch(args[0]) {\n" + 
1134
			"	       ^^^^^^^\n" + 
1135
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1136
			"----------\n" + 
1137
			"2. ERROR in X.java (at line 15)\n" + 
1138
			"	case ifield: break;\n" + 
1139
			"	     ^^^^^^\n" + 
1140
			"Cannot make a static reference to the non-static field ifield\n" + 
1141
			"----------\n" + 
1142
			"3. ERROR in X.java (at line 16)\n" + 
1143
			"	case inffield: break;\n" + 
1144
			"	     ^^^^^^^^\n" + 
1145
			"Cannot make a static reference to the non-static field inffield\n" + 
1146
			"----------\n" + 
1147
			"4. ERROR in X.java (at line 19)\n" + 
1148
			"	default: break;\n" + 
1149
			"	^^^^^^^\n" + 
1150
			"The default case is already defined\n" + 
1151
			"----------\n";
1152
				
1153
		this.runNegativeTest(new String[] {
1154
			"X.java",
1155
			"public class X {\n" +
1156
			"    static final String field = \"123\";\n" +
1157
			"    final String ifield = \"123\";\n" +
1158
			"    String inffield = \"123\";\n" +
1159
			"    static String nffield = \"123\";\n" +
1160
			"    public static void main(String [] args, final String argument) {\n" +
1161
			"        final String local = \"123\";\n" +
1162
			"	switch(args[0]) {\n" + 
1163
			"	   case \"123\": break;\n" +
1164
			"      case \"\u0031\u0032\u0033\": break;\n" +
1165
			"	   case \"1\" + \"2\" + \"3\": break;\n" +
1166
			"           default: break;\n" +
1167
			"	   case local: break;\n" +
1168
			"           case field: break;\n" +
1169
			"           case ifield: break;\n" +
1170
			"           case inffield: break;\n" +
1171
			"           case nffield: break;\n" +
1172
			"           case argument: break;\n" +
1173
			"           default: break;\n" +
1174
			"	}\n" +
1175
			"    }\n" +
1176
			"}\n"
1177
		},
1178
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
1179
}
1180
// JDK7: Strings in Switch.
1181
public void testVariableCase() {
1182
		String newMessage = 
1183
			"----------\n" + 
1184
			"1. ERROR in X.java (at line 7)\n" + 
1185
			"	case local: break;\n" + 
1186
			"	     ^^^^^\n" + 
1187
			"case expressions must be constant expressions\n" + 
1188
			"----------\n" + 
1189
			"2. ERROR in X.java (at line 8)\n" + 
1190
			"	case argument: break;\n" + 
1191
			"	     ^^^^^^^^\n" + 
1192
			"case expressions must be constant expressions\n" + 
1193
			"----------\n" + 
1194
			"3. ERROR in X.java (at line 9)\n" + 
1195
			"	case inffield: break;\n" + 
1196
			"	     ^^^^^^^^\n" + 
1197
			"case expressions must be constant expressions\n" + 
1198
			"----------\n" + 
1199
			"4. ERROR in X.java (at line 10)\n" + 
1200
			"	case nffield: break;\n" + 
1201
			"	     ^^^^^^^\n" + 
1202
			"case expressions must be constant expressions\n" + 
1203
			"----------\n" + 
1204
			"5. ERROR in X.java (at line 11)\n" + 
1205
			"	case argument: break;\n" + 
1206
			"	     ^^^^^^^^\n" + 
1207
			"case expressions must be constant expressions\n" + 
1208
			"----------\n";
1209
		
1210
		String oldMessage = 
1211
			"----------\n" + 
1212
			"1. ERROR in X.java (at line 6)\n" + 
1213
			"	switch(args[0]) {\n" + 
1214
			"	       ^^^^^^^\n" + 
1215
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1216
			"----------\n";
1217
				
1218
		this.runNegativeTest(new String[] {
1219
			"X.java",
1220
			"public class X {\n" +
1221
			"    String inffield = \"123\";\n" +
1222
			"    static String nffield = \"123\";\n" +
1223
			"    public void main(String [] args, final String argument) {\n" +
1224
			"        String local = \"123\";\n" +
1225
			"	switch(args[0]) {\n" + 
1226
			"	   case local: break;\n" +
1227
			"	   case argument: break;\n" +
1228
			"      case inffield: break;\n" +
1229
			"      case nffield: break;\n" +
1230
			"      case argument: break;\n" +
1231
			"	}\n" +
1232
			"    }\n" +
1233
			"}\n"
1234
		},
1235
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
1236
}
1237
// JDK7: Strings in Switch.
1238
public void testVariableCaseFinal() {
1239
		String newMessage = 
1240
			"----------\n" + 
1241
			"1. ERROR in X.java (at line 8)\n" + 
1242
			"	case argument: break;\n" + 
1243
			"	     ^^^^^^^^\n" + 
1244
			"case expressions must be constant expressions\n" + 
1245
			"----------\n" + 
1246
			"2. ERROR in X.java (at line 11)\n" + 
1247
			"	case argument: break;\n" + 
1248
			"	     ^^^^^^^^\n" + 
1249
			"case expressions must be constant expressions\n" + 
1250
			"----------\n";
1251
		
1252
		String oldMessage = 
1253
			"----------\n" + 
1254
			"1. ERROR in X.java (at line 6)\n" + 
1255
			"	switch(args[0]) {\n" + 
1256
			"	       ^^^^^^^\n" + 
1257
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1258
			"----------\n";
1259
				
1260
		this.runNegativeTest(new String[] {
1261
			"X.java",
1262
			"public class X {\n" +
1263
			"    final String inffield = \"12312\";\n" +
1264
			"    final static String nffield = \"123123\";\n" +
1265
			"    public void main(String [] args, final String argument) {\n" +
1266
			"        final String local = \"1233\";\n" +
1267
			"	switch(args[0]) {\n" + 
1268
			"	   case local: break;\n" +
1269
			"	   case argument: break;\n" +
1270
			"      case inffield: break;\n" +
1271
			"      case nffield: break;\n" +
1272
			"      case argument: break;\n" +
1273
			"	}\n" +
1274
			"    }\n" +
1275
			"}\n"
1276
		},
1277
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
1278
}
1279
//JDK7: Strings in Switch.
1280
public void testNullCase() {
1281
		String newMessage = 
1282
			"----------\n" + 
1283
			"1. ERROR in X.java (at line 7)\n" + 
1284
			"	case local: break;\n" + 
1285
			"	     ^^^^^\n" + 
1286
			"case expressions must be constant expressions\n" + 
1287
			"----------\n" + 
1288
			"2. ERROR in X.java (at line 8)\n" + 
1289
			"	case argument: break;\n" + 
1290
			"	     ^^^^^^^^\n" + 
1291
			"case expressions must be constant expressions\n" + 
1292
			"----------\n" + 
1293
			"3. ERROR in X.java (at line 9)\n" + 
1294
			"	case inffield: break;\n" + 
1295
			"	     ^^^^^^^^\n" + 
1296
			"case expressions must be constant expressions\n" + 
1297
			"----------\n" + 
1298
			"4. ERROR in X.java (at line 10)\n" + 
1299
			"	case nffield: break;\n" + 
1300
			"	     ^^^^^^^\n" + 
1301
			"case expressions must be constant expressions\n" + 
1302
			"----------\n" + 
1303
			"5. ERROR in X.java (at line 11)\n" + 
1304
			"	case (String) null: break;\n" + 
1305
			"	     ^^^^^^^^^^^^^\n" + 
1306
			"case expressions must be constant expressions\n" + 
1307
			"----------\n" + 
1308
			"6. ERROR in X.java (at line 12)\n" + 
1309
			"	case true ? (String) null : (String) null : break;\n" + 
1310
			"	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
1311
			"case expressions must be constant expressions\n" + 
1312
			"----------\n" + 
1313
			"7. WARNING in X.java (at line 12)\n" + 
1314
			"	case true ? (String) null : (String) null : break;\n" + 
1315
			"	                            ^^^^^^^^^^^^^\n" + 
1316
			"Dead code\n" + 
1317
			"----------\n";
1318
		
1319
		String oldMessage = 
1320
			"----------\n" + 
1321
			"1. ERROR in X.java (at line 6)\n" + 
1322
			"	switch(args[0]) {\n" + 
1323
			"	       ^^^^^^^\n" + 
1324
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1325
			"----------\n";
1326
				
1327
		this.runNegativeTest(new String[] {
1328
			"X.java",
1329
			"public class X {\n" +
1330
			"    final String inffield = null;\n" +
1331
			"    final static String nffield = null;\n" +
1332
			"    public void main(String [] args, final String argument) {\n" +
1333
			"        final String local = null;\n" +
1334
			"	switch(args[0]) {\n" + 
1335
			"	   case local: break;\n" +
1336
			"	   case argument: break;\n" +
1337
			"      case inffield: break;\n" +
1338
			"      case nffield: break;\n" +
1339
			"      case (String) null: break;\n" +
1340
			"      case true ? (String) null : (String) null : break;\n" +
1341
			"	}\n" +
1342
			"    }\n" +
1343
			"}\n"
1344
		},
1345
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
1346
}
1347
// JDK7: Strings in Switch.
1348
public void testDuplicateCase3() {
1349
		String newMessage = 
1350
			"----------\n" + 
1351
			"1. ERROR in X.java (at line 9)\n" + 
1352
			"	case \"123\": break;\n" + 
1353
			"	^^^^^^^^^^\n" + 
1354
			"Duplicate case\n" + 
1355
			"----------\n" + 
1356
			"2. ERROR in X.java (at line 10)\n" + 
1357
			"	case \"1\" + \"2\" + \"3\": break;\n" + 
1358
			"	^^^^^^^^^^^^^^^^^^^^\n" + 
1359
			"Duplicate case\n" + 
1360
			"----------\n" + 
1361
			"3. ERROR in X.java (at line 12)\n" + 
1362
			"	case local: break;\n" + 
1363
			"	^^^^^^^^^^\n" + 
1364
			"Duplicate case\n" + 
1365
			"----------\n" + 
1366
			"4. ERROR in X.java (at line 13)\n" + 
1367
			"	case field: break;\n" + 
1368
			"	^^^^^^^^^^\n" + 
1369
			"Duplicate case\n" + 
1370
			"----------\n" + 
1371
			"5. ERROR in X.java (at line 14)\n" + 
1372
			"	case ifield: break;\n" + 
1373
			"	^^^^^^^^^^^\n" + 
1374
			"Duplicate case\n" + 
1375
			"----------\n" + 
1376
			"6. ERROR in X.java (at line 18)\n" + 
1377
			"	default: break;\n" + 
1378
			"	^^^^^^^\n" + 
1379
			"The default case is already defined\n" + 
1380
			"----------\n";
1381
		
1382
		String oldMessage = 
1383
			"----------\n" + 
1384
			"1. ERROR in X.java (at line 8)\n" + 
1385
			"	switch(args[0]) {\n" + 
1386
			"	       ^^^^^^^\n" + 
1387
			"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1388
			"----------\n" + 
1389
			"2. ERROR in X.java (at line 18)\n" + 
1390
			"	default: break;\n" + 
1391
			"	^^^^^^^\n" + 
1392
			"The default case is already defined\n" + 
1393
			"----------\n";
1394
				
1395
		this.runNegativeTest(new String[] {
1396
			"X.java",
1397
			"public class X {\n" +
1398
			"    static final String field = \"123\";\n" +
1399
			"    final String ifield = \"123\";\n" +
1400
			"    String inffield = \"123\";\n" +
1401
			"    static String nffield = \"123\";\n" +
1402
			"    public  void main(String [] args, final String argument) {\n" +
1403
			"        final String local = \"123\";\n" +
1404
			"	switch(args[0]) {\n" + 
1405
			"	   case \"123\": break;\n" +
1406
			"	   case \"1\" + \"2\" + \"3\": break;\n" +
1407
			"           default: break;\n" +
1408
			"	   case local: break;\n" +
1409
			"           case field: break;\n" +
1410
			"           case ifield: break;\n" +
1411
			"           case inffield: break;\n" +
1412
			"           case nffield: break;\n" +
1413
			"           case argument: break;\n" +
1414
			"           default: break;\n" +
1415
			"	}\n" +
1416
			"    }\n" +
1417
			"}\n"
1418
		},
1419
		this.complianceLevel >= JDKLevelSupportingStringSwitch ? newMessage : oldMessage);
1420
}
1421
1422
public void testDuplicateHashCode() {
1423
	String errorMsg = 		
1424
		"----------\n" + 
1425
		"1. ERROR in testDuplicateHashCode.java (at line 5)\n" + 
1426
		"	switch (dispatcher) {\n" + 
1427
		"	        ^^^^^^^^^^\n" + 
1428
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1429
		"----------\n";
1430
	
1431
	String [] sourceFiles = 
1432
		new String[] {
1433
		"testDuplicateHashCode.java",
1434
		"public class testDuplicateHashCode {\n" +
1435
		"	public static void main(String[] argv) {\n" +
1436
		"		String dispatcher = \"\u0000\";\n" +
1437
		"		for (int i = 0; i < 100; i++) {\n" +
1438
		"			switch (dispatcher) {\n" +
1439
		"			case \"\u0000\":\n" +
1440
		"				System.out.print(\"1 \");\n" +
1441
		"				break;\n" +
1442
		"			case \"\u0000\u0000\":\n" +
1443
		"				System.out.print(\"2 \");\n" +
1444
		"				break;\n" +
1445
		"			case \"\u0000\u0000\u0000\":\n" +
1446
		"				System.out.print(\"3 \");\n" +
1447
		"				break;\n" +
1448
		"			case \"\u0000\u0000\u0000\u0000\":\n" +
1449
		"				System.out.print(\"4 \");\n" +
1450
		"				break;\n" +
1451
		"			case \"\u0000\u0000\u0000\u0000\u0000\":\n" +
1452
		"				System.out.print(\"5 \");\n" +
1453
		"				break;\n" +
1454
		"			default:\n" +
1455
		"				System.out.println(\"Default\");\n" +
1456
		"				System.exit(0);\n" +
1457
		"			case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
1458
		"				System.out.print(\"8 \");\n" +
1459
		"				break;\n" +
1460
		"			case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
1461
		"				System.out.print(\"7 \");\n" +
1462
		"				break;\n" +
1463
		"			case \"\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
1464
		"				System.out.print(\"6 \");\n" +
1465
		"				break;\n" +
1466
		"			}\n" +
1467
		"			dispatcher += \"\u0000\";\n" +
1468
		"		}\n" +
1469
		"	}\n" +
1470
		"}\n",
1471
	};
1472
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1473
		this.runNegativeTest(sourceFiles, errorMsg);
1474
	} else {
1475
		this.runConformTest(sourceFiles, "1 2 3 4 5 6 7 8 Default");
1476
	}
1477
}
1478
public void testDuplicateHashCode2() {
1479
	String errorMsg = 		
1480
		"----------\n" + 
1481
		"1. ERROR in testDuplicateHashCode.java (at line 5)\n" + 
1482
		"	switch (dispatcher) {\n" + 
1483
		"	        ^^^^^^^^^^\n" + 
1484
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1485
		"----------\n";
1486
	
1487
	String [] sourceFiles = 
1488
		new String[] {
1489
		"testDuplicateHashCode.java",
1490
		"public class testDuplicateHashCode {\n" +
1491
		"	public static void main(String[] argv) {\n" +
1492
		"		String dispatcher = \"\u0000\";\n" +
1493
		"		while(true) {\n" +
1494
		"			switch (dispatcher) {\n" +
1495
		"			case \"\u0000\":\n" +
1496
		"				System.out.print(\"1 \");\n" +
1497
		"               dispatcher += \"\u0000\u0000\";\n" +
1498
		"				break;\n" +
1499
		"			case \"\u0000\u0000\":\n" +
1500
		"				System.out.print(\"2 \");\n" +
1501
		"               dispatcher = \"\";\n" +
1502
		"				break;\n" +
1503
		"			case \"\u0000\u0000\u0000\":\n" +
1504
		"				System.out.print(\"3 \");\n" +
1505
		"               dispatcher += \"\u0000\u0000\";\n" +
1506
		"				break;\n" +
1507
		"			case \"\u0000\u0000\u0000\u0000\":\n" +
1508
		"				System.out.print(\"4 \");\n" +
1509
		"               dispatcher = \"\u0000\u0000\";\n" +
1510
		"				break;\n" +
1511
		"			case \"\u0000\u0000\u0000\u0000\u0000\":\n" +
1512
		"				System.out.print(\"5 \");\n" +
1513
		"               dispatcher += \"\u0000\u0000\";\n" +
1514
		"				break;\n" +
1515
		"			default:\n" +
1516
		"				System.out.println(\"Default\");\n" +
1517
		"				System.exit(0);\n" +
1518
		"			case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
1519
		"				System.out.print(\"8 \");\n" +
1520
		"               dispatcher = \"\u0000\u0000\u0000\u0000\u0000\u0000\";\n" +
1521
		"				break;\n" +
1522
		"			case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
1523
		"				System.out.print(\"7 \");\n" +
1524
		"               dispatcher += \"\u0000\";\n" +
1525
		"				break;\n" +
1526
		"			case \"\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
1527
		"				System.out.print(\"6 \");\n" +
1528
		"               dispatcher = \"\u0000\u0000\u0000\u0000\";\n" +
1529
		"				break;\n" +
1530
		"			}\n" +
1531
		"		}\n" +
1532
		"	}\n" +
1533
		"}\n",
1534
	};
1535
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1536
		this.runNegativeTest(sourceFiles, errorMsg);
1537
	} else {
1538
		this.runConformTest(sourceFiles, "1 3 5 7 8 6 4 2 Default");
1539
	}
1540
}
1541
public void testSwitchOnNull() {
1542
	String errorMsg = 		
1543
		"----------\n" + 
1544
		"1. ERROR in testSwitchOnNull.java (at line 13)\n" + 
1545
		"	switch (s) {\n" + 
1546
		"	        ^\n" + 
1547
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1548
		"----------\n" + 
1549
		"2. ERROR in testSwitchOnNull.java (at line 23)\n" + 
1550
		"	switch ((String) null) {\n" + 
1551
		"	        ^^^^^^^^^^^^^\n" + 
1552
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1553
		"----------\n" + 
1554
		"3. ERROR in testSwitchOnNull.java (at line 33)\n" + 
1555
		"	switch (someMethod()) {\n" + 
1556
		"	        ^^^^^^^^^^^^\n" + 
1557
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1558
		"----------\n" + 
1559
		"4. ERROR in testSwitchOnNull.java (at line 40)\n" + 
1560
		"	switch (nullString) {\n" + 
1561
		"	        ^^^^^^^^^^\n" + 
1562
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1563
		"----------\n" + 
1564
		"5. ERROR in testSwitchOnNull.java (at line 47)\n" + 
1565
		"	switch (someMethod()) {\n" + 
1566
		"	        ^^^^^^^^^^^^\n" + 
1567
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1568
		"----------\n";
1569
	
1570
	String [] sourceFiles = 
1571
		new String[] {
1572
		"testSwitchOnNull.java",
1573
		"public class testSwitchOnNull {\n" +
1574
		"\n" +
1575
		"    private static String someMethod() {\n" +
1576
		"        return null;\n" +
1577
		"    }\n" +
1578
		"\n" +
1579
		"    static String nullString = null;\n" +
1580
		"    public static void main(String [] args) {\n" +
1581
		"\n" +
1582
		"        String s = null;\n" +
1583
		"\n" +
1584
		"        try {\n" +
1585
		"            switch (s) {\n" +
1586
		"                default: \n" +
1587
		"                    System.out.println(\"OOPS\");\n" +
1588
		"	            break;\n" +
1589
		"            }\n" +
1590
		"            System.out.println(\"OOPS\");\n" +
1591
		"        } catch (NullPointerException e) {\n" +
1592
		"            System.out.print(\"NPE1\");\n" +
1593
		"        }\n" +
1594
		"        try {\n" +
1595
		"            switch ((String) null) {\n" +
1596
		"                default: \n" +
1597
		"                    System.out.println(\"OOPS\");\n" +
1598
		"	            break;\n" +
1599
		"            }\n" +
1600
		"            System.out.println(\"OOPS\");\n" +
1601
		"        } catch (NullPointerException e) {\n" +
1602
		"            System.out.print(\"NPE2\");\n" +
1603
		"        }\n" +
1604
		"        try {\n" +
1605
		"            switch (someMethod()) {\n" +
1606
		"            }\n" +
1607
		"            System.out.println(\"OOPS\");\n" +
1608
		"        } catch (NullPointerException e) {\n" +
1609
		"            System.out.print(\"NPE3\");\n" +
1610
		"        }\n" +
1611
		"        try {\n" +
1612
		"            switch (nullString) {\n" +
1613
		"            }\n" +
1614
		"            System.out.println(\"OOPS\");\n" +
1615
		"        } catch (NullPointerException e) {\n" +
1616
		"            System.out.print(\"NPE4\");\n" +
1617
		"        }\n" +
1618
		"        try {\n" +
1619
		"            switch (someMethod()) {\n" +
1620
		"                default: \n" +
1621
		"                    System.out.println(\"OOPS\");\n" +
1622
		"	            break;\n" +
1623
		"            }\n" +
1624
		"            System.out.println(\"OOPS\");\n" +
1625
		"        } catch (NullPointerException e) {\n" +
1626
		"            System.out.print(\"NPE5\");\n" +
1627
		"        }\n" +
1628
		"    }\n" +
1629
		"}\n",
1630
	};
1631
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1632
		this.runNegativeTest(sourceFiles, errorMsg);
1633
	} else {
1634
		this.runConformTest(sourceFiles, "NPE1NPE2NPE3NPE4NPE5");
1635
	}
1636
}
1637
public void testSideEffect() {
1638
	String errorMsg = 		
1639
		"----------\n" + 
1640
		"1. ERROR in testSideEffect.java (at line 11)\n" + 
1641
		"	switch(dispatcher()) {\n" + 
1642
		"	       ^^^^^^^^^^^^\n" + 
1643
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1644
		"----------\n";
1645
	
1646
	String [] sourceFiles = 
1647
		new String[] {
1648
		"testSideEffect.java",
1649
		"public class testSideEffect {\n" +
1650
		"    static boolean firstTime = true;\n" +
1651
		"	private static String dispatcher() {\n" +
1652
		"    	if (!firstTime) {\n" +
1653
		"		System.out.print(\"OOPS\");\n" +
1654
		"    	}\n" +
1655
		"    	firstTime = false;\n" +
1656
		"    	return \"\u0000\";\n" +
1657
		"    }\n" +
1658
		"    public static void main(String [] args) {\n" +
1659
		"    		switch(dispatcher()) {\n" +
1660
		"    		case \"\u0000\u0000\": break;\n" +
1661
		"    		case \"\u0000\u0000\u0000\":	break;\n" +
1662
		"    		case \"\u0000\u0000\u0000\u0000\": break;\n" +
1663
		"    		case \"\u0000\u0000\u0000\u0000\u0000\": break;\n" +
1664
		"    		default: System.out.println(\"DONE\");\n" +
1665
		"    		}\n" +
1666
		"    }\n" +
1667
		"}\n",
1668
	};
1669
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1670
		this.runNegativeTest(sourceFiles, errorMsg);
1671
	} else {
1672
		this.runConformTest(sourceFiles, "DONE");
1673
	}
1674
}
1675
public void testFallThrough() {
1676
	String errorMsg = 		
1677
		"----------\n" + 
1678
		"1. ERROR in testFallThrough.java (at line 11)\n" + 
1679
		"	switch(s = dispatcher()) {\n" + 
1680
		"	       ^^^^^^^^^^^^^^^^\n" + 
1681
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1682
		"----------\n";
1683
	
1684
	String [] sourceFiles = 
1685
		new String[] {
1686
		"testFallThrough.java",
1687
		"public class testFallThrough {\n" +
1688
		"    static int index = -1;\n" +
1689
		"    static String string = \"0123456789*\";\n" +
1690
		"    private static String dispatcher() {\n" +
1691
		"    	index++;\n" +
1692
		"     	return string.substring(index,index + 1);\n" +
1693
		"    }\n" +
1694
		"    public static void main(String [] args) {\n" +
1695
		"    	while (true) {\n" +
1696
		"    		String s = null;\n" +
1697
		"    		switch(s = dispatcher()) {\n" +
1698
		"    		case \"2\":\n" +
1699
		"    		case \"0\":\n" +
1700
		"    		case \"4\":\n" +
1701
		"    		case \"8\":\n" +
1702
		"    		case \"6\":\n" +
1703
		"    				System.out.print(s + \"(even) \");\n" +
1704
		"    				break;\n" +
1705
		"    		case \"1\":\n" +
1706
		"    		case \"3\":\n" +
1707
		"    		case \"9\":\n" +
1708
		"    		case \"5\":\n" +
1709
		"    		case \"7\":\n" +
1710
		"    				System.out.print(s + \"(odd) \");\n" +
1711
		"    				break;\n" +
1712
		"    		default: System.out.print(\"DONE\");\n" +
1713
		"    				System.exit(0);\n" +
1714
		"    		}\n" +
1715
		"    	}\n" +
1716
		"    }\n" +
1717
		"}\n",
1718
	};
1719
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1720
		this.runNegativeTest(sourceFiles, errorMsg);
1721
	} else {
1722
		this.runConformTest(sourceFiles, "0(even) 1(odd) 2(even) 3(odd) 4(even) 5(odd) 6(even) 7(odd) 8(even) 9(odd) DONE");
1723
	}
1724
}
1725
public void testFallThrough2() {
1726
	String errorMsg = 		
1727
		"----------\n" + 
1728
		"1. ERROR in testFallThrough.java (at line 11)\n" + 
1729
		"	switch(s = dispatcher()) {\n" + 
1730
		"	       ^^^^^^^^^^^^^^^^\n" + 
1731
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1732
		"----------\n";
1733
	
1734
	String [] sourceFiles = 
1735
		new String[] {
1736
		"testFallThrough.java",
1737
		"public class testFallThrough {\n" +
1738
		"    static int index = -1;\n" +
1739
		"    static String string = \"0123456789*\";\n" +
1740
		"    private static String dispatcher() {\n" +
1741
		"    	index++;\n" +
1742
		"     	return string.substring(index,index + 1);\n" +
1743
		"    }\n" +
1744
		"    public static void main(String [] args) {\n" +
1745
		"    	while (true) {\n" +
1746
		"    		String s = null;\n" +
1747
		"    		switch(s = dispatcher()) {\n" +
1748
		"    		case \"4\": System.out.print(s);\n" +
1749
		"    		case \"3\": System.out.print(s);\n" +
1750
		"    		case \"2\": System.out.print(s);\n" +
1751
		"    		case \"1\": System.out.print(s + \" \");\n" +
1752
		"    		case \"0\": break;\n" +
1753
		"    		default: System.out.print(\"DONE\");\n" +
1754
		"    				System.exit(0);\n" +
1755
		"    		}\n" +
1756
		"    	}\n" +
1757
		"    }\n" +
1758
		"}\n",
1759
	};
1760
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1761
		this.runNegativeTest(sourceFiles, errorMsg);
1762
	} else {
1763
		this.runConformTest(sourceFiles, "1 22 333 4444 DONE");
1764
	}
1765
}
1766
public void testMarysLamb() {
1767
	if (this.complianceLevel < ClassFileConstants.JDK1_5) {
1768
		return;
1769
	}
1770
		
1771
	String errorMsg = 		
1772
		"----------\n" + 
1773
		"1. ERROR in testMarysLamb.java (at line 4)\n" + 
1774
		"	switch(s) {\n" + 
1775
		"	       ^\n" + 
1776
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1777
		"----------\n";
1778
	
1779
	String [] sourceFiles = 
1780
		new String[] {
1781
		"testMarysLamb.java",
1782
		"public class testMarysLamb {\n" +
1783
		"    public static void main(String [] args) {\n" +
1784
		"    	for (String s : new String [] { \"Mary\", \"Had\", \"A\", \"Little\", \"Lamb\" }) {\n" +
1785
		"    		switch(s) {\n" +
1786
		"    			default: System.out.print(s + \" \");\n" +
1787
		"    		}\n" +
1788
		"    	}\n" +
1789
		"    }\n" +
1790
		"}\n",
1791
	};
1792
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1793
		this.runNegativeTest(sourceFiles, errorMsg);
1794
	} else {
1795
		this.runConformTest(sourceFiles, "Mary Had A Little Lamb");
1796
	}
1797
}
1798
public void testBreakOut() {	
1799
	String errorMsg = 		
1800
		"----------\n" + 
1801
		"1. ERROR in testBreakOut.java (at line 5)\n" + 
1802
		"	switch(s) {\n" + 
1803
		"	       ^\n" + 
1804
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1805
		"----------\n";
1806
	
1807
	String [] sourceFiles = 
1808
		new String[] {
1809
		"testBreakOut.java",
1810
		"public class testBreakOut {\n" +
1811
		"    public static void main(String [] args) {\n" +
1812
		"    	junk: while (true) {\n" +
1813
		"    		String s = \"\";\n" +
1814
		"    		switch(s) {\n" +
1815
		"    		case \"7\":\n" +
1816
		"    				System.out.print(s + \"(odd) \");\n" +
1817
		"    				break;\n" +
1818
		"    		default: System.out.print(\"DONE\");\n" +
1819
		"    				System.exit(0);\n" +
1820
		"    				 break junk;\n" +
1821
		"    		}\n" +
1822
		"    	}\n" +
1823
		"   	System.out.println(\"Broken\");\n" +
1824
		"    }\n" +
1825
		"}\n",
1826
	};
1827
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1828
		this.runNegativeTest(sourceFiles, errorMsg);
1829
	} else {
1830
		this.runConformTest(sourceFiles, "DONE");
1831
	}
1832
}
1833
public void testMultipleSwitches() {
1834
	if (this.complianceLevel < ClassFileConstants.JDK1_5) {
1835
		return;
1836
	}
1837
	String errorMsg = 		
1838
		"----------\n" + 
1839
		"1. ERROR in X.java (at line 6)\n" + 
1840
		"	switch (s) {\n" + 
1841
		"	        ^\n" + 
1842
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1843
		"----------\n" + 
1844
		"2. ERROR in X.java (at line 35)\n" + 
1845
		"	switch (s) {\n" + 
1846
		"	        ^\n" + 
1847
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1848
		"----------\n" + 
1849
		"3. ERROR in X.java (at line 51)\n" + 
1850
		"	switch (s) {\n" + 
1851
		"	        ^\n" + 
1852
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1853
		"----------\n";
1854
	
1855
	String [] sourceFiles = 
1856
		new String[] {
1857
		"X.java",
1858
		"public class X {\n" +
1859
		"\n" +
1860
		"	public static void main(String[] args) {\n" +
1861
		"		\n" +
1862
		"		for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" +
1863
		"			switch (s) {\n" +
1864
		"			case \"Sunday\" : \n" +
1865
		"				System.out.print(\"Sunday\");\n" +
1866
		"				break;\n" +
1867
		"			case \"Monday\" :\n" +
1868
		"				System.out.print(\"Monday\");\n" +
1869
		"				break;\n" +
1870
		"			case \"Tuesday\" :\n" +
1871
		"				System.out.print(\"Tuesday\");\n" +
1872
		"				break;\n" +
1873
		"			case \"Wednesday\":\n" +
1874
		"				System.out.print(\"Wednesday\");\n" +
1875
		"				break;\n" +
1876
		"			case \"Thursday\":\n" +
1877
		"				System.out.print(\"Thursday\");\n" +
1878
		"				break;\n" +
1879
		"			case \"Friday\":\n" +
1880
		"				System.out.print(\"Friday\");\n" +
1881
		"				break;\n" +
1882
		"			case \"Saturday\":\n" +
1883
		"				System.out.print(\"Saturday\");\n" +
1884
		"				break;\n" +
1885
		"			default:\n" +
1886
		"				System.out.print(\" ---- \");\n" +
1887
		"				break;\n" +
1888
		"			}\n" +
1889
		"		}\n" +
1890
		"	  \n" +
1891
		"		for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" +
1892
		"			switch (s) {\n" +
1893
		"			case \"Sunday\" : \n" +
1894
		"			case \"Monday\" :\n" +
1895
		"			case \"Tuesday\" :\n" +
1896
		"			case \"Wednesday\":\n" +
1897
		"			case \"Thursday\":\n" +
1898
		"			case \"Friday\":\n" +
1899
		"			case \"Saturday\":\n" +
1900
		"				System.out.print(s);\n" +
1901
		"				break;\n" +
1902
		"			default:\n" +
1903
		"				System.out.print(\" ---- \");\n" +
1904
		"				break;\n" +
1905
		"			}	\n" +
1906
		"		}\n" +
1907
		"		for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" +
1908
		"			switch (s) {\n" +
1909
		"			case \"Saturday\":\n" +
1910
		"			case \"Sunday\" : \n" +
1911
		"				System.out.print(\"Holiday\");\n" +
1912
		"				break;\n" +
1913
		"			case \"Monday\" :\n" +
1914
		"			case \"Tuesday\" :\n" +
1915
		"			case \"Wednesday\":\n" +
1916
		"			case \"Thursday\":\n" +
1917
		"			case \"Friday\":\n" +
1918
		"				System.out.print(\"Workday\");\n" +
1919
		"				break;\n" +
1920
		"			default:\n" +
1921
		"				System.out.print(\" DONE\");\n" +
1922
		"				break;\n" +
1923
		"			}\n" +
1924
		"		}\n" +
1925
		"	}\n" +
1926
		"\n" +
1927
		"}\n",
1928
	};
1929
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1930
		this.runNegativeTest(sourceFiles, errorMsg);
1931
	} else {
1932
		this.runConformTest(sourceFiles, "SundayMondayTuesdayWednesdayThursdayFridaySaturday ---- SundayMondayTuesdayWednesdayThursdayFridaySaturday ---- HolidayWorkdayWorkdayWorkdayWorkdayWorkdayHoliday DONE");
1933
	}
1934
}
1935
public void testNestedSwitches() {
1936
	if (this.complianceLevel < ClassFileConstants.JDK1_5) {
1937
		return;
1938
	}
1939
	String errorMsg = 		
1940
		"----------\n" + 
1941
		"1. ERROR in X.java (at line 4)\n" + 
1942
		"	switch (s) {\n" + 
1943
		"	        ^\n" + 
1944
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1945
		"----------\n" + 
1946
		"2. ERROR in X.java (at line 7)\n" + 
1947
		"	switch (s) {\n" + 
1948
		"	        ^\n" + 
1949
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1950
		"----------\n" + 
1951
		"3. ERROR in X.java (at line 18)\n" + 
1952
		"	switch (s) {\n" + 
1953
		"	        ^\n" + 
1954
		"Cannot switch on a value of type String. Only convertible int values or enum constants are permitted\n" + 
1955
		"----------\n";
1956
	
1957
	String [] sourceFiles = 
1958
		new String[] {
1959
		"X.java",
1960
		"public class X {\n" +
1961
		"	public static void main(String[] args) {\n" +
1962
		"		for (String s: new String [] { \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"DONE\"}) {\n" +
1963
		"			switch (s) {\n" +
1964
		"			case \"Saturday\":\n" +
1965
		"			case \"Sunday\" : \n" +
1966
		"				switch (s) {\n" +
1967
		"					case \"Saturday\" : System.out.println (\"Saturday is a holiday\"); break;\n" +
1968
		"					case \"Sunday\"  :  System.out.println (\"Sunday is a holiday\"); break;\n" +
1969
		"					default:          System.out.println(\"Broken\");\n" +
1970
		"				}\n" +
1971
		"				break;\n" +
1972
		"			case \"Monday\" :\n" +
1973
		"			case \"Tuesday\" :\n" +
1974
		"			case \"Wednesday\":\n" +
1975
		"			case \"Thursday\":\n" +
1976
		"			case \"Friday\":\n" +
1977
		"				switch (s) {\n" +
1978
		"					case \"Monday\" :  System.out.println (\"Monday is a workday\"); break;\n" +
1979
		"					case \"Tuesday\" : System.out.println (\"Tuesday is a workday\"); break;\n" +
1980
		"					case \"Wednesday\": System.out.println (\"Wednesday is a workday\"); break;\n" +
1981
		"					case \"Thursday\": System.out.println (\"Thursday is a workday\"); break;\n" +
1982
		"					case \"Friday\":System.out.println (\"Friday is a workday\"); break;\n" +
1983
		"					default: System.out.println(\"Broken\");\n" +
1984
		"				}\n" +
1985
		"				break;\n" +
1986
		"			default:\n" +
1987
		"				System.out.println(\"DONE\");\n" +
1988
		"				break;\n" +
1989
		"			}\n" +
1990
		"		}\n" +
1991
		"	}\n" +
1992
		"}\n",
1993
	};
1994
	if (this.complianceLevel < JDKLevelSupportingStringSwitch) {
1995
		this.runNegativeTest(sourceFiles, errorMsg);
1996
	} else {
1997
		this.runConformTest(sourceFiles, "Sunday is a holiday\n" +
1998
										 "Monday is a workday\n" +
1999
										 "Tuesday is a workday\n" +
2000
										 "Wednesday is a workday\n" +
2001
										 "Thursday is a workday\n" +
2002
										 "Friday is a workday\n" +
2003
										 "Saturday is a holiday\n" +
2004
										 "DONE");
2005
	}
2006
}
832
public static Class testClass() {
2007
public static Class testClass() {
833
	return SwitchTest.class;
2008
	return SwitchTest.class;
834
}
2009
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java (+2288 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 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
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.compiler.regression;
12
13
import java.io.File;
14
15
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
16
17
import junit.framework.Test;
18
19
public class TypeAnnotationTest extends AbstractRegressionTest {
20
21
	static {
22
//		TESTS_NUMBERS = new int [] { 40 };
23
	}
24
	public static Class testClass() {
25
		return TypeAnnotationTest.class;
26
	}
27
	public static Test suite() {
28
		return buildMinimalComplianceTestSuite(testClass(), F_1_7);
29
	}
30
	public TypeAnnotationTest(String testName){
31
		super(testName);
32
	}
33
	// superclass
34
	public void test001() throws Exception {
35
		this.runConformTest(
36
				new String[] {
37
					"Marker.java",
38
					"import java.lang.annotation.Target;\n" + 
39
					"import static java.lang.annotation.ElementType.*;\n" + 
40
					"@Target(TYPE_USE)\n" + 
41
					"@interface Marker {}",
42
					"X.java",
43
					"public class X extends @Marker Object {}",
44
				},
45
				"");
46
		String expectedOutput =
47
			"  RuntimeInvisibleTypeAnnotations: \n" + 
48
			"    #17 @Marker(\n" + 
49
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
50
			"      type index = -1\n" + 
51
			"    )\n";
52
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
53
	}
54
	// type parameter
55
	public void test002() throws Exception {
56
		this.runConformTest(
57
				new String[] {
58
					"Marker.java",
59
					"import java.lang.annotation.Target;\n" + 
60
					"import static java.lang.annotation.ElementType.*;\n" + 
61
					"@Target(TYPE_PARAMETER)\n" + 
62
					"@interface Marker {}",
63
					"X.java",
64
					"public class X<@Marker T> {}",
65
				},
66
				"");
67
		String expectedOutput =
68
			"  RuntimeInvisibleTypeAnnotations: \n" + 
69
			"    #21 @Marker(\n" + 
70
			"      target type = 0x22 CLASS_TYPE_PARAMETER\n" + 
71
			"      type parameter index = 0\n" + 
72
			"    )\n";
73
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
74
	}
75
	// superclass
76
	public void test003() throws Exception {
77
		this.runConformTest(
78
			new String[] {
79
				"A.java",
80
				"import java.lang.annotation.Target;\n" + 
81
				"import static java.lang.annotation.ElementType.*;\n" + 
82
				"import java.lang.annotation.Retention;\n" + 
83
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
84
				"@Target(TYPE_USE)\n" + 
85
				"@Retention(RUNTIME)\n" + 
86
				"@interface A {\n" + 
87
				"	String id() default \"default\";\n" + 
88
				"}\n",
89
				"B.java",
90
				"import java.lang.annotation.Target;\n" + 
91
				"import static java.lang.annotation.ElementType.*;\n" + 
92
				"import java.lang.annotation.Retention;\n" + 
93
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
94
				"@Target(TYPE_USE)\n" + 
95
				"@Retention(CLASS)\n" + 
96
				"@interface B {\n" + 
97
				"	int value() default -1;\n" + 
98
				"}",
99
				"C.java",
100
				"import java.lang.annotation.Target;\n" + 
101
				"import static java.lang.annotation.ElementType.*;\n" + 
102
				"import java.lang.annotation.Retention;\n" + 
103
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
104
				"@Target(TYPE_USE)\n" + 
105
				"@Retention(RUNTIME)\n" + 
106
				"@interface C {\n" + 
107
				"	char value() default '-';\n" + 
108
				"}\n",
109
				"Y.java",
110
				"class Y {}\n",
111
				"X.java",
112
				"public class X extends @A(id=\"Hello, World!\") @B @C('(') Y {\n" + 
113
				"}",
114
		},
115
		"");
116
		String expectedOutput =
117
			"  RuntimeVisibleTypeAnnotations: \n" + 
118
			"    #19 @A(\n" + 
119
			"      #20 id=\"Hello, World!\" (constant type)\n" + 
120
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
121
			"      type index = -1\n" + 
122
			"    )\n" + 
123
			"    #22 @C(\n" + 
124
			"      #23 value=\'(\' (constant type)\n" + 
125
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
126
			"      type index = -1\n" + 
127
			"    )\n" + 
128
			"  RuntimeInvisibleTypeAnnotations: \n" + 
129
			"    #17 @B(\n" + 
130
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
131
			"      type index = -1\n" + 
132
			"    )\n";
133
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
134
	}
135
	// super interfaces
136
	public void test004() throws Exception {
137
		this.runConformTest(
138
			new String[] {
139
				"A.java",
140
				"import java.lang.annotation.Target;\n" + 
141
				"import static java.lang.annotation.ElementType.*;\n" + 
142
				"import java.lang.annotation.Retention;\n" + 
143
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
144
				"@Target(TYPE_USE)\n" + 
145
				"@Retention(RUNTIME)\n" + 
146
				"@interface A {\n" + 
147
				"	String id() default \"default\";\n" + 
148
				"}\n",
149
				"B.java",
150
				"import java.lang.annotation.Target;\n" + 
151
				"import static java.lang.annotation.ElementType.*;\n" + 
152
				"import java.lang.annotation.Retention;\n" + 
153
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
154
				"@Target(TYPE_USE)\n" + 
155
				"@Retention(CLASS)\n" + 
156
				"@interface B {\n" + 
157
				"	int value() default -1;\n" + 
158
				"}",
159
				"C.java",
160
				"import java.lang.annotation.Target;\n" + 
161
				"import static java.lang.annotation.ElementType.*;\n" + 
162
				"import java.lang.annotation.Retention;\n" + 
163
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
164
				"@Target(TYPE_USE)\n" + 
165
				"@Retention(RUNTIME)\n" + 
166
				"@interface C {\n" + 
167
				"	char value() default '-';\n" + 
168
				"}\n",
169
				"I.java",
170
				"interface I {}\n",
171
				"J.java",
172
				"interface J {}\n",
173
				"X.java",
174
				"public class X implements @A(id=\"Hello, World!\") I, @B @C('(') J {}",
175
		},
176
		"");
177
		String expectedOutput =
178
			"  RuntimeVisibleTypeAnnotations: \n" + 
179
			"    #23 @A(\n" + 
180
			"      #24 id=\"Hello, World!\" (constant type)\n" + 
181
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
182
			"      type index = 0\n" + 
183
			"    )\n" + 
184
			"    #26 @C(\n" + 
185
			"      #27 value=\'(\' (constant type)\n" + 
186
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
187
			"      type index = 1\n" + 
188
			"    )\n" + 
189
			"  RuntimeInvisibleTypeAnnotations: \n" + 
190
			"    #21 @B(\n" + 
191
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
192
			"      type index = 1\n" + 
193
			"    )\n";
194
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
195
	}
196
	// class literal
197
	public void test005() throws Exception {
198
		this.runConformTest(
199
			new String[] {
200
				"A.java",
201
				"import java.lang.annotation.Target;\n" + 
202
				"import static java.lang.annotation.ElementType.*;\n" + 
203
				"import java.lang.annotation.Retention;\n" + 
204
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
205
				"@Target(TYPE_USE)\n" + 
206
				"@Retention(RUNTIME)\n" + 
207
				"@interface A {\n" + 
208
				"	String value() default \"default\";\n" + 
209
				"}\n",
210
				"B.java",
211
				"import java.lang.annotation.Target;\n" + 
212
				"import static java.lang.annotation.ElementType.*;\n" + 
213
				"import java.lang.annotation.Retention;\n" + 
214
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
215
				"@Target(TYPE_USE)\n" + 
216
				"@Retention(CLASS)\n" + 
217
				"@interface B {\n" + 
218
				"	int value() default -1;\n" + 
219
				"}",
220
				"C.java",
221
				"import java.lang.annotation.Target;\n" + 
222
				"import static java.lang.annotation.ElementType.*;\n" + 
223
				"import java.lang.annotation.Retention;\n" + 
224
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
225
				"@Target(TYPE_USE)\n" + 
226
				"@Retention(RUNTIME)\n" + 
227
				"@interface C {\n" + 
228
				"	char value() default '-';\n" + 
229
				"}\n",
230
				"I.java",
231
				"interface I {}\n",
232
				"J.java",
233
				"interface J {}\n",
234
				"X.java",
235
				"public class X {\n" + 
236
				"	public boolean foo(String s) {\n" + 
237
				"		boolean b = (s instanceof @C('_') Object);\n" + 
238
				"		Object o = new @B(3) @A(\"new Object\") Object();\n" + 
239
				"		Class<?> c = @B(4) Object.class;\n" + 
240
				"		Class<?> c2 = @A(\"int class literal\")  @B(5) int.class;\n" + 
241
				"		System.out.println(o.toString() + c.toString() + c2.toString());\n" + 
242
				"		return b;\n" + 
243
				"	}\n" + 
244
				"}",
245
		},
246
		"");
247
		String expectedOutput =
248
			"    RuntimeVisibleTypeAnnotations: \n" + 
249
			"      #73 @C(\n" + 
250
			"        #68 value=\'_\' (constant type)\n" + 
251
			"        target type = 0x2 TYPE_INSTANCEOF\n" + 
252
			"        offset = 1\n" + 
253
			"      )\n" + 
254
			"      #75 @A(\n" + 
255
			"        #68 value=\"new Object\" (constant type)\n" + 
256
			"        target type = 0x4 OBJECT_CREATION\n" + 
257
			"        offset = 5\n" + 
258
			"      )\n" + 
259
			"      #75 @A(\n" + 
260
			"        #68 value=\"int class literal\" (constant type)\n" + 
261
			"        target type = 0x1e CLASS_LITERAL\n" + 
262
			"        offset = 17\n" + 
263
			"      )\n" + 
264
			"    RuntimeInvisibleTypeAnnotations: \n" + 
265
			"      #67 @B(\n" + 
266
			"        #68 value=(int) 3 (constant type)\n" + 
267
			"        target type = 0x4 OBJECT_CREATION\n" + 
268
			"        offset = 5\n" + 
269
			"      )\n" + 
270
			"      #67 @B(\n" + 
271
			"        #68 value=(int) 4 (constant type)\n" + 
272
			"        target type = 0x1e CLASS_LITERAL\n" + 
273
			"        offset = 13\n" + 
274
			"      )\n" + 
275
			"      #67 @B(\n" + 
276
			"        #68 value=(int) 5 (constant type)\n" + 
277
			"        target type = 0x1e CLASS_LITERAL\n" + 
278
			"        offset = 17\n" + 
279
			"      )\n";
280
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
281
	}
282
	// class literal generic and array
283
	public void test006() throws Exception {
284
		this.runConformTest(
285
			new String[] {
286
				"A.java",
287
				"import java.lang.annotation.Target;\n" + 
288
				"import static java.lang.annotation.ElementType.*;\n" + 
289
				"import java.lang.annotation.Retention;\n" + 
290
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
291
				"@Target(TYPE_USE)\n" + 
292
				"@Retention(RUNTIME)\n" + 
293
				"@interface A {\n" + 
294
				"	String value() default \"default\";\n" + 
295
				"}\n",
296
				"B.java",
297
				"import java.lang.annotation.Target;\n" + 
298
				"import static java.lang.annotation.ElementType.*;\n" + 
299
				"import java.lang.annotation.Retention;\n" + 
300
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
301
				"@Target(TYPE_USE)\n" + 
302
				"@Retention(CLASS)\n" + 
303
				"@interface B {\n" + 
304
				"	int value() default -1;\n" + 
305
				"}",
306
				"C.java",
307
				"import java.lang.annotation.Target;\n" + 
308
				"import static java.lang.annotation.ElementType.*;\n" + 
309
				"import java.lang.annotation.Retention;\n" + 
310
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
311
				"@Target(TYPE_USE)\n" + 
312
				"@Retention(RUNTIME)\n" + 
313
				"@interface C {\n" + 
314
				"	char value() default '-';\n" + 
315
				"}\n",
316
				"I.java",
317
				"interface I {}\n",
318
				"J.java",
319
				"interface J {}\n",
320
				"X.java",
321
				"public class X {\n" + 
322
				"	public boolean foo(Object o) {\n" + 
323
				"		boolean b = (o instanceof @C('_') Object[]);\n" + 
324
				"		Object o1 = new @B(3) @A(\"new Object\") Object[] {};\n" + 
325
				"		Class<?> c = @B(4) Object[].class;\n" + 
326
				"		Class<?> c2 = @A(\"int class literal\")  @B(5) int[].class;\n" + 
327
				"		System.out.println(o1.toString() + c.toString() + c2.toString());\n" + 
328
				"		return b;\n" + 
329
				"	}\n" + 
330
				"}",
331
		},
332
		"");
333
		String expectedOutput =
334
			"    RuntimeVisibleTypeAnnotations: \n" + 
335
			"      #70 @C(\n" + 
336
			"        #66 value=\'_\' (constant type)\n" + 
337
			"        target type = 0x2 TYPE_INSTANCEOF\n" + 
338
			"        offset = 1\n" + 
339
			"      )\n" + 
340
			"      #72 @A(\n" + 
341
			"        #66 value=\"int class literal\" (constant type)\n" + 
342
			"        target type = 0x1e CLASS_LITERAL\n" + 
343
			"        offset = 14\n" + 
344
			"      )\n" + 
345
			"    RuntimeInvisibleTypeAnnotations: \n" + 
346
			"      #65 @B(\n" + 
347
			"        #66 value=(int) 4 (constant type)\n" + 
348
			"        target type = 0x1e CLASS_LITERAL\n" + 
349
			"        offset = 10\n" + 
350
			"      )\n" + 
351
			"      #65 @B(\n" + 
352
			"        #66 value=(int) 5 (constant type)\n" + 
353
			"        target type = 0x1e CLASS_LITERAL\n" + 
354
			"        offset = 14\n" + 
355
			"      )\n";
356
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
357
	}
358
	// parameterized superclass
359
	public void test007() throws Exception {
360
		this.runConformTest(
361
			new String[] {
362
				"A.java",
363
				"import java.lang.annotation.Target;\n" + 
364
				"import static java.lang.annotation.ElementType.*;\n" + 
365
				"import java.lang.annotation.Retention;\n" + 
366
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
367
				"@Target(TYPE_USE)\n" + 
368
				"@Retention(RUNTIME)\n" + 
369
				"@interface A {\n" + 
370
				"	String value() default \"default\";\n" + 
371
				"}\n",
372
				"B.java",
373
				"import java.lang.annotation.Target;\n" + 
374
				"import static java.lang.annotation.ElementType.*;\n" + 
375
				"import java.lang.annotation.Retention;\n" + 
376
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
377
				"@Target(TYPE_USE)\n" + 
378
				"@Retention(CLASS)\n" + 
379
				"@interface B {\n" + 
380
				"	int value() default -1;\n" + 
381
				"}",
382
				"C.java",
383
				"import java.lang.annotation.Target;\n" + 
384
				"import static java.lang.annotation.ElementType.*;\n" + 
385
				"import java.lang.annotation.Retention;\n" + 
386
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
387
				"@Target(TYPE_USE)\n" + 
388
				"@Retention(RUNTIME)\n" + 
389
				"@interface C {\n" + 
390
				"	char value() default '-';\n" + 
391
				"}\n",
392
				"Y.java",
393
				"class Y<T> {}\n",
394
				"X.java",
395
				"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String> {\n" + 
396
				"}",
397
		},
398
		"");
399
		String expectedOutput =
400
			"  RuntimeVisibleTypeAnnotations: \n" + 
401
			"    #21 @A(\n" + 
402
			"      #22 value=\"Hello, World!\" (constant type)\n" + 
403
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
404
			"      type index = -1\n" + 
405
			"    )\n" + 
406
			"    #24 @C(\n" + 
407
			"      #22 value=\'(\' (constant type)\n" + 
408
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
409
			"      type index = -1\n" + 
410
			"      locations = {0}\n" + 
411
			"    )\n" + 
412
			"  RuntimeInvisibleTypeAnnotations: \n" + 
413
			"    #19 @B(\n" + 
414
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
415
			"      type index = -1\n" + 
416
			"      locations = {0}\n" + 
417
			"    )\n";
418
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
419
	}
420
	public void test008() throws Exception {
421
		this.runConformTest(
422
			new String[] {
423
				"A.java",
424
				"import java.lang.annotation.Target;\n" + 
425
				"import static java.lang.annotation.ElementType.*;\n" + 
426
				"import java.lang.annotation.Retention;\n" + 
427
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
428
				"@Target(TYPE_USE)\n" + 
429
				"@Retention(RUNTIME)\n" + 
430
				"@interface A {\n" + 
431
				"	String value() default \"default\";\n" + 
432
				"}\n",
433
				"B.java",
434
				"import java.lang.annotation.Target;\n" + 
435
				"import static java.lang.annotation.ElementType.*;\n" + 
436
				"import java.lang.annotation.Retention;\n" + 
437
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
438
				"@Target(TYPE_USE)\n" + 
439
				"@Retention(CLASS)\n" + 
440
				"@interface B {\n" + 
441
				"	int value() default -1;\n" + 
442
				"}",
443
				"C.java",
444
				"import java.lang.annotation.Target;\n" + 
445
				"import static java.lang.annotation.ElementType.*;\n" + 
446
				"import java.lang.annotation.Retention;\n" + 
447
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
448
				"@Target(TYPE_USE)\n" + 
449
				"@Retention(RUNTIME)\n" + 
450
				"@interface C {\n" + 
451
				"	char value() default '-';\n" + 
452
				"}\n",
453
				"I.java",
454
				"interface I<T> {}\n",
455
				"J.java",
456
				"interface J<U,T> {}\n",
457
				"X.java",
458
				"public class X implements I<@A(\"Hello, World!\") String>, @B J<String, @C('(') Integer> {}",
459
		},
460
		"");
461
		String expectedOutput =
462
			"  RuntimeVisibleTypeAnnotations: \n" + 
463
			"    #25 @A(\n" + 
464
			"      #26 value=\"Hello, World!\" (constant type)\n" + 
465
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
466
			"      type index = 0\n" + 
467
			"      locations = {0}\n" + 
468
			"    )\n" + 
469
			"    #28 @C(\n" + 
470
			"      #26 value=\'(\' (constant type)\n" + 
471
			"      target type = 0x15 CLASS_EXTENDS_IMPLEMENTS_GENERIC_OR_ARRAY\n" + 
472
			"      type index = 1\n" + 
473
			"      locations = {1}\n" + 
474
			"    )\n" + 
475
			"  RuntimeInvisibleTypeAnnotations: \n" + 
476
			"    #23 @B(\n" + 
477
			"      target type = 0x14 CLASS_EXTENDS_IMPLEMENTS\n" + 
478
			"      type index = 1\n" + 
479
			"    )\n";
480
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
481
	}
482
	// throws
483
	public void test009() throws Exception {
484
		this.runConformTest(
485
			new String[] {
486
				"A.java",
487
				"import java.lang.annotation.Target;\n" + 
488
				"import static java.lang.annotation.ElementType.*;\n" + 
489
				"import java.lang.annotation.Retention;\n" + 
490
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
491
				"@Target(TYPE_USE)\n" + 
492
				"@Retention(RUNTIME)\n" + 
493
				"@interface A {\n" + 
494
				"	String value() default \"default\";\n" + 
495
				"}\n",
496
				"B.java",
497
				"import java.lang.annotation.Target;\n" + 
498
				"import static java.lang.annotation.ElementType.*;\n" + 
499
				"import java.lang.annotation.Retention;\n" + 
500
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
501
				"@Target(TYPE_USE)\n" + 
502
				"@Retention(CLASS)\n" + 
503
				"@interface B {\n" + 
504
				"	int value() default -1;\n" + 
505
				"}",
506
				"C.java",
507
				"import java.lang.annotation.Target;\n" + 
508
				"import static java.lang.annotation.ElementType.*;\n" + 
509
				"import java.lang.annotation.Retention;\n" + 
510
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
511
				"@Target(TYPE_USE)\n" + 
512
				"@Retention(RUNTIME)\n" + 
513
				"@interface C {\n" + 
514
				"	char value() default '-';\n" + 
515
				"}\n",
516
				"E.java",
517
				"class E extends RuntimeException {\n" +
518
				"	private static final long serialVersionUID = 1L;\n" +
519
				"}\n",
520
				"E1.java",
521
				"class E1 extends RuntimeException {\n" +
522
				"	private static final long serialVersionUID = 1L;\n" +
523
				"}\n",
524
				"E2.java",
525
				"class E2 extends RuntimeException {\n" +
526
				"	private static final long serialVersionUID = 1L;\n" +
527
				"}\n",
528
				"X.java",
529
				"public class X {\n" +
530
				"	void foo() throws @A(\"Hello, World!\") E, E1, @B @C('(') E2 {}\n" +
531
				"}",
532
		},
533
		"");
534
		String expectedOutput =
535
			"    RuntimeVisibleTypeAnnotations: \n" + 
536
			"      #25 @A(\n" + 
537
			"        #26 value=\"Hello, World!\" (constant type)\n" + 
538
			"        target type = 0x16 THROWS\n" + 
539
			"        throws index = 0\n" + 
540
			"      )\n" + 
541
			"      #28 @C(\n" + 
542
			"        #26 value=\'(\' (constant type)\n" + 
543
			"        target type = 0x16 THROWS\n" + 
544
			"        throws index = 2\n" + 
545
			"      )\n" + 
546
			"    RuntimeInvisibleTypeAnnotations: \n" + 
547
			"      #23 @B(\n" + 
548
			"        target type = 0x16 THROWS\n" + 
549
			"        throws index = 2\n" + 
550
			"      )\n";
551
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
552
	}
553
	// method receiver
554
	public void test010() throws Exception {
555
		this.runConformTest(
556
			new String[] {
557
				"A.java",
558
				"import java.lang.annotation.Target;\n" + 
559
				"import static java.lang.annotation.ElementType.*;\n" + 
560
				"import java.lang.annotation.Retention;\n" + 
561
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
562
				"@Target(TYPE_USE)\n" + 
563
				"@Retention(RUNTIME)\n" + 
564
				"@interface A {\n" + 
565
				"	String value() default \"default\";\n" + 
566
				"}\n",
567
				"B.java",
568
				"import java.lang.annotation.Target;\n" + 
569
				"import static java.lang.annotation.ElementType.*;\n" + 
570
				"import java.lang.annotation.Retention;\n" + 
571
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
572
				"@Target(TYPE_USE)\n" + 
573
				"@Retention(CLASS)\n" + 
574
				"@interface B {\n" + 
575
				"	int value() default -1;\n" + 
576
				"}",
577
				"X.java",
578
				"public class X {\n" + 
579
				"	void foo() @B(3) {}\n" + 
580
				"}",
581
		},
582
		"");
583
		String expectedOutput =
584
			"    RuntimeInvisibleTypeAnnotations: \n" + 
585
			"      #16 @B(\n" + 
586
			"        #17 value=(int) 3 (constant type)\n" + 
587
			"        target type = 0x6 METHOD_RECEIVER\n" + 
588
			"      )\n";
589
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
590
	}
591
	// method return type
592
	public void test011() throws Exception {
593
		this.runConformTest(
594
			new String[] {
595
				"A.java",
596
				"import java.lang.annotation.Target;\n" + 
597
				"import static java.lang.annotation.ElementType.*;\n" + 
598
				"import java.lang.annotation.Retention;\n" + 
599
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
600
				"@Target(TYPE_USE)\n" + 
601
				"@Retention(RUNTIME)\n" + 
602
				"@interface A {\n" + 
603
				"	String value() default \"default\";\n" + 
604
				"}\n",
605
				"B.java",
606
				"import java.lang.annotation.Target;\n" + 
607
				"import static java.lang.annotation.ElementType.*;\n" + 
608
				"import java.lang.annotation.Retention;\n" + 
609
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
610
				"@Target(TYPE_USE)\n" + 
611
				"@Retention(CLASS)\n" + 
612
				"@interface B {\n" + 
613
				"	int value() default -1;\n" + 
614
				"}",
615
				"X.java",
616
				"public class X {\n" + 
617
				"	@B(3) @A(value=\"test\") int foo() {\n" +
618
				"		return 1;\n" +
619
				"	}\n" + 
620
				"}",
621
		},
622
		"");
623
		String expectedOutput =
624
			"    RuntimeVisibleTypeAnnotations: \n" + 
625
			"      #21 @A(\n" + 
626
			"        #18 value=\"test\" (constant type)\n" + 
627
			"        target type = 0xa METHOD_RETURN_TYPE\n" + 
628
			"      )\n" + 
629
			"    RuntimeInvisibleTypeAnnotations: \n" + 
630
			"      #17 @B(\n" + 
631
			"        #18 value=(int) 3 (constant type)\n" + 
632
			"        target type = 0xa METHOD_RETURN_TYPE\n" + 
633
			"      )\n";
634
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
635
	}
636
	// field type
637
	public void test012() throws Exception {
638
		this.runConformTest(
639
			new String[] {
640
				"A.java",
641
				"import java.lang.annotation.Target;\n" + 
642
				"import static java.lang.annotation.ElementType.*;\n" + 
643
				"import java.lang.annotation.Retention;\n" + 
644
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
645
				"@Target(TYPE_USE)\n" + 
646
				"@Retention(RUNTIME)\n" + 
647
				"@interface A {\n" + 
648
				"	String value() default \"default\";\n" + 
649
				"}\n",
650
				"B.java",
651
				"import java.lang.annotation.Target;\n" + 
652
				"import static java.lang.annotation.ElementType.*;\n" + 
653
				"import java.lang.annotation.Retention;\n" + 
654
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
655
				"@Target(TYPE_USE)\n" + 
656
				"@Retention(CLASS)\n" + 
657
				"@interface B {\n" + 
658
				"	int value() default -1;\n" + 
659
				"}",
660
				"X.java",
661
				"public class X {\n" + 
662
				"	@B(3) @A int field;\n" +
663
				"}",
664
		},
665
		"");
666
		String expectedOutput =
667
			"    RuntimeVisibleTypeAnnotations: \n" + 
668
			"      #12 @A(\n" + 
669
			"        target type = 0xe FIELD\n" + 
670
			"      )\n" + 
671
			"    RuntimeInvisibleTypeAnnotations: \n" + 
672
			"      #8 @B(\n" + 
673
			"        #9 value=(int) 3 (constant type)\n" + 
674
			"        target type = 0xe FIELD\n" + 
675
			"      )\n";
676
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
677
	}
678
	// method parameter
679
	public void test013() throws Exception {
680
		this.runConformTest(
681
			new String[] {
682
				"B.java",
683
				"import java.lang.annotation.Target;\n" + 
684
				"import static java.lang.annotation.ElementType.*;\n" + 
685
				"import java.lang.annotation.Retention;\n" + 
686
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
687
				"@Target(TYPE_USE)\n" + 
688
				"@Retention(CLASS)\n" + 
689
				"@interface B {\n" + 
690
				"	int value() default -1;\n" + 
691
				"}",
692
				"X.java",
693
				"public class X {\n" + 
694
				"	int foo(@B(3) String s) {\n" +
695
				"		return s.length();\n" +
696
				"	}\n" + 
697
				"}",
698
		},
699
		"");
700
		String expectedOutput =
701
			"    RuntimeInvisibleTypeAnnotations: \n" + 
702
			"      #25 @B(\n" + 
703
			"        #26 value=(int) 3 (constant type)\n" + 
704
			"        target type = 0xc METHOD_PARAMETER\n" + 
705
			"        method parameter index = 0\n" + 
706
			"      )\n";
707
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
708
	}
709
	// method parameter generic or array
710
	public void test014() throws Exception {
711
		this.runConformTest(
712
			new String[] {
713
				"A.java",
714
				"import java.lang.annotation.Target;\n" + 
715
				"import static java.lang.annotation.ElementType.*;\n" + 
716
				"import java.lang.annotation.Retention;\n" + 
717
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
718
				"@Target(TYPE_USE)\n" + 
719
				"@Retention(RUNTIME)\n" + 
720
				"@interface A {\n" + 
721
				"	String value() default \"default\";\n" + 
722
				"}\n",
723
				"B.java",
724
				"import java.lang.annotation.Target;\n" + 
725
				"import static java.lang.annotation.ElementType.*;\n" + 
726
				"import java.lang.annotation.Retention;\n" + 
727
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
728
				"@Target(TYPE_USE)\n" + 
729
				"@Retention(CLASS)\n" + 
730
				"@interface B {\n" + 
731
				"	int value() default -1;\n" + 
732
				"}",
733
				"X.java",
734
				"public class X {\n" + 
735
				"	int foo(String @A [] @B(3) [] s) {\n" +
736
				"		return s.length;\n" +
737
				"	}\n" + 
738
				"}",
739
		},
740
		"");
741
		String expectedOutput =
742
			"    RuntimeVisibleTypeAnnotations: \n" + 
743
			"      #23 @A(\n" + 
744
			"        target type = 0xc METHOD_PARAMETER\n" + 
745
			"        method parameter index = 0\n" + 
746
			"      )\n" + 
747
			"    RuntimeInvisibleTypeAnnotations: \n" + 
748
			"      #19 @B(\n" + 
749
			"        #20 value=(int) 3 (constant type)\n" + 
750
			"        target type = 0xd METHOD_PARAMETER_GENERIC_OR_ARRAY\n" + 
751
			"        method parameter index = 0\n" + 
752
			"        locations = {0}\n" + 
753
			"      )\n";
754
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
755
	}
756
	// field type generic or array
757
	public void test015() throws Exception {
758
		this.runConformTest(
759
			new String[] {
760
				"A.java",
761
				"import java.lang.annotation.Target;\n" + 
762
				"import static java.lang.annotation.ElementType.*;\n" + 
763
				"import java.lang.annotation.Retention;\n" + 
764
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
765
				"@Target(TYPE_USE)\n" + 
766
				"@Retention(RUNTIME)\n" + 
767
				"@interface A {\n" + 
768
				"	String value() default \"default\";\n" + 
769
				"}\n",
770
				"B.java",
771
				"import java.lang.annotation.Target;\n" + 
772
				"import static java.lang.annotation.ElementType.*;\n" + 
773
				"import java.lang.annotation.Retention;\n" + 
774
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
775
				"@Target(TYPE_USE)\n" + 
776
				"@Retention(CLASS)\n" + 
777
				"@interface B {\n" + 
778
				"	int value() default -1;\n" + 
779
				"}",
780
				"X.java",
781
				"public class X {\n" + 
782
				"	@A int [] @B(3) [] field;\n" +
783
				"}",
784
		},
785
		"");
786
		String expectedOutput =
787
			"    RuntimeVisibleTypeAnnotations: \n" + 
788
			"      #12 @A(\n" + 
789
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
790
			"        locations = {1}\n" + 
791
			"      )\n" + 
792
			"    RuntimeInvisibleTypeAnnotations: \n" + 
793
			"      #8 @B(\n" + 
794
			"        #9 value=(int) 3 (constant type)\n" + 
795
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
796
			"        locations = {0}\n" + 
797
			"      )\n";
798
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
799
	}
800
	// class type parameter
801
	public void test016() throws Exception {
802
		this.runConformTest(
803
			new String[] {
804
				"A.java",
805
				"import java.lang.annotation.Target;\n" + 
806
				"import static java.lang.annotation.ElementType.*;\n" + 
807
				"import java.lang.annotation.Retention;\n" + 
808
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
809
				"@Target(TYPE_PARAMETER)\n" + 
810
				"@Retention(RUNTIME)\n" + 
811
				"@interface A {\n" + 
812
				"	String value() default \"default\";\n" + 
813
				"}\n",
814
				"B.java",
815
				"import java.lang.annotation.Target;\n" + 
816
				"import static java.lang.annotation.ElementType.*;\n" + 
817
				"import java.lang.annotation.Retention;\n" + 
818
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
819
				"@Target(TYPE_PARAMETER)\n" + 
820
				"@Retention(CLASS)\n" + 
821
				"@interface B {\n" + 
822
				"	int value() default -1;\n" + 
823
				"}",
824
				"X.java",
825
				"public class X<@A @B(3) T> {}",
826
		},
827
		"");
828
		String expectedOutput =
829
			"  RuntimeVisibleTypeAnnotations: \n" + 
830
			"    #25 @A(\n" + 
831
			"      target type = 0x22 CLASS_TYPE_PARAMETER\n" + 
832
			"      type parameter index = 0\n" + 
833
			"    )\n" + 
834
			"  RuntimeInvisibleTypeAnnotations: \n" + 
835
			"    #21 @B(\n" + 
836
			"      #22 value=(int) 3 (constant type)\n" + 
837
			"      target type = 0x22 CLASS_TYPE_PARAMETER\n" + 
838
			"      type parameter index = 0\n" + 
839
			"    )\n";
840
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
841
	}
842
	// method type parameter
843
	public void test017() throws Exception {
844
		this.runConformTest(
845
			new String[] {
846
				"A.java",
847
				"import java.lang.annotation.Target;\n" + 
848
				"import static java.lang.annotation.ElementType.*;\n" + 
849
				"import java.lang.annotation.Retention;\n" + 
850
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
851
				"@Target(TYPE_PARAMETER)\n" + 
852
				"@Retention(RUNTIME)\n" + 
853
				"@interface A {\n" + 
854
				"	String value() default \"default\";\n" + 
855
				"}\n",
856
				"B.java",
857
				"import java.lang.annotation.Target;\n" + 
858
				"import static java.lang.annotation.ElementType.*;\n" + 
859
				"import java.lang.annotation.Retention;\n" + 
860
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
861
				"@Target(TYPE_PARAMETER)\n" + 
862
				"@Retention(CLASS)\n" + 
863
				"@interface B {\n" + 
864
				"	int value() default -1;\n" + 
865
				"}",
866
				"X.java",
867
				"public class X {\n" + 
868
				"	<@A @B(3) T> void foo(T t) {}\n" + 
869
				"}",
870
		},
871
		"");
872
		String expectedOutput =
873
			"    RuntimeVisibleTypeAnnotations: \n" + 
874
			"      #27 @A(\n" + 
875
			"        target type = 0x20 METHOD_TYPE_PARAMETER\n" + 
876
			"        type parameter index = 0\n" + 
877
			"      )\n" + 
878
			"    RuntimeInvisibleTypeAnnotations: \n" + 
879
			"      #23 @B(\n" + 
880
			"        #24 value=(int) 3 (constant type)\n" + 
881
			"        target type = 0x20 METHOD_TYPE_PARAMETER\n" + 
882
			"        type parameter index = 0\n" + 
883
			"      )\n";
884
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
885
	}
886
	// class type parameter bound
887
	public void test018() throws Exception {
888
		this.runConformTest(
889
			new String[] {
890
				"A.java",
891
				"import java.lang.annotation.Target;\n" + 
892
				"import static java.lang.annotation.ElementType.*;\n" + 
893
				"import java.lang.annotation.Retention;\n" + 
894
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
895
				"@Target(TYPE_USE)\n" + 
896
				"@Retention(RUNTIME)\n" + 
897
				"@interface A {\n" + 
898
				"	String value() default \"default\";\n" + 
899
				"}\n",
900
				"B.java",
901
				"import java.lang.annotation.Target;\n" + 
902
				"import static java.lang.annotation.ElementType.*;\n" + 
903
				"import java.lang.annotation.Retention;\n" + 
904
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
905
				"@Target(TYPE_USE)\n" + 
906
				"@Retention(CLASS)\n" + 
907
				"@interface B {\n" + 
908
				"	int value() default -1;\n" + 
909
				"}",
910
				"X.java",
911
				"public class X<T extends @A String & @B(3) Cloneable> {}",
912
		},
913
		"");
914
		String expectedOutput =
915
			"  RuntimeVisibleTypeAnnotations: \n" + 
916
			"    #25 @A(\n" + 
917
			"      target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + 
918
			"      type parameter index = 0 type parameter bound index = 0\n" + 
919
			"    )\n" + 
920
			"  RuntimeInvisibleTypeAnnotations: \n" + 
921
			"    #21 @B(\n" + 
922
			"      #22 value=(int) 3 (constant type)\n" + 
923
			"      target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + 
924
			"      type parameter index = 0 type parameter bound index = 1\n" + 
925
			"    )\n" ;
926
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
927
	}
928
	// class type parameter bound generic or array
929
	public void test019() throws Exception {
930
		this.runConformTest(
931
			new String[] {
932
				"A.java",
933
				"import java.lang.annotation.Target;\n" + 
934
				"import static java.lang.annotation.ElementType.*;\n" + 
935
				"import java.lang.annotation.Retention;\n" + 
936
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
937
				"@Target(TYPE_USE)\n" + 
938
				"@Retention(RUNTIME)\n" + 
939
				"@interface A {\n" + 
940
				"	String value() default \"default\";\n" + 
941
				"}\n",
942
				"B.java",
943
				"import java.lang.annotation.Target;\n" + 
944
				"import static java.lang.annotation.ElementType.*;\n" + 
945
				"import java.lang.annotation.Retention;\n" + 
946
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
947
				"@Target(TYPE_USE)\n" + 
948
				"@Retention(CLASS)\n" + 
949
				"@interface B {\n" + 
950
				"	int value() default -1;\n" + 
951
				"}",
952
				"C.java",
953
				"import java.lang.annotation.Target;\n" + 
954
				"import static java.lang.annotation.ElementType.*;\n" + 
955
				"import java.lang.annotation.Retention;\n" + 
956
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
957
				"@Target(TYPE_USE)\n" + 
958
				"@Retention(RUNTIME)\n" + 
959
				"@interface C {\n" + 
960
				"	char value() default '-';\n" + 
961
				"}\n",
962
				"Y.java",
963
				"public class Y<T> {}",
964
				"X.java",
965
				"public class X<U, T extends Y<@A String @C[][]@B[]> & @B(3) Cloneable> {}",
966
		},
967
		"");
968
		String expectedOutput =
969
			"  RuntimeVisibleTypeAnnotations: \n" + 
970
			"    #25 @A(\n" + 
971
			"      target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
972
			"      type parameter index = 1 type parameter bound index = 0\n" + 
973
			"      locations = {0,2}\n" + 
974
			"    )\n" + 
975
			"    #26 @C(\n" + 
976
			"      target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
977
			"      type parameter index = 1 type parameter bound index = 0\n" + 
978
			"      locations = {0}\n" + 
979
			"    )\n" + 
980
			"  RuntimeInvisibleTypeAnnotations: \n" + 
981
			"    #21 @B(\n" + 
982
			"      target type = 0x11 CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
983
			"      type parameter index = 1 type parameter bound index = 0\n" + 
984
			"      locations = {0,1}\n" + 
985
			"    )\n" + 
986
			"    #21 @B(\n" + 
987
			"      #22 value=(int) 3 (constant type)\n" + 
988
			"      target type = 0x10 CLASS_TYPE_PARAMETER_BOUND\n" + 
989
			"      type parameter index = 1 type parameter bound index = 1\n" + 
990
			"    )\n";
991
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
992
	}
993
	// method type parameter bound
994
	public void test020() throws Exception {
995
		this.runConformTest(
996
			new String[] {
997
				"A.java",
998
				"import java.lang.annotation.Target;\n" + 
999
				"import static java.lang.annotation.ElementType.*;\n" + 
1000
				"import java.lang.annotation.Retention;\n" + 
1001
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1002
				"@Target(TYPE_USE)\n" + 
1003
				"@Retention(RUNTIME)\n" + 
1004
				"@interface A {\n" + 
1005
				"	String value() default \"default\";\n" + 
1006
				"}\n",
1007
				"B.java",
1008
				"import java.lang.annotation.Target;\n" + 
1009
				"import static java.lang.annotation.ElementType.*;\n" + 
1010
				"import java.lang.annotation.Retention;\n" + 
1011
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1012
				"@Target(TYPE_USE)\n" + 
1013
				"@Retention(CLASS)\n" + 
1014
				"@interface B {\n" + 
1015
				"	int value() default -1;\n" + 
1016
				"}",
1017
				"Z.java",
1018
				"public class Z {}",
1019
				"X.java",
1020
				"public class X {\n" +
1021
				"	<T extends @A Z & @B(3) Cloneable> void foo(T t) {}\n" +
1022
				"}",
1023
		},
1024
		"");
1025
		String expectedOutput =
1026
			"    RuntimeVisibleTypeAnnotations: \n" + 
1027
			"      #27 @A(\n" + 
1028
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1029
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1030
			"      )\n" + 
1031
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1032
			"      #23 @B(\n" + 
1033
			"        #24 value=(int) 3 (constant type)\n" + 
1034
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1035
			"        type parameter index = 0 type parameter bound index = 1\n" + 
1036
			"      )\n";
1037
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1038
	}
1039
	// class type parameter bound generic or array
1040
	public void test021() throws Exception {
1041
		this.runConformTest(
1042
			new String[] {
1043
				"A.java",
1044
				"import java.lang.annotation.Target;\n" + 
1045
				"import static java.lang.annotation.ElementType.*;\n" + 
1046
				"import java.lang.annotation.Retention;\n" + 
1047
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1048
				"@Target(TYPE_USE)\n" + 
1049
				"@Retention(RUNTIME)\n" + 
1050
				"@interface A {\n" + 
1051
				"	String value() default \"default\";\n" + 
1052
				"}\n",
1053
				"B.java",
1054
				"import java.lang.annotation.Target;\n" + 
1055
				"import static java.lang.annotation.ElementType.*;\n" + 
1056
				"import java.lang.annotation.Retention;\n" + 
1057
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1058
				"@Target(TYPE_USE)\n" + 
1059
				"@Retention(CLASS)\n" + 
1060
				"@interface B {\n" + 
1061
				"	int value() default -1;\n" + 
1062
				"}",
1063
				"C.java",
1064
				"import java.lang.annotation.Target;\n" + 
1065
				"import static java.lang.annotation.ElementType.*;\n" + 
1066
				"import java.lang.annotation.Retention;\n" + 
1067
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1068
				"@Target(TYPE_USE)\n" + 
1069
				"@Retention(RUNTIME)\n" + 
1070
				"@interface C {\n" + 
1071
				"	char value() default '-';\n" + 
1072
				"}\n",
1073
				"Z.java",
1074
				"public class Z {}",
1075
				"Y.java",
1076
				"public class Y<T> {}",
1077
				"X.java",
1078
				"public class X {\n" +
1079
				"	<T extends Y<@A Z @C[][]@B[]> & @B(3) Cloneable> void foo(T t) {}\n" +
1080
				"}",
1081
		},
1082
		"");
1083
		String expectedOutput =
1084
			"    RuntimeVisibleTypeAnnotations: \n" + 
1085
			"      #27 @A(\n" + 
1086
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1087
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1088
			"        locations = {0,2}\n" + 
1089
			"      )\n" + 
1090
			"      #28 @C(\n" + 
1091
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1092
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1093
			"        locations = {0}\n" + 
1094
			"      )\n" + 
1095
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1096
			"      #23 @B(\n" + 
1097
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1098
			"        type parameter index = 0 type parameter bound index = 0\n" + 
1099
			"        locations = {0,1}\n" + 
1100
			"      )\n" + 
1101
			"      #23 @B(\n" + 
1102
			"        #24 value=(int) 3 (constant type)\n" + 
1103
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1104
			"        type parameter index = 0 type parameter bound index = 1\n" + 
1105
			"      )\n";
1106
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1107
	}
1108
	// local variable + generic or array
1109
	public void test022() throws Exception {
1110
		this.runConformTest(
1111
			new String[] {
1112
				"A.java",
1113
				"import java.lang.annotation.Target;\n" + 
1114
				"import static java.lang.annotation.ElementType.*;\n" + 
1115
				"import java.lang.annotation.Retention;\n" + 
1116
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1117
				"@Target(TYPE_USE)\n" + 
1118
				"@Retention(RUNTIME)\n" + 
1119
				"@interface A {\n" + 
1120
				"	String value() default \"default\";\n" + 
1121
				"}\n",
1122
				"B.java",
1123
				"import java.lang.annotation.Target;\n" + 
1124
				"import static java.lang.annotation.ElementType.*;\n" + 
1125
				"import java.lang.annotation.Retention;\n" + 
1126
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1127
				"@Target(TYPE_USE)\n" + 
1128
				"@Retention(CLASS)\n" + 
1129
				"@interface B {\n" + 
1130
				"	int value() default -1;\n" + 
1131
				"}",
1132
				"C.java",
1133
				"import java.lang.annotation.Target;\n" + 
1134
				"import static java.lang.annotation.ElementType.*;\n" + 
1135
				"import java.lang.annotation.Retention;\n" + 
1136
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1137
				"@Target(TYPE_USE)\n" + 
1138
				"@Retention(RUNTIME)\n" + 
1139
				"@interface C {\n" + 
1140
				"	char value() default '-';\n" + 
1141
				"}\n",
1142
				"X.java",
1143
				"public class X {\n" + 
1144
				"	String[][] bar() {\n" + 
1145
				"		return new String[][] {};" +
1146
				"	}\n" + 
1147
				"	void foo(String s) {\n" + 
1148
				"		@C int i;\n" + 
1149
				"		@A String [] @B(3)[] tab = bar();\n" + 
1150
				"		if (tab != null) {\n" + 
1151
				"			i = 0;\n" + 
1152
				"			System.out.println(i + tab.length);\n" + 
1153
				"		} else {\n" + 
1154
				"			System.out.println(tab.length);\n" + 
1155
				"		}\n" + 
1156
				"		i = 4;\n" + 
1157
				"		System.out.println(-i + tab.length);\n" + 
1158
				"	}\n" + 
1159
				"}",
1160
		},
1161
		"");
1162
		String expectedOutput =
1163
			"    RuntimeVisibleTypeAnnotations: \n" + 
1164
			"      #49 @C(\n" + 
1165
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
1166
			"        local variable entries:\n" + 
1167
			"          [pc: 11, pc: 24] index: 2\n" + 
1168
			"          [pc: 34, pc: 46] index: 2\n" + 
1169
			"      )\n" + 
1170
			"      #50 @A(\n" + 
1171
			"        target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1172
			"        local variable entries:\n" + 
1173
			"          [pc: 5, pc: 46] index: 3\n" + 
1174
			"        locations = {1}\n" + 
1175
			"      )\n" + 
1176
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1177
			"      #45 @B(\n" + 
1178
			"        #46 value=(int) 3 (constant type)\n" + 
1179
			"        target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1180
			"        local variable entries:\n" + 
1181
			"          [pc: 5, pc: 46] index: 3\n" + 
1182
			"        locations = {0}\n" + 
1183
			"      )\n";
1184
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1185
	}
1186
	// type argument constructor call
1187
	public void test023() throws Exception {
1188
		this.runConformTest(
1189
			new String[] {
1190
				"A.java",
1191
				"import java.lang.annotation.Target;\n" + 
1192
				"import static java.lang.annotation.ElementType.*;\n" + 
1193
				"import java.lang.annotation.Retention;\n" + 
1194
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1195
				"@Target(TYPE_USE)\n" + 
1196
				"@Retention(RUNTIME)\n" + 
1197
				"@interface A {\n" + 
1198
				"	String value() default \"default\";\n" + 
1199
				"}\n",
1200
				"B.java",
1201
				"import java.lang.annotation.Target;\n" + 
1202
				"import static java.lang.annotation.ElementType.*;\n" + 
1203
				"import java.lang.annotation.Retention;\n" + 
1204
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1205
				"@Target(TYPE_USE)\n" + 
1206
				"@Retention(CLASS)\n" + 
1207
				"@interface B {\n" + 
1208
				"	int value() default -1;\n" + 
1209
				"}",
1210
				"X.java",
1211
				"public class X {\n" + 
1212
				"	<T> X(T t) {\n" + 
1213
				"	}\n" + 
1214
				"	public Object foo() {\n" + 
1215
				"		X x = new <@A @B(1) String>X(null);\n" + 
1216
				"		return x;\n" + 
1217
				"	}\n" + 
1218
				"}",
1219
		},
1220
		"");
1221
		String expectedOutput =
1222
			"    RuntimeVisibleTypeAnnotations: \n" + 
1223
			"      #31 @A(\n" + 
1224
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1225
			"        offset = 5\n" + 
1226
			"        type argument index = 0\n" + 
1227
			"      )\n" + 
1228
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1229
			"      #27 @B(\n" + 
1230
			"        #28 value=(int) 1 (constant type)\n" + 
1231
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1232
			"        offset = 5\n" + 
1233
			"        type argument index = 0\n" + 
1234
			"      )\n";
1235
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1236
	}
1237
	// type argument constructor call generic or array
1238
	public void test024() throws Exception {
1239
		this.runConformTest(
1240
			new String[] {
1241
				"A.java",
1242
				"import java.lang.annotation.Target;\n" + 
1243
				"import static java.lang.annotation.ElementType.*;\n" + 
1244
				"import java.lang.annotation.Retention;\n" + 
1245
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1246
				"@Target(TYPE_USE)\n" + 
1247
				"@Retention(RUNTIME)\n" + 
1248
				"@interface A {\n" + 
1249
				"	String value() default \"default\";\n" + 
1250
				"}\n",
1251
				"B.java",
1252
				"import java.lang.annotation.Target;\n" + 
1253
				"import static java.lang.annotation.ElementType.*;\n" + 
1254
				"import java.lang.annotation.Retention;\n" + 
1255
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1256
				"@Target(TYPE_USE)\n" + 
1257
				"@Retention(CLASS)\n" + 
1258
				"@interface B {\n" + 
1259
				"	int value() default -1;\n" + 
1260
				"}",
1261
				"C.java",
1262
				"import java.lang.annotation.Target;\n" + 
1263
				"import static java.lang.annotation.ElementType.*;\n" + 
1264
				"import java.lang.annotation.Retention;\n" + 
1265
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1266
				"@Target(TYPE_USE)\n" + 
1267
				"@Retention(RUNTIME)\n" + 
1268
				"@interface C {\n" + 
1269
				"	char value() default '-';\n" + 
1270
				"}\n",
1271
				"X.java",
1272
				"public class X {\n" + 
1273
				"	<T, U> X(T t, U u) {\n" + 
1274
				"	}\n" + 
1275
				"	public Object foo() {\n" + 
1276
				"		X x = new <@A Integer, @A String @C [] @B(1)[]>X(null, null);\n" + 
1277
				"		return x;\n" + 
1278
				"	}\n" + 
1279
				"}",
1280
		},
1281
		"");
1282
		String expectedOutput =
1283
			"    RuntimeVisibleTypeAnnotations: \n" + 
1284
			"      #33 @A(\n" + 
1285
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1286
			"        offset = 6\n" + 
1287
			"        type argument index = 0\n" + 
1288
			"      )\n" + 
1289
			"      #33 @A(\n" + 
1290
			"        target type = 0x19 TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY\n" + 
1291
			"        offset = 6\n" + 
1292
			"        type argument index = 1\n" + 
1293
			"        locations = {1}\n" + 
1294
			"      )\n" + 
1295
			"      #34 @C(\n" + 
1296
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1297
			"        offset = 6\n" + 
1298
			"        type argument index = 1\n" + 
1299
			"      )\n" + 
1300
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1301
			"      #29 @B(\n" + 
1302
			"        #30 value=(int) 1 (constant type)\n" + 
1303
			"        target type = 0x19 TYPE_ARGUMENT_CONSTRUCTOR_CALL_GENERIC_OR_ARRAY\n" + 
1304
			"        offset = 6\n" + 
1305
			"        type argument index = 1\n" + 
1306
			"        locations = {0}\n" + 
1307
			"      )\n";
1308
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1309
	}
1310
	// type argument method call
1311
	public void test025() throws Exception {
1312
		this.runConformTest(
1313
			new String[] {
1314
				"X.java",
1315
				"public class X {\n" +
1316
				"\n" +
1317
				"	static <T, U> T foo(T t, U u) {\n" +
1318
				"		return t;\n" +
1319
				"	}\n" +
1320
				"	public static void main(String[] args) {\n" +
1321
				"		System.out.println(X.<@A @B(1) String[], @C('-') X>foo(new String[]{\"SUCCESS\"}, null)[0]);\n" +
1322
				"	}\n" +
1323
				"}\n",
1324
				"A.java",
1325
				"import java.lang.annotation.Target;\n" + 
1326
				"import static java.lang.annotation.ElementType.*;\n" + 
1327
				"import java.lang.annotation.Retention;\n" + 
1328
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1329
				"@Target(TYPE_USE)\n" + 
1330
				"@Retention(RUNTIME)\n" + 
1331
				"@interface A {\n" + 
1332
				"	String value() default \"default\";\n" + 
1333
				"}\n",
1334
				"B.java",
1335
				"import java.lang.annotation.Target;\n" + 
1336
				"import static java.lang.annotation.ElementType.*;\n" + 
1337
				"import java.lang.annotation.Retention;\n" + 
1338
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1339
				"@Target(TYPE_USE)\n" + 
1340
				"@Retention(CLASS)\n" + 
1341
				"@interface B {\n" + 
1342
				"	int value() default -1;\n" + 
1343
				"}",
1344
				"C.java",
1345
				"import java.lang.annotation.Target;\n" + 
1346
				"import static java.lang.annotation.ElementType.*;\n" + 
1347
				"import java.lang.annotation.Retention;\n" + 
1348
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1349
				"@Target(TYPE_USE)\n" + 
1350
				"@Retention(RUNTIME)\n" + 
1351
				"@interface C {\n" + 
1352
				"	char value() default '-';\n" + 
1353
				"}\n",
1354
		},
1355
		"SUCCESS");
1356
		String expectedOutput =
1357
			"    RuntimeVisibleTypeAnnotations: \n" + 
1358
			"      #52 @A(\n" + 
1359
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
1360
			"        offset = 13\n" + 
1361
			"        type argument index = 0\n" + 
1362
			"      )\n" + 
1363
			"      #53 @C(\n" + 
1364
			"        #49 value=\'-\' (constant type)\n" + 
1365
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
1366
			"        offset = 13\n" + 
1367
			"        type argument index = 1\n" + 
1368
			"      )\n" + 
1369
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1370
			"      #48 @B(\n" + 
1371
			"        #49 value=(int) 1 (constant type)\n" + 
1372
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
1373
			"        offset = 13\n" + 
1374
			"        type argument index = 0\n" + 
1375
			"      )\n";
1376
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1377
	}
1378
	// check locations
1379
	public void test026() throws Exception {
1380
		this.runConformTest(
1381
			new String[] {
1382
				"X.java",
1383
				"import java.util.Map;\n" +
1384
				"import java.util.List;\n" +
1385
				"public class X {\n" + 
1386
				"	@H String @E[] @F[] @G[] field;\n" + 
1387
				"	@A Map<@B String, @C List<@D Object>> field2;\n" + 
1388
				"	@A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" + 
1389
				"}",
1390
				"A.java",
1391
				"import java.lang.annotation.Target;\n" + 
1392
				"import static java.lang.annotation.ElementType.*;\n" + 
1393
				"import java.lang.annotation.Retention;\n" + 
1394
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1395
				"@Target(TYPE_USE)\n" + 
1396
				"@Retention(RUNTIME)\n" + 
1397
				"@interface A {\n" + 
1398
				"	String value() default \"default\";\n" + 
1399
				"}\n",
1400
				"B.java",
1401
				"import java.lang.annotation.Target;\n" + 
1402
				"import static java.lang.annotation.ElementType.*;\n" + 
1403
				"import java.lang.annotation.Retention;\n" + 
1404
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1405
				"@Target(TYPE_USE)\n" + 
1406
				"@Retention(CLASS)\n" + 
1407
				"@interface B {\n" + 
1408
				"	int value() default -1;\n" + 
1409
				"}",
1410
				"C.java",
1411
				"import java.lang.annotation.Target;\n" + 
1412
				"import static java.lang.annotation.ElementType.*;\n" + 
1413
				"import java.lang.annotation.Retention;\n" + 
1414
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1415
				"@Target(TYPE_USE)\n" + 
1416
				"@Retention(RUNTIME)\n" + 
1417
				"@interface C {\n" + 
1418
				"	char value() default '-';\n" + 
1419
				"}\n",
1420
				"D.java",
1421
				"import java.lang.annotation.Target;\n" + 
1422
				"import static java.lang.annotation.ElementType.*;\n" + 
1423
				"import java.lang.annotation.Retention;\n" + 
1424
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1425
				"@Target(TYPE_USE)\n" + 
1426
				"@Retention(RUNTIME)\n" + 
1427
				"@interface D {\n" + 
1428
				"	String value() default \"default\";\n" + 
1429
				"}\n",
1430
				"E.java",
1431
				"import java.lang.annotation.Target;\n" + 
1432
				"import static java.lang.annotation.ElementType.*;\n" + 
1433
				"import java.lang.annotation.Retention;\n" + 
1434
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1435
				"@Target(TYPE_USE)\n" + 
1436
				"@Retention(CLASS)\n" + 
1437
				"@interface E {\n" + 
1438
				"	int value() default -1;\n" + 
1439
				"}",
1440
				"F.java",
1441
				"import java.lang.annotation.Target;\n" + 
1442
				"import static java.lang.annotation.ElementType.*;\n" + 
1443
				"import java.lang.annotation.Retention;\n" + 
1444
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1445
				"@Target(TYPE_USE)\n" + 
1446
				"@Retention(RUNTIME)\n" + 
1447
				"@interface F {\n" + 
1448
				"	char value() default '-';\n" + 
1449
				"}\n",
1450
				"G.java",
1451
				"import java.lang.annotation.Target;\n" + 
1452
				"import static java.lang.annotation.ElementType.*;\n" + 
1453
				"import java.lang.annotation.Retention;\n" + 
1454
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1455
				"@Target(TYPE_USE)\n" + 
1456
				"@Retention(CLASS)\n" + 
1457
				"@interface G {\n" + 
1458
				"	int value() default -1;\n" + 
1459
				"}",
1460
				"H.java",
1461
				"import java.lang.annotation.Target;\n" + 
1462
				"import static java.lang.annotation.ElementType.*;\n" + 
1463
				"import java.lang.annotation.Retention;\n" + 
1464
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1465
				"@Target(TYPE_USE)\n" + 
1466
				"@Retention(RUNTIME)\n" + 
1467
				"@interface H {\n" + 
1468
				"	char value() default '-';\n" + 
1469
				"}\n",
1470
		},
1471
		"");
1472
		String expectedOutput =
1473
			"  // Field descriptor #6 [[[Ljava/lang/String;\n" + 
1474
			"  java.lang.String[][][] field;\n" + 
1475
			"    RuntimeVisibleTypeAnnotations: \n" + 
1476
			"      #11 @H(\n" + 
1477
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1478
			"        locations = {2}\n" + 
1479
			"      )\n" + 
1480
			"      #12 @F(\n" + 
1481
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1482
			"        locations = {0}\n" + 
1483
			"      )\n" + 
1484
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1485
			"      #8 @E(\n" + 
1486
			"        target type = 0xe FIELD\n" + 
1487
			"      )\n" + 
1488
			"      #9 @G(\n" + 
1489
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1490
			"        locations = {1}\n" + 
1491
			"      )\n" + 
1492
			"  \n" + 
1493
			"  // Field descriptor #14 Ljava/util/Map;\n" + 
1494
			"  // Signature: Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/Object;>;>;\n" + 
1495
			"  java.util.Map field2;\n" + 
1496
			"    RuntimeVisibleTypeAnnotations: \n" + 
1497
			"      #18 @A(\n" + 
1498
			"        target type = 0xe FIELD\n" + 
1499
			"      )\n" + 
1500
			"      #19 @C(\n" + 
1501
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1502
			"        locations = {1}\n" + 
1503
			"      )\n" + 
1504
			"      #20 @D(\n" + 
1505
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1506
			"        locations = {1,0}\n" + 
1507
			"      )\n" + 
1508
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1509
			"      #17 @B(\n" + 
1510
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1511
			"        locations = {0}\n" + 
1512
			"      )\n" + 
1513
			"  \n" + 
1514
			"  // Field descriptor #14 Ljava/util/Map;\n" + 
1515
			"  // Signature: Ljava/util/Map<Ljava/lang/String;[[[Ljava/lang/String;>;\n" + 
1516
			"  java.util.Map field3;\n" + 
1517
			"    RuntimeVisibleTypeAnnotations: \n" + 
1518
			"      #18 @A(\n" + 
1519
			"        target type = 0xe FIELD\n" + 
1520
			"      )\n" + 
1521
			"      #11 @H(\n" + 
1522
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1523
			"        locations = {1,2}\n" + 
1524
			"      )\n" + 
1525
			"      #12 @F(\n" + 
1526
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1527
			"        locations = {1,0}\n" + 
1528
			"      )\n" + 
1529
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1530
			"      #17 @B(\n" + 
1531
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1532
			"        locations = {0}\n" + 
1533
			"      )\n" + 
1534
			"      #8 @E(\n" + 
1535
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1536
			"        locations = {1}\n" + 
1537
			"      )\n" + 
1538
			"      #9 @G(\n" + 
1539
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1540
			"        locations = {1,1}\n" + 
1541
			"      )\n";
1542
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1543
	}
1544
	// check locations
1545
	public void test027() throws Exception {
1546
		this.runConformTest(
1547
			new String[] {
1548
				"X.java",
1549
				"public class X {\n" + 
1550
				"	@H java.lang.String @E[] @F[] @G[] field;\n" + 
1551
				"}",
1552
				"E.java",
1553
				"import java.lang.annotation.Target;\n" + 
1554
				"import static java.lang.annotation.ElementType.*;\n" + 
1555
				"import java.lang.annotation.Retention;\n" + 
1556
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1557
				"@Target(TYPE_USE)\n" + 
1558
				"@Retention(CLASS)\n" + 
1559
				"@interface E {\n" + 
1560
				"	int value() default -1;\n" + 
1561
				"}",
1562
				"F.java",
1563
				"import java.lang.annotation.Target;\n" + 
1564
				"import static java.lang.annotation.ElementType.*;\n" + 
1565
				"import java.lang.annotation.Retention;\n" + 
1566
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1567
				"@Target(TYPE_USE)\n" + 
1568
				"@Retention(RUNTIME)\n" + 
1569
				"@interface F {\n" + 
1570
				"	char value() default '-';\n" + 
1571
				"}\n",
1572
				"G.java",
1573
				"import java.lang.annotation.Target;\n" + 
1574
				"import static java.lang.annotation.ElementType.*;\n" + 
1575
				"import java.lang.annotation.Retention;\n" + 
1576
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1577
				"@Target(TYPE_USE)\n" + 
1578
				"@Retention(CLASS)\n" + 
1579
				"@interface G {\n" + 
1580
				"	int value() default -1;\n" + 
1581
				"}",
1582
				"H.java",
1583
				"import java.lang.annotation.Target;\n" + 
1584
				"import static java.lang.annotation.ElementType.*;\n" + 
1585
				"import java.lang.annotation.Retention;\n" + 
1586
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1587
				"@Target(TYPE_USE)\n" + 
1588
				"@Retention(RUNTIME)\n" + 
1589
				"@interface H {\n" + 
1590
				"	char value() default '-';\n" + 
1591
				"}\n",
1592
		},
1593
		"");
1594
		String expectedOutput =
1595
			"    RuntimeVisibleTypeAnnotations: \n" + 
1596
			"      #11 @H(\n" + 
1597
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1598
			"        locations = {2}\n" + 
1599
			"      )\n" + 
1600
			"      #12 @F(\n" + 
1601
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1602
			"        locations = {0}\n" + 
1603
			"      )\n" + 
1604
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1605
			"      #8 @E(\n" + 
1606
			"        target type = 0xe FIELD\n" + 
1607
			"      )\n" + 
1608
			"      #9 @G(\n" + 
1609
			"        target type = 0xf FIELD_GENERIC_OR_ARRAY\n" + 
1610
			"        locations = {1}\n" + 
1611
			"      )\n";
1612
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1613
	}
1614
	// cast
1615
	public void test028() throws Exception {
1616
		this.runConformTest(
1617
			new String[] {
1618
				"A.java",
1619
				"import java.lang.annotation.Target;\n" + 
1620
				"import static java.lang.annotation.ElementType.*;\n" + 
1621
				"import java.lang.annotation.Retention;\n" + 
1622
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1623
				"@Target(TYPE_USE)\n" + 
1624
				"@Retention(RUNTIME)\n" + 
1625
				"@interface A {\n" + 
1626
				"	String value() default \"default\";\n" + 
1627
				"}\n",
1628
				"B.java",
1629
				"import java.lang.annotation.Target;\n" + 
1630
				"import static java.lang.annotation.ElementType.*;\n" + 
1631
				"import java.lang.annotation.Retention;\n" + 
1632
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1633
				"@Target(TYPE_USE)\n" + 
1634
				"@Retention(CLASS)\n" + 
1635
				"@interface B {\n" + 
1636
				"	int value() default -1;\n" + 
1637
				"}",
1638
				"C.java",
1639
				"import java.lang.annotation.Target;\n" + 
1640
				"import static java.lang.annotation.ElementType.*;\n" + 
1641
				"import java.lang.annotation.Retention;\n" + 
1642
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1643
				"@Target(TYPE_USE)\n" + 
1644
				"@Retention(RUNTIME)\n" + 
1645
				"@interface C {\n" + 
1646
				"	char value() default '-';\n" + 
1647
				"}\n",
1648
				"I.java",
1649
				"interface I {}\n",
1650
				"J.java",
1651
				"interface J {}\n",
1652
				"X.java",
1653
				"public class X {\n" + 
1654
				"	public void foo(Object o) {\n" + 
1655
				"		if (o instanceof String[][]) {\n" +
1656
				"			String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" +
1657
				"			System.out.println(tab.length);\n" +
1658
				"		}\n" + 
1659
				"		System.out.println(o);\n" +
1660
				"	}\n" + 
1661
				"}",
1662
		},
1663
		"");
1664
		String expectedOutput =
1665
			"    RuntimeVisibleTypeAnnotations: \n" + 
1666
			"      #41 @C(\n" + 
1667
			"        #38 value=\'_\' (constant type)\n" + 
1668
			"        target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + 
1669
			"        offset = 8\n" + 
1670
			"        locations = {1}\n" + 
1671
			"      )\n" + 
1672
			"      #43 @A(\n" + 
1673
			"        target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + 
1674
			"        offset = 8\n" + 
1675
			"        locations = {0}\n" + 
1676
			"      )\n" + 
1677
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1678
			"      #37 @B(\n" + 
1679
			"        #38 value=(int) 3 (constant type)\n" + 
1680
			"        target type = 0x1 TYPE_CAST_GENERIC_OR_ARRAY\n" + 
1681
			"        offset = 8\n" + 
1682
			"        locations = {1}\n" + 
1683
			"      )\n";
1684
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1685
	}
1686
	// qualified allocation expression with type arguments
1687
	public void test029() throws Exception {
1688
		this.runConformTest(
1689
			new String[] {
1690
				"A.java",
1691
				"import java.lang.annotation.Target;\n" + 
1692
				"import static java.lang.annotation.ElementType.*;\n" + 
1693
				"import java.lang.annotation.Retention;\n" + 
1694
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1695
				"@Target(TYPE_USE)\n" + 
1696
				"@Retention(RUNTIME)\n" + 
1697
				"@interface A {\n" + 
1698
				"	String value() default \"default\";\n" + 
1699
				"}\n",
1700
				"B.java",
1701
				"import java.lang.annotation.Target;\n" + 
1702
				"import static java.lang.annotation.ElementType.*;\n" + 
1703
				"import java.lang.annotation.Retention;\n" + 
1704
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1705
				"@Target(TYPE_USE)\n" + 
1706
				"@Retention(CLASS)\n" + 
1707
				"@interface B {\n" + 
1708
				"	int value() default -1;\n" + 
1709
				"}",
1710
				"C.java",
1711
				"import java.lang.annotation.Target;\n" + 
1712
				"import static java.lang.annotation.ElementType.*;\n" + 
1713
				"import java.lang.annotation.Retention;\n" + 
1714
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1715
				"@Target(TYPE_USE)\n" + 
1716
				"@Retention(RUNTIME)\n" + 
1717
				"@interface C {\n" + 
1718
				"	char value() default '-';\n" + 
1719
				"}\n",
1720
				"D.java",
1721
				"import java.lang.annotation.Target;\n" + 
1722
				"import static java.lang.annotation.ElementType.*;\n" + 
1723
				"import java.lang.annotation.Retention;\n" + 
1724
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1725
				"@Target(TYPE_USE)\n" + 
1726
				"@Retention(RUNTIME)\n" + 
1727
				"@interface D {\n" + 
1728
				"	char value() default '-';\n" + 
1729
				"}\n",
1730
				"X.java",
1731
				"public class X {\n" + 
1732
				"	class Y {\n" + 
1733
				"		<T, U> Y(T t, U u) {}\n" + 
1734
				"	}\n" + 
1735
				"	public static void main(String[] args) {\n" + 
1736
				"		Y y = new X().new <@D() @A(value = \"hello\") String, @B X> Y(\"SUCCESS\", null);\n" + 
1737
				"		System.out.println(y);\n" + 
1738
				"	}\n" + 
1739
				"}",
1740
		},
1741
		"");
1742
		String expectedOutput =
1743
			"    RuntimeVisibleTypeAnnotations: \n" + 
1744
			"      #47 @D(\n" + 
1745
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1746
			"        offset = 19\n" + 
1747
			"        type argument index = 0\n" + 
1748
			"      )\n" + 
1749
			"      #48 @A(\n" + 
1750
			"        #49 value=\"hello\" (constant type)\n" + 
1751
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1752
			"        offset = 19\n" + 
1753
			"        type argument index = 0\n" + 
1754
			"      )\n" + 
1755
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1756
			"      #45 @B(\n" + 
1757
			"        target type = 0x18 TYPE_ARGUMENT_CONSTRUCTOR_CALL\n" + 
1758
			"        offset = 19\n" + 
1759
			"        type argument index = 1\n" + 
1760
			"      )\n";
1761
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1762
	}
1763
	// local + wildcard
1764
	// qualified allocation expression with type arguments
1765
	public void test030() throws Exception {
1766
		this.runConformTest(
1767
			new String[] {
1768
				"A.java",
1769
				"import java.lang.annotation.Target;\n" + 
1770
				"import static java.lang.annotation.ElementType.*;\n" + 
1771
				"import java.lang.annotation.Retention;\n" + 
1772
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1773
				"@Target(TYPE_USE)\n" + 
1774
				"@Retention(RUNTIME)\n" + 
1775
				"@interface A {\n" + 
1776
				"	String value() default \"default\";\n" + 
1777
				"}\n",
1778
				"B.java",
1779
				"import java.lang.annotation.Target;\n" + 
1780
				"import static java.lang.annotation.ElementType.*;\n" + 
1781
				"import java.lang.annotation.Retention;\n" + 
1782
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1783
				"@Target(TYPE_USE)\n" + 
1784
				"@Retention(CLASS)\n" + 
1785
				"@interface B {\n" + 
1786
				"	int value() default -1;\n" + 
1787
				"}",
1788
				"C.java",
1789
				"import java.lang.annotation.Target;\n" + 
1790
				"import static java.lang.annotation.ElementType.*;\n" + 
1791
				"import java.lang.annotation.Retention;\n" + 
1792
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1793
				"@Target(TYPE_USE)\n" + 
1794
				"@Retention(RUNTIME)\n" + 
1795
				"@interface C {\n" + 
1796
				"	char value() default '-';\n" + 
1797
				"}\n",
1798
				"D.java",
1799
				"import java.lang.annotation.Target;\n" + 
1800
				"import static java.lang.annotation.ElementType.*;\n" + 
1801
				"import java.lang.annotation.Retention;\n" + 
1802
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1803
				"@Target(TYPE_USE)\n" + 
1804
				"@Retention(RUNTIME)\n" + 
1805
				"@interface D {\n" + 
1806
				"	char value() default '-';\n" + 
1807
				"}\n",
1808
				"X.java",
1809
				"import java.util.Map;\n" +
1810
				"import java.util.HashMap;\n" +
1811
				"@SuppressWarnings({\"unchecked\",\"rawtypes\"})\n" + 
1812
				"public class X {\n" + 
1813
				"	Object newMap(Object o) {\n" + 
1814
				"		Map<@A Object, ? super @C Map<@B String, @D Comparable>> map;\n" + 
1815
				"		if (o == null) {\n" + 
1816
				"			map = null;\n" + 
1817
				"			System.out.println(map);\n" + 
1818
				"		} else {\n" + 
1819
				"			System.out.println(\"No map yet\");\n" + 
1820
				"		}\n" + 
1821
				"		map = new HashMap();\n" + 
1822
				"		return map;\n" + 
1823
				"	} \n" + 
1824
				"}",
1825
		},
1826
		"");
1827
		String expectedOutput =
1828
			"    RuntimeVisibleTypeAnnotations: \n" + 
1829
			"      #46 @A(\n" + 
1830
			"        target type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1831
			"        local variable entries:\n" + 
1832
			"          [pc: 6, pc: 16] index: 2\n" + 
1833
			"          [pc: 32, pc: 34] index: 2\n" + 
1834
			"        locations = {0}\n" + 
1835
			"      )\n" + 
1836
			"      #47 @C(\n" + 
1837
			"        target type = 0x1c WILDCARD_BOUND\n" + 
1838
			"        wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1839
			"          local variable entries:\n" + 
1840
			"                [pc: 6, pc: 16] index: 2\n" + 
1841
			"                [pc: 32, pc: 34] index: 2\n" + 
1842
			"              wildcard locations = {1}\n" + 
1843
			"      )\n" + 
1844
			"      #48 @D(\n" + 
1845
			"        target type = 0x1d WILDCARD_BOUND_GENERIC_OR_ARRAY\n" + 
1846
			"        wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1847
			"          local variable entries:\n" + 
1848
			"                [pc: 6, pc: 16] index: 2\n" + 
1849
			"                [pc: 32, pc: 34] index: 2\n" + 
1850
			"              wildcard locations = {1}\n" + 
1851
			"        locations = {1}\n" + 
1852
			"      )\n" + 
1853
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1854
			"      #44 @B(\n" + 
1855
			"        target type = 0x1d WILDCARD_BOUND_GENERIC_OR_ARRAY\n" + 
1856
			"        wildcard location type = 0x9 LOCAL_VARIABLE_GENERIC_OR_ARRAY\n" + 
1857
			"          local variable entries:\n" + 
1858
			"                [pc: 6, pc: 16] index: 2\n" + 
1859
			"                [pc: 32, pc: 34] index: 2\n" + 
1860
			"              wildcard locations = {1}\n" + 
1861
			"        locations = {0}\n" + 
1862
			"      )\n";
1863
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1864
	}
1865
	// method type parameter bound generic or array
1866
	public void test031() throws Exception {
1867
		this.runConformTest(
1868
			new String[] {
1869
				"A.java",
1870
				"import java.lang.annotation.Target;\n" + 
1871
				"import static java.lang.annotation.ElementType.*;\n" + 
1872
				"import java.lang.annotation.Retention;\n" + 
1873
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1874
				"@Target(TYPE_USE)\n" + 
1875
				"@Retention(RUNTIME)\n" + 
1876
				"@interface A {\n" + 
1877
				"	String value() default \"default\";\n" + 
1878
				"}\n",
1879
				"B.java",
1880
				"import java.lang.annotation.Target;\n" + 
1881
				"import static java.lang.annotation.ElementType.*;\n" + 
1882
				"import java.lang.annotation.Retention;\n" + 
1883
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1884
				"@Target(TYPE_USE)\n" + 
1885
				"@Retention(CLASS)\n" + 
1886
				"@interface B {\n" + 
1887
				"	int value() default -1;\n" + 
1888
				"}",
1889
				"C.java",
1890
				"import java.lang.annotation.Target;\n" + 
1891
				"import static java.lang.annotation.ElementType.*;\n" + 
1892
				"import java.lang.annotation.Retention;\n" + 
1893
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1894
				"@Target(TYPE_USE)\n" + 
1895
				"@Retention(CLASS)\n" + 
1896
				"@interface C {\n" + 
1897
				"	int value() default -1;\n" + 
1898
				"}",
1899
				"D.java",
1900
				"import java.lang.annotation.Target;\n" + 
1901
				"import static java.lang.annotation.ElementType.*;\n" + 
1902
				"import java.lang.annotation.Retention;\n" + 
1903
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1904
				"@Target(TYPE_PARAMETER)\n" + 
1905
				"@Retention(RUNTIME)\n" + 
1906
				"@interface D {\n" + 
1907
				"	String value() default \"default\";\n" + 
1908
				"}\n",
1909
				"Z.java",
1910
				"public class Z<T> {}",
1911
				"X.java",
1912
				"public class X {\n" +
1913
				"	<@D U, T extends Z<@A String @C[][]@B[]> & @B(3) Cloneable> void foo(U u, T t) {}\n" +
1914
				"}",
1915
		},
1916
		"");
1917
		String expectedOutput =
1918
			"    RuntimeVisibleTypeAnnotations: \n" + 
1919
			"      #31 @D(\n" + 
1920
			"        target type = 0x20 METHOD_TYPE_PARAMETER\n" + 
1921
			"        type parameter index = 0\n" + 
1922
			"      )\n" + 
1923
			"      #32 @A(\n" + 
1924
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1925
			"        type parameter index = 1 type parameter bound index = 0\n" + 
1926
			"        locations = {0,2}\n" + 
1927
			"      )\n" + 
1928
			"    RuntimeInvisibleTypeAnnotations: \n" + 
1929
			"      #26 @C(\n" + 
1930
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1931
			"        type parameter index = 1 type parameter bound index = 0\n" + 
1932
			"        locations = {0}\n" + 
1933
			"      )\n" + 
1934
			"      #27 @B(\n" + 
1935
			"        target type = 0x13 METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY\n" + 
1936
			"        type parameter index = 1 type parameter bound index = 0\n" + 
1937
			"        locations = {0,1}\n" + 
1938
			"      )\n" + 
1939
			"      #27 @B(\n" + 
1940
			"        #28 value=(int) 3 (constant type)\n" + 
1941
			"        target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + 
1942
			"        type parameter index = 1 type parameter bound index = 1\n" + 
1943
			"      )\n";
1944
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
1945
	}
1946
	// type argument method call and generic or array
1947
	public void test032() throws Exception {
1948
		this.runConformTest(
1949
			new String[] {
1950
				"X.java",
1951
				"public class X {\n" +
1952
				"\n" +
1953
				"	static <T, U> T foo(T t, U u) {\n" +
1954
				"		return t;\n" +
1955
				"	}\n" +
1956
				"	public static void bar() {\n" +
1957
				"		System.out.println(X.<@A String[] @B(1) [], @C('-') X>foo(new String[][]{{\"SUCCESS\"}}, null)[0]);\n" +
1958
				"	}\n" +
1959
				"}\n",
1960
				"A.java",
1961
				"import java.lang.annotation.Target;\n" + 
1962
				"import static java.lang.annotation.ElementType.*;\n" + 
1963
				"import java.lang.annotation.Retention;\n" + 
1964
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1965
				"@Target(TYPE_USE)\n" + 
1966
				"@Retention(RUNTIME)\n" + 
1967
				"@interface A {\n" + 
1968
				"	String value() default \"default\";\n" + 
1969
				"}\n",
1970
				"B.java",
1971
				"import java.lang.annotation.Target;\n" + 
1972
				"import static java.lang.annotation.ElementType.*;\n" + 
1973
				"import java.lang.annotation.Retention;\n" + 
1974
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1975
				"@Target(TYPE_USE)\n" + 
1976
				"@Retention(CLASS)\n" + 
1977
				"@interface B {\n" + 
1978
				"	int value() default -1;\n" + 
1979
				"}",
1980
				"C.java",
1981
				"import java.lang.annotation.Target;\n" + 
1982
				"import static java.lang.annotation.ElementType.*;\n" + 
1983
				"import java.lang.annotation.Retention;\n" + 
1984
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
1985
				"@Target(TYPE_USE)\n" + 
1986
				"@Retention(RUNTIME)\n" + 
1987
				"@interface C {\n" + 
1988
				"	char value() default '-';\n" + 
1989
				"}\n",
1990
		},
1991
		"");
1992
		String expectedOutput =
1993
			"    RuntimeVisibleTypeAnnotations: \n" + 
1994
			"      #52 @A(\n" + 
1995
			"        target type = 0x1b TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY\n" + 
1996
			"        offset = 20\n" + 
1997
			"        type argument index = 0\n" + 
1998
			"        locations = {1}\n" + 
1999
			"      )\n" + 
2000
			"      #53 @C(\n" + 
2001
			"        #49 value=\'-\' (constant type)\n" + 
2002
			"        target type = 0x1a TYPE_ARGUMENT_METHOD_CALL\n" + 
2003
			"        offset = 20\n" + 
2004
			"        type argument index = 1\n" + 
2005
			"      )\n" + 
2006
			"    RuntimeInvisibleTypeAnnotations: \n" + 
2007
			"      #48 @B(\n" + 
2008
			"        #49 value=(int) 1 (constant type)\n" + 
2009
			"        target type = 0x1b TYPE_ARGUMENT_METHOD_CALL_GENERIC_OR_ARRAY\n" + 
2010
			"        offset = 20\n" + 
2011
			"        type argument index = 0\n" + 
2012
			"        locations = {0}\n" + 
2013
			"      )\n";
2014
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2015
	}
2016
	// superclass
2017
	public void test033() throws Exception {
2018
		this.runConformTest(
2019
			new String[] {
2020
				"Marker.java",
2021
				"@interface Marker {}",
2022
				"X.java",
2023
				"public class X extends @Marker Object {}",
2024
			},
2025
			"");
2026
	}
2027
	// superclass
2028
	public void test034() throws Exception {
2029
		this.runNegativeTest(
2030
			new String[] {
2031
				"Marker.java",
2032
				"import java.lang.annotation.Target;\n" + 
2033
				"import static java.lang.annotation.ElementType.*;\n" + 
2034
				"@Target(TYPE_PARAMETER)\n" + 
2035
				"@interface Marker {}",
2036
				"X.java",
2037
				"public class X extends @Marker Object {}",
2038
			},
2039
			"----------\n" + 
2040
			"1. ERROR in X.java (at line 1)\n" + 
2041
			"	public class X extends @Marker Object {}\n" + 
2042
			"	                       ^^^^^^^\n" + 
2043
			"The annotation @Marker is disallowed for this location\n" + 
2044
			"----------\n");
2045
	}
2046
	// annotation on catch variable
2047
	public void test035() throws Exception {
2048
		this.runConformTest(
2049
			new String[] {
2050
				"X.java",
2051
				"import java.lang.annotation.Target;\n" + 
2052
				"import java.lang.annotation.Retention;\n" + 
2053
				"import static java.lang.annotation.ElementType.*;\n" + 
2054
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2055
				"public class X {\n" + 
2056
				"	public static void main(String[] args) {\n" + 
2057
				"		@A Exception test = new Exception() {\n" +
2058
				"			private static final long serialVersionUID = 1L;\n" +
2059
				"			@Override\n" +
2060
				"			public String toString() {\n" +
2061
				"				return \"SUCCESS\";\n" +
2062
				"			}\n" +
2063
				"		};\n" + 
2064
				"		try {\n" + 
2065
				"			System.out.println(test);\n" + 
2066
				"		} catch(@A Exception e) {\n" + 
2067
				"			e.printStackTrace();\n" + 
2068
				"		}\n" + 
2069
				"	}\n" + 
2070
				"}",
2071
				"A.java",
2072
				"import java.lang.annotation.Target;\n" + 
2073
				"import static java.lang.annotation.ElementType.*;\n" + 
2074
				"import java.lang.annotation.Retention;\n" + 
2075
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2076
				"@Target(TYPE_USE)\n" + 
2077
				"@Retention(RUNTIME)\n" + 
2078
				"@interface A {\n" + 
2079
				"	String value() default \"default\";\n" + 
2080
				"}\n",
2081
		},
2082
		"SUCCESS");
2083
		String expectedOutput =
2084
			"    RuntimeVisibleTypeAnnotations: \n" + 
2085
			"      #44 @A(\n" + 
2086
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2087
			"        local variable entries:\n" + 
2088
			"          [pc: 8, pc: 24] index: 1\n" + 
2089
			"      )\n" + 
2090
			"      #44 @A(\n" + 
2091
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2092
			"        local variable entries:\n" + 
2093
			"          [pc: 19, pc: 23] index: 2\n" + 
2094
			"      )\n";
2095
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2096
	}
2097
	// annotation on catch variable
2098
	public void test036() throws Exception {
2099
		this.runConformTest(
2100
			new String[] {
2101
				"X.java",
2102
				"import java.lang.annotation.Target;\n" + 
2103
				"import java.lang.annotation.Retention;\n" + 
2104
				"import static java.lang.annotation.ElementType.*;\n" + 
2105
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2106
				"public class X {\n" + 
2107
				"	public static void main(String[] args) {\n" + 
2108
				"		@B int j = 9;\n" + 
2109
				"		try {\n" + 
2110
				"			System.out.print(\"SUCCESS\" + j);\n" + 
2111
				"		} catch(@A Exception e) {\n" + 
2112
				"		}\n" + 
2113
				"		@B int k = 3;\n" + 
2114
				"		System.out.println(k);\n" + 
2115
				"	}\n" + 
2116
				"}",
2117
				"A.java",
2118
				"import java.lang.annotation.Target;\n" + 
2119
				"import static java.lang.annotation.ElementType.*;\n" + 
2120
				"import java.lang.annotation.Retention;\n" + 
2121
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2122
				"@Target(TYPE_USE)\n" + 
2123
				"@Retention(RUNTIME)\n" + 
2124
				"@interface A {\n" + 
2125
				"	String value() default \"default\";\n" + 
2126
				"}\n",
2127
				"B.java",
2128
				"import java.lang.annotation.Target;\n" + 
2129
				"import static java.lang.annotation.ElementType.*;\n" + 
2130
				"import java.lang.annotation.Retention;\n" + 
2131
				"import static java.lang.annotation.RetentionPolicy.*;\n" + 
2132
				"@Target(TYPE_USE)\n" + 
2133
				"@Retention(CLASS)\n" + 
2134
				"@interface B {\n" + 
2135
				"	String value() default \"default\";\n" + 
2136
				"}\n",
2137
		},
2138
		"SUCCESS93");
2139
		String expectedOutput =
2140
			"    RuntimeInvisibleTypeAnnotations: \n" + 
2141
			"      #56 @B(\n" + 
2142
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2143
			"        local variable entries:\n" + 
2144
			"          [pc: 3, pc: 39] index: 1\n" + 
2145
			"      )\n" + 
2146
			"      #56 @B(\n" + 
2147
			"        target type = 0x8 LOCAL_VARIABLE\n" + 
2148
			"        local variable entries:\n" + 
2149
			"          [pc: 31, pc: 39] index: 2\n" + 
2150
			"      )\n";
2151
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2152
	}
2153
	// make sure annotation without target appears twice when set on a method declaration
2154
	public void test037() throws Exception {
2155
		this.runConformTest(
2156
			new String[] {
2157
				"X.java",
2158
				"import java.lang.annotation.Target;\r\n" + 
2159
				"import static java.lang.annotation.ElementType.*;\r\n" + 
2160
				"\r\n" + 
2161
				"@Target(METHOD)\r\n" + 
2162
				"@interface Annot {\r\n" + 
2163
				"	int value() default 0;\r\n" + 
2164
				"}\r\n" + 
2165
				"public class X {\r\n" + 
2166
				"	@Annot(4)\r\n" + 
2167
				"	public void foo() {\r\n" + 
2168
				"	}\r\n" + 
2169
				"}",
2170
		},
2171
		"");
2172
		String expectedOutput =
2173
			"  public void foo();\n" + 
2174
			"    0  return\n" + 
2175
			"      Line numbers:\n" + 
2176
			"        [pc: 0, line: 11]\n" + 
2177
			"      Local variable table:\n" + 
2178
			"        [pc: 0, pc: 1] local: this index: 0 type: X\n" + 
2179
			"    RuntimeInvisibleAnnotations: \n" + 
2180
			"      #16 @Annot(\n" + 
2181
			"        #17 value=(int) 4 (constant type)\n" + 
2182
			"      )\n" + 
2183
			"}";
2184
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2185
	}
2186
	// make sure annotation without target appears twice when set on a method declaration
2187
	public void test038() throws Exception {
2188
		this.runConformTest(
2189
			new String[] {
2190
				"X.java",
2191
				"@interface Annot {\r\n" + 
2192
				"	int value() default 0;\r\n" + 
2193
				"}\r\n" + 
2194
				"public class X {\r\n" + 
2195
				"	@Annot(4)\r\n" + 
2196
				"	public void foo() {\r\n" + 
2197
				"	}\r\n" + 
2198
				"}",
2199
		},
2200
		"");
2201
		String expectedOutput =
2202
			"  // Method descriptor #6 ()V\n" + 
2203
			"  // Stack: 0, Locals: 1\n" + 
2204
			"  public void foo();\n" + 
2205
			"    0  return\n" + 
2206
			"      Line numbers:\n" + 
2207
			"        [pc: 0, line: 7]\n" + 
2208
			"      Local variable table:\n" + 
2209
			"        [pc: 0, pc: 1] local: this index: 0 type: X\n" + 
2210
			"    RuntimeInvisibleAnnotations: \n" + 
2211
			"      #16 @Annot(\n" + 
2212
			"        #17 value=(int) 4 (constant type)\n" + 
2213
			"      )\n" + 
2214
			"}";
2215
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2216
	}
2217
	// make sure annotation without target appears twice when set on a method declaration
2218
	public void test039() throws Exception {
2219
		this.runConformTest(
2220
			new String[] {
2221
				"X.java",
2222
				"@interface Annot {\r\n" + 
2223
				"	int value() default 0;\r\n" + 
2224
				"}\r\n" + 
2225
				"public class X {\r\n" + 
2226
				"	@Annot(4)\r\n" + 
2227
				"	public int foo() {\r\n" + 
2228
				"		return 0;\r\n" + 
2229
				"	}\r\n" + 
2230
				"}",
2231
		},
2232
		"");
2233
		String expectedOutput =
2234
			"  public int foo();\n" + 
2235
			"    0  iconst_0\n" + 
2236
			"    1  ireturn\n" + 
2237
			"      Line numbers:\n" + 
2238
			"        [pc: 0, line: 7]\n" + 
2239
			"      Local variable table:\n" + 
2240
			"        [pc: 0, pc: 2] local: this index: 0 type: X\n" + 
2241
			"    RuntimeInvisibleAnnotations: \n" + 
2242
			"      #17 @Annot(\n" + 
2243
			"        #18 value=(int) 4 (constant type)\n" + 
2244
			"      )\n" + 
2245
			"    RuntimeInvisibleTypeAnnotations: \n" + 
2246
			"      #17 @Annot(\n" + 
2247
			"        #18 value=(int) 4 (constant type)\n" + 
2248
			"        target type = 0xa METHOD_RETURN_TYPE\n" + 
2249
			"      )\n" + 
2250
			"}";
2251
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2252
	}
2253
	// make sure annotation without target appears twice when set on a method declaration
2254
	public void test040() throws Exception {
2255
		this.runConformTest(
2256
			new String[] {
2257
				"X.java",
2258
				"import java.lang.annotation.Target;\r\n" + 
2259
				"import static java.lang.annotation.ElementType.*;\r\n" + 
2260
				"\r\n" + 
2261
				"@Target(METHOD)\r\n" + 
2262
				"@interface Annot {\r\n" + 
2263
				"	int value() default 0;\r\n" + 
2264
				"}\r\n" + 
2265
				"public class X {\r\n" + 
2266
				"	@Annot(4)\r\n" + 
2267
				"	public int foo() {\r\n" + 
2268
				"		return 0;\r\n" + 
2269
				"	}\r\n" + 
2270
				"}",
2271
		},
2272
		"");
2273
		String expectedOutput =
2274
			"  public int foo();\n" + 
2275
			"    0  iconst_0\n" + 
2276
			"    1  ireturn\n" + 
2277
			"      Line numbers:\n" + 
2278
			"        [pc: 0, line: 11]\n" + 
2279
			"      Local variable table:\n" + 
2280
			"        [pc: 0, pc: 2] local: this index: 0 type: X\n" + 
2281
			"    RuntimeInvisibleAnnotations: \n" + 
2282
			"      #17 @Annot(\n" + 
2283
			"        #18 value=(int) 4 (constant type)\n" + 
2284
			"      )\n" + 
2285
			"}";
2286
		checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
2287
	}
2288
}

Return to bug 287648