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 105-119
Link Here
|
105 |
} |
105 |
} |
106 |
} |
106 |
} |
107 |
} |
107 |
} |
108 |
boolean hasGenericError = false; |
|
|
109 |
ReferenceBinding currentType; |
110 |
this.bits |= ASTNode.DidResolve; |
108 |
this.bits |= ASTNode.DidResolve; |
|
|
109 |
TypeBinding type = internalResolveLeafType(scope, enclosingType, checkBounds); |
110 |
// handle three different outcomes: |
111 |
if (type == null) { |
112 |
this.resolvedType = createArrayType(scope, this.resolvedType); |
113 |
return null; // no useful type, but still captured dimensions into this.resolvedType |
114 |
} else { |
115 |
type = createArrayType(scope, type); |
116 |
if (!this.resolvedType.isValidBinding()) |
117 |
return type; // found some error, but could recover useful type (like closestMatch) |
118 |
else |
119 |
return this.resolvedType = type; // no complaint, keep fully resolved type (incl. dimensions) |
120 |
} |
121 |
} |
122 |
private TypeBinding internalResolveLeafType(Scope scope, ReferenceBinding enclosingType, boolean checkBounds) { |
123 |
ReferenceBinding currentType; |
111 |
if (enclosingType == null) { |
124 |
if (enclosingType == null) { |
112 |
this.resolvedType = scope.getType(this.token); |
125 |
this.resolvedType = scope.getType(this.token); |
113 |
if (this.resolvedType.isValidBinding()) { |
126 |
if (this.resolvedType.isValidBinding()) { |
114 |
currentType = (ReferenceBinding) this.resolvedType; |
127 |
currentType = (ReferenceBinding) this.resolvedType; |
115 |
} else { |
128 |
} else { |
116 |
hasGenericError = true; |
129 |
|
117 |
reportInvalidType(scope); |
130 |
reportInvalidType(scope); |
118 |
switch (this.resolvedType.problemId()) { |
131 |
switch (this.resolvedType.problemId()) { |
119 |
case ProblemReasons.NotFound : |
132 |
case ProblemReasons.NotFound : |
Lines 150-156
Link Here
|
150 |
} else { // resolving member type (relatively to enclosingType) |
163 |
} else { // resolving member type (relatively to enclosingType) |
151 |
this.resolvedType = currentType = scope.getMemberType(this.token, enclosingType); |
164 |
this.resolvedType = currentType = scope.getMemberType(this.token, enclosingType); |
152 |
if (!this.resolvedType.isValidBinding()) { |
165 |
if (!this.resolvedType.isValidBinding()) { |
153 |
hasGenericError = true; |
|
|
154 |
scope.problemReporter().invalidEnclosingType(this, currentType, enclosingType); |
166 |
scope.problemReporter().invalidEnclosingType(this, currentType, enclosingType); |
155 |
return null; |
167 |
return null; |
156 |
} |
168 |
} |
Lines 205-220
Link Here
|
205 |
} |
217 |
} |
206 |
// resilience do not rebuild a parameterized type unless compliance is allowing it |
218 |
// resilience do not rebuild a parameterized type unless compliance is allowing it |
207 |
if (!isCompliant15) { |
219 |
if (!isCompliant15) { |
208 |
// array type ? |
220 |
if (!this.resolvedType.isValidBinding()) |
209 |
TypeBinding type = currentType; |
221 |
return currentType; |
210 |
if (this.dimensions > 0) { |
222 |
return this.resolvedType = currentType; |
211 |
if (this.dimensions > 255) |
|
|
212 |
scope.problemReporter().tooManyDimensions(this); |
213 |
type = scope.createArrayType(type, this.dimensions); |
214 |
} |
215 |
if (hasGenericError) |
216 |
return type; |
217 |
return this.resolvedType = type; |
218 |
} |
223 |
} |
219 |
// if missing generic type, and compliance >= 1.5, then will rebuild a parameterized binding |
224 |
// if missing generic type, and compliance >= 1.5, then will rebuild a parameterized binding |
220 |
} else if (argLength != typeVariables.length) { // check arity |
225 |
} else if (argLength != typeVariables.length) { // check arity |
Lines 238-254
Link Here
|
238 |
if (isTypeUseDeprecated(parameterizedType, scope)) |
243 |
if (isTypeUseDeprecated(parameterizedType, scope)) |
239 |
reportDeprecatedType(parameterizedType, scope); |
244 |
reportDeprecatedType(parameterizedType, scope); |
240 |
|
245 |
|
241 |
TypeBinding type = parameterizedType; |
246 |
if (!this.resolvedType.isValidBinding()) { |
242 |
// array type ? |
247 |
return parameterizedType; |
|
|
248 |
} |
249 |
return this.resolvedType = parameterizedType; |
250 |
} |
251 |
public TypeBinding createArrayType(Scope scope, TypeBinding type) { |
243 |
if (this.dimensions > 0) { |
252 |
if (this.dimensions > 0) { |
244 |
if (this.dimensions > 255) |
253 |
if (this.dimensions > 255) |
245 |
scope.problemReporter().tooManyDimensions(this); |
254 |
scope.problemReporter().tooManyDimensions(this); |
246 |
type = scope.createArrayType(type, this.dimensions); |
255 |
return scope.createArrayType(type, this.dimensions); |
247 |
} |
|
|
248 |
if (hasGenericError) { |
249 |
return type; |
250 |
} |
256 |
} |
251 |
return this.resolvedType = type; |
257 |
return type; |
252 |
} |
258 |
} |
253 |
|
259 |
|
254 |
public StringBuffer printExpression(int indent, StringBuffer output){ |
260 |
public StringBuffer printExpression(int indent, StringBuffer output){ |