|
Lines 302-307
Link Here
|
| 302 |
} |
302 |
} |
| 303 |
|
303 |
|
| 304 |
// resolve type arguments (for generic constructor call) |
304 |
// resolve type arguments (for generic constructor call) |
|
|
305 |
boolean isDiamond = this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0; |
| 305 |
if (this.typeArguments != null) { |
306 |
if (this.typeArguments != null) { |
| 306 |
int length = this.typeArguments.length; |
307 |
int length = this.typeArguments.length; |
| 307 |
boolean argHasError = scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5; |
308 |
boolean argHasError = scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5; |
|
Lines 315-321
Link Here
|
| 315 |
scope.problemReporter().illegalUsageOfWildcard(typeReference); |
316 |
scope.problemReporter().illegalUsageOfWildcard(typeReference); |
| 316 |
} |
317 |
} |
| 317 |
} |
318 |
} |
| 318 |
if (this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0) { |
319 |
if (isDiamond) { |
| 319 |
scope.problemReporter().diamondNotWithExplicitTypeArguments(this.typeArguments); |
320 |
scope.problemReporter().diamondNotWithExplicitTypeArguments(this.typeArguments); |
| 320 |
return null; |
321 |
return null; |
| 321 |
} |
322 |
} |
|
Lines 390-401
Link Here
|
| 390 |
scope.problemReporter().cannotInstantiate(this.type, receiverType); |
391 |
scope.problemReporter().cannotInstantiate(this.type, receiverType); |
| 391 |
return this.resolvedType = receiverType; |
392 |
return this.resolvedType = receiverType; |
| 392 |
} |
393 |
} |
| 393 |
if (this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0) { |
394 |
// if (isDiamond) { |
| 394 |
TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) receiverType).genericType(), argumentTypes, scope); |
395 |
// TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) receiverType).genericType(), argumentTypes, scope); |
| 395 |
receiverType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) receiverType).genericType(), inferredTypes, ((ParameterizedTypeBinding) receiverType).enclosingType()); |
396 |
// receiverType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) receiverType).genericType(), inferredTypes, ((ParameterizedTypeBinding) receiverType).enclosingType()); |
| 396 |
} |
397 |
// } |
| 397 |
ReferenceBinding allocationType = (ReferenceBinding) receiverType; |
398 |
ReferenceBinding allocationType = (ReferenceBinding) receiverType; |
|
|
399 |
if (isDiamond) { |
| 400 |
this.binding = scope.getConstructor(((ParameterizedTypeBinding)allocationType).genericType(), argumentTypes, this); |
| 401 |
} else { |
| 402 |
this.binding = scope.getConstructor(allocationType, argumentTypes, this); |
| 403 |
} |
| 398 |
if ((this.binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) { |
404 |
if ((this.binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) { |
|
|
405 |
if (isDiamond) { |
| 406 |
TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) receiverType).genericType(), argumentTypes, scope); |
| 407 |
receiverType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) receiverType).genericType(), inferredTypes, ((ParameterizedTypeBinding) receiverType).enclosingType()); |
| 408 |
allocationType = (ReferenceBinding) receiverType; |
| 409 |
} |
| 399 |
if (isMethodUseDeprecated(this.binding, scope, true)) { |
410 |
if (isMethodUseDeprecated(this.binding, scope, true)) { |
| 400 |
scope.problemReporter().deprecatedMethod(this.binding, this); |
411 |
scope.problemReporter().deprecatedMethod(this.binding, this); |
| 401 |
} |
412 |
} |
|
Lines 430-436
Link Here
|
| 430 |
scope.problemReporter().typeMismatchError(enclosingInstanceType, expectedType, this.enclosingInstance, null); |
441 |
scope.problemReporter().typeMismatchError(enclosingInstanceType, expectedType, this.enclosingInstance, null); |
| 431 |
return this.resolvedType = receiverType; |
442 |
return this.resolvedType = receiverType; |
| 432 |
} else { |
443 |
} else { |
| 433 |
if (this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0) { |
444 |
if (isDiamond) { |
| 434 |
scope.problemReporter().diamondNotWithAnoymousClasses(this.type); |
445 |
scope.problemReporter().diamondNotWithAnoymousClasses(this.type); |
| 435 |
return null; |
446 |
return null; |
| 436 |
} |
447 |
} |