View | Details | Raw Unified | Return to bug 91728 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (-16 / +9 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
13
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
14
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
14
15
15
class MethodVerifier15 extends MethodVerifier {
16
class MethodVerifier15 extends MethodVerifier {
Lines 317-338 Link Here
317
	if (inheritedTypeVariables == NoTypeVariables) return inheritedMethod;
318
	if (inheritedTypeVariables == NoTypeVariables) return inheritedMethod;
318
	TypeVariableBinding[] typeVariables = currentMethod == null ? NoTypeVariables : currentMethod.typeVariables;
319
	TypeVariableBinding[] typeVariables = currentMethod == null ? NoTypeVariables : currentMethod.typeVariables;
319
320
320
	int inheritedLength = inheritedTypeVariables.length;
321
	if (inheritedMethod.parameters.length != currentMethod.parameters.length) return inheritedMethod;
321
	int length = typeVariables.length;
322
	
322
	TypeBinding[] arguments = new TypeBinding[inheritedLength];
323
	MessageSend invocationSite = new MessageSend();
323
	if (inheritedLength <= length) {
324
	if (currentMethod.returnType instanceof ReferenceBinding) {
324
		System.arraycopy(typeVariables, 0, arguments, 0, inheritedLength);
325
		invocationSite.expectedType = ((ReferenceBinding)currentMethod.returnType).findSuperTypeWithSameErasure(inheritedMethod.returnType);
325
	} else {
326
	}
326
		System.arraycopy(typeVariables, 0, arguments, 0, length);
327
	MethodBinding substitute = ParameterizedGenericMethodBinding.computeCompatibleMethod(inheritedMethod, currentMethod.parameters, this.type.scope, invocationSite);
327
		for (int i = length; i < inheritedLength; i++)
328
	return substitute == null ? inheritedMethod : substitute;
328
			arguments[i] = inheritedTypeVariables[i].erasure();
329
	}
330
	ParameterizedGenericMethodBinding substitute =
331
		new ParameterizedGenericMethodBinding(inheritedMethod, arguments, this.environment);
332
	for (int i = 0; i < inheritedLength; i++)
333
	    if (inheritedTypeVariables[i].boundCheck(substitute, arguments[i]) != TypeConstants.OK)
334
	    	return inheritedMethod; // incompatible due to bound check
335
   return substitute;
336
}
329
}
337
boolean detectInheritedMethodClash(MethodBinding inherited, MethodBinding otherInherited) {
330
boolean detectInheritedMethodClash(MethodBinding inherited, MethodBinding otherInherited) {
338
	if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure()) return false;
331
	if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure()) return false;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java (-9 / +9 lines)
Lines 367-381 Link Here
367
			return this.originalMethod.hasSubstitutedParameters();
367
			return this.originalMethod.hasSubstitutedParameters();
368
		return super.hasSubstitutedParameters();
368
		return super.hasSubstitutedParameters();
369
	}
369
	}
370
	/**
370
//	/**
371
	 * Returns true if the return type got substituted.
371
//	 * Returns true if the return type got substituted.
372
	 * NOTE: generic method invocation delegates to its declaring method (could be a parameterized one)
372
//	 * NOTE: generic method invocation delegates to its declaring method (could be a parameterized one)
373
	 */
373
//	 */
374
	public boolean hasSubstitutedReturnType() {
374
//	public boolean hasSubstitutedReturnType() {
375
		if (this.inferredReturnType) 
375
//		if (this.inferredReturnType) 
376
			return this.originalMethod.hasSubstitutedReturnType();
376
//			return this.originalMethod.hasSubstitutedReturnType();
377
		return super.hasSubstitutedReturnType();
377
//		return super.hasSubstitutedReturnType();
378
	}
378
//	}
379
	/**
379
	/**
380
	 * Given some type expectation, and type variable bounds, perform some inference.
380
	 * Given some type expectation, and type variable bounds, perform some inference.
381
	 * Returns true if still had unresolved type variable at the end of the operation
381
	 * Returns true if still had unresolved type variable at the end of the operation

Return to bug 91728