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 345559 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-8 / +5 lines)
Lines 17-23 Link Here
17
 *******************************************************************************/
17
 *******************************************************************************/
18
package org.eclipse.jdt.internal.compiler.ast;
18
package org.eclipse.jdt.internal.compiler.ast;
19
19
20
import org.eclipse.jdt.core.compiler.CharOperation;
21
import org.eclipse.jdt.internal.compiler.ASTVisitor;
20
import org.eclipse.jdt.internal.compiler.ASTVisitor;
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23
import org.eclipse.jdt.internal.compiler.codegen.*;
22
import org.eclipse.jdt.internal.compiler.codegen.*;
Lines 375-380 Link Here
375
	}
374
	}
376
	if (isDiamond) {
375
	if (isDiamond) {
377
		TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) this.resolvedType).genericType(), argumentTypes, scope);
376
		TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) this.resolvedType).genericType(), argumentTypes, scope);
377
		if (inferredTypes == null) {
378
			scope.problemReporter().cannotInferElidedTypes(this);
379
			return this.resolvedType = null;
380
		}
378
		this.resolvedType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) this.resolvedType).genericType(), inferredTypes, ((ParameterizedTypeBinding) this.resolvedType).enclosingType());
381
		this.resolvedType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) this.resolvedType).genericType(), inferredTypes, ((ParameterizedTypeBinding) this.resolvedType).enclosingType());
379
 	}
382
 	}
380
	ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType;
383
	ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType;
Lines 412-424 Link Here
412
	if (factory instanceof ParameterizedGenericMethodBinding && factory.isValidBinding()) {
415
	if (factory instanceof ParameterizedGenericMethodBinding && factory.isValidBinding()) {
413
		return ((ParameterizedTypeBinding)factory.returnType).arguments;
416
		return ((ParameterizedTypeBinding)factory.returnType).arguments;
414
	}
417
	}
415
	scope.problemReporter().cannotInferElidedTypes(this);
418
	return null;
416
	int arity = allocationType.typeVariables().length;
417
	TypeBinding [] inferredTypes = new TypeBinding[arity];
418
	for (int i = 0; i < arity; i++) {
419
		inferredTypes[i] = new ProblemReferenceBinding(CharOperation.NO_CHAR_CHAR, null, ProblemReasons.InferenceFailed);
420
	}
421
	return inferredTypes;
422
}
419
}
423
420
424
public void setActualReceiverType(ReferenceBinding receiverType) {
421
public void setActualReceiverType(ReferenceBinding receiverType) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (+4 lines)
Lines 400-405 Link Here
400
			}
400
			}
401
			if (isDiamond) {
401
			if (isDiamond) {
402
				TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) receiverType).genericType(), argumentTypes, scope);
402
				TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) receiverType).genericType(), argumentTypes, scope);
403
				if (inferredTypes == null) {
404
					scope.problemReporter().cannotInferElidedTypes(this);
405
					return this.resolvedType = null;
406
				}
403
				receiverType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) receiverType).genericType(), inferredTypes, ((ParameterizedTypeBinding) receiverType).enclosingType());
407
				receiverType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) receiverType).genericType(), inferredTypes, ((ParameterizedTypeBinding) receiverType).enclosingType());
404
			}
408
			}
405
			ReferenceBinding allocationType = (ReferenceBinding) receiverType;
409
			ReferenceBinding allocationType = (ReferenceBinding) receiverType;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java (-1 lines)
Lines 31-35 Link Here
31
	final int TypeArgumentsForRawGenericMethod = 13; // for generic method
31
	final int TypeArgumentsForRawGenericMethod = 13; // for generic method
32
	final int InvalidTypeForStaticImport = 14;
32
	final int InvalidTypeForStaticImport = 14;
33
	final int InvalidTypeForAutoManagedResource = 15;
33
	final int InvalidTypeForAutoManagedResource = 15;
34
	final int InferenceFailed = 16;
35
}
34
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-1 / +7 lines)
Lines 4036-4042 Link Here
4036
		int sfi = 0;
4036
		int sfi = 0;
4037
		for (int i = 0, length = methods.length; i < length; i++) {
4037
		for (int i = 0, length = methods.length; i < length; i++) {
4038
			MethodBinding method = methods[i];
4038
			MethodBinding method = methods[i];
4039
			
4039
			int paramLength = method.parameters.length;
4040
			boolean isVarArgs = method.isVarargs();
4041
			if (argumentTypes.length != paramLength)
4042
				if (!isVarArgs || argumentTypes.length < paramLength - 1)
4043
					continue; // incompatible
4040
			TypeVariableBinding[] methodTypeVariables = method.typeVariables();
4044
			TypeVariableBinding[] methodTypeVariables = method.typeVariables();
4041
			int methodTypeVariablesArity = methodTypeVariables.length;
4045
			int methodTypeVariablesArity = methodTypeVariables.length;
4042
	        
4046
	        
Lines 4114-4119 Link Here
4114
			staticFactories[sfi++] = new ParameterizedMethodBinding((ParameterizedTypeBinding) environment.convertToParameterizedType(staticFactory.declaringClass),
4118
			staticFactories[sfi++] = new ParameterizedMethodBinding((ParameterizedTypeBinding) environment.convertToParameterizedType(staticFactory.declaringClass),
4115
																												staticFactory);
4119
																												staticFactory);
4116
		}
4120
		}
4121
		if (sfi == 0)
4122
			return null;
4117
		if (sfi != methods.length) {
4123
		if (sfi != methods.length) {
4118
			System.arraycopy(staticFactories, 0, staticFactories = new MethodBinding[sfi], 0, sfi);
4124
			System.arraycopy(staticFactories, 0, staticFactories = new MethodBinding[sfi], 0, sfi);
4119
		}
4125
		}

Return to bug 345559